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.

CCS/CC2640: lower CC2640 SPI clock

Part Number: CC2640
Other Parts Discussed in Thread: ADS1292

Tool/software: Code Composer Studio

Hello, 

New to CC2640 and Sensor controller Studio. working on reading data from ADS1292 through a SPI bus. 

we need to low the SPI clock bellow 512KHz. don't know how to do it. 

I did search the TI forum for a while, notice there were few discussing of the SPI clock rate, but didn't find a clear solution to lower it bellow 512KHz.

Appreciate your help.

David Sun

  • Hello David,
    I believe you do not need to lower the clock. Please refer to these two posts:
    e2e.ti.com/.../1657723
    e2e.ti.com/.../1792301
  • You can change the bitRate to anything lower than 4M(slave)/12M(master).

    When you use our SPI driver which comes with TI-RTOS, you can easily set the bit rate by changing the bitRate field in the initialization step

     *  PIN_Handle pinHandle;
     *  SPI_Handle handle;
     *  SPI_Params params;
     *  SPI_Transaction transaction;
     *  uint8_t txBuf[] = "Heartbeat";    // Transmit buffer
     *  uint8_t rxBuf[9];                 // Receive buffer
     *  PIN_Id misoPinId;
     *  uint32_t standbyDurationMs = 100;
     *
     *  // Init SPI and specify non-default parameters
     *  SPI_Params_init(&params);
     *  params.bitRate     = 1000000; // use whatever you want as long as it's within the spec
     *  params.frameFormat = SPI_POL1_PHA1;
     *  params.mode        = SPI_MASTER;
     *
     *  // Configure the transaction
     *  transaction.count = sizeof(txBuf);
     *  transaction.txBuf = txBuf;
     *  transaction.rxBuf = rxBuf;

  • Thanks Christin,
    He was referring to sensor controller studio ;).
    But a valid point if you choose to use the TI-RTOS SPI driver instead David.
  • Hi Eirik

    for the first thread won't apply to out case, we don't implement external crystal on our board. we have to use internal 512K clock. 

    the second thread of 1792301 is a bit too complicate for me to read through, may repeat my question again. I am using ADS1292 with internal clock 512K. 

    MCU us cc2640. when we use SPI to  communication with ADS1292, we notice the clock is higher than the ADS1292 data sheet requirement, internal clock only support upto 1Mhz SPI clock.

    if the thread you mentioned in /1792301 is explain how to make this work with internal 512K clock situation. then I will sit down and spend some to read this link line by line. 

    Thanks,

    David Sun

  • Hello David,
    The general SPI rate on ADS1292 is limited to maximum 20 MHz:
    tSCLK - SCLK period 50 66.6 ns

    There are other considerations and rules outlines in the data sheet which you will have to study carefully to make it work. For example at which speed the SPI interface can run during a register read or write (SCLK can be only twice the speed of fCLK, therefore use the balanced option of 1.1 MHz in sensor controller studio). It is worth reading the threads i posted links to above in case you find some useful info.

  • Hi Eirik

    in one of the thread you mentioned. I copied here to make it easier to reference. we are using internal clock of ads1292. so the max PCI clock is 512kHz, if I understand correctly. but the sensor controller minimus clock for SPI is 1.1Mhz.  is it possible to use sensor controller to drive ADS 1292 SPI clock? 

    Yes or NO, Please.

    David

    Hello Simon,
    Can you show the waveforms?
    Did you configure the ads1292 for using external clock at 2 MHz? I don't think the internal clock on the ads1292 support more than 512 kHz for the SPI clock:

    "SCLK can only be twice the speed of fCLK during register reads and writes. For faster SPI interface, use fCLK = 2.048 MHz and set the CLK_DIV register bit (in the LOFF_STAT register) to '1'.

    www.ti.com/.../ads1292.pdf

    Best Regards, Eirik

  • Hello David,
    I have not tested it and therefore I do not know if it will work. But you can try to copy and modify the SPI procedures from the Sensor Controller studio install path. Find the SPI procedures here:
    C:\Program Files (x86)\Texas Instruments\Sensor Controller Studio\proc_defs
    And make copies you place here:
    %USERPROFILE%\Documents\Texas Instruments\Sensor Controller Studio\proc_defs

    Then you can modify the SPI procedures by adding NOP's in strategic places in assembly to reduce the bit rate. The original is based on around 1.1 MHz for the balanced option.
  • Hi Eirik
    Thank you very much for providing detailed answer. I didn't expect that you give me a line by line code that will work right away. I just want get a confirmation that this solution can work or a direction that will work, so I can dig into it. if somebody already proved this doesn't work, it will be a waste of time. I will try your suggestion here. appreciate your help.

    David Sun