This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28335 SPI Clock Polarity

Other Parts Discussed in Thread: CONTROLSUITE, DAC7554

Hi,

My goal is to drive AD9850 via F28335 and spi. I am using SPICLKA as AD9850's W CLK. According to the AD9850 datasheet, after resetting AD9850, i need to send a pulse to the W CLK. At that moment SIMO is at logic LOW. 

Based on example C:\ti\controlSUITE\device_support\f2833x\v140\DSP2833x_examples_ccsv5\spi_loopback , this is what i do,

void spi_init()
{
SpiaRegs.SPICCR.all =0x0017; // Reset on, rising edge, 8-bit char bits,loopback
SpiaRegs.SPICTL.all =0x0006; // Enable master mode, normal phase,
// enable talk, and SPI int disabled.
SpiaRegs.SPIBRR =0x007F; // Baud rate
SpiaRegs.SPIFFTX.all=0xC040; // Enable FIFO's, set TX FIFO level to 0
SpiaRegs.SPIFFRX.all=0x005F; // Set RX FIFO level to (default)32
SpiaRegs.SPIFFCT.all=0x00; // no FIFO transmit delay
SpiaRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb xmission

SpiaRegs.SPICCR.bit.SPISWRESET=1; // Enable SPI
SpiaRegs.SPIFFTX.bit.TXFIFO=1;
SpiaRegs.SPIFFRX.bit.RXFIFORESET=1;

}

void AD9850_reset(void)
{
AD9850_Reset = 0; 
delay_loop(); 
AD9850_Reset = 1; 
delay_loop(); 
AD9850_Reset = 0; 

SpiaRegs.SPICCR.bit.CLKPOLARITY=0; // SPI clock 0
delay_loop();
SpiaRegs.SPICCR.bit.CLKPOLARITY=1; // SPI clock 1
delay_loop();
SpiaRegs.SPICCR.bit.CLKPOLARITY=0; // SPI clock 0

FQ_UD = 0;
delay_loop();
FQ_UD = 1;
delay_loop();
FQ_UD = 0;

}

Is this a proper way, sending a pulse via changing SPI clock polarity? Is there an other solution?

Thank you

  • Hello,

    We do not recommend changing any SPI configuration while the SPI is enabled (SPISWRESET=1). The SPICLK will not toggle while the SPI is held in reset. Sometimes the configuration sequences of external devices can be awkward and require non-standard toggling. It appears this is the case with the AD9580.

    Does this Reset happen only once (or at least infrequently) and not a part of normal transmission? If so, you might consider just configuring the SPICLK pin to be a regular GPIO for this function. You can switch it back to SPICLK immediately following the operation. It appears you have plenty of time available for the few instructions that will reconfigure the GPIOs.

    Thanks,
    Mark
  • Hello Mark,

    Thank you for the answer.  Reset operation is infrequent and spi operation is not time critical. I will try your suggestion.  So,  when i want to make AD9850 reset, first SPISWRESET=0, then change SPICLKA to gpio, toggle the gpio, change back to SPICLKA, SPISWRESET=1, then continıe back to normal spi operation.

    İs the sequence correct?

    Thank you

  • You do not need to put the SPI into reset (SPISWRESET = 0) if you are only changing the GPIO configuration. Otherwise yes, that would be the procedure to follow.

    Thanks,
    Mark
  • Thank you very much
  • Glad to help.
    If you have another question in the future, don't hesitate to post!

    -Mark
  • void InitSpiaGpio(void)
    {
    SpiaRegs.SPICCR.all = 0x000F;
    SpiaRegs.SPICTL.all = 0x0006;
    SpiaRegs.SPIBRR = 0x007F;
    SpiaRegs.SPICCR.all = 0x009f;
    SpiaRegs.SPIPRI.bit.FREE = 1;
    }

    Actually i want to use DAC on typhoon HIL where SPI signals are routed to DAC with 12-bit quad DAC7554 ic.


    DSP SPI DAC
    GPIO-16/SPISIMO-A DIN
    GPIO-18/SPICLK-A SCLK
    GPIO-19/SPISTE-A SYNC

    With above programming the SCLK signal is not generated.
  • Muhammad,

    Please refrain from responding to old posts. It is difficult to track additional questions. I see that you have created an additional post which you have some replies on. We will address you issue there.

    Regards,
    Mark