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.

CC2340R5: CC2340R5 SPI

Part Number: CC2340R5
Other Parts Discussed in Thread: CC2541

Tool/software:

Having a minor issue with the SPI module on the CC2340R5.

Basically I gave up with the TI Drivers as they were running way too slow for our application, 82+ us between transactions.

However, in the SPI info within the Technical Reference manual, SWCU193, the SPI includes a status Register (STA), within this register there
is a TXDONE bit.  

Ideally I need to poll on this bit to ensure the SHIFT out on the bus has completed, but I can never see this set, even through the IAR debugger. I can the 8 bits of data
have gone on out on the bus.

Anyone happen to know whether this bit is actually implemented fully and works okay? I can poll the BUSY bit okay, but that that doesn't ensure the SHIFT register has emptied.

Here the very simple code (after setup). Probably missing something really silly here. Have also made status a volatile.

HWREG( SPI0_BASE + SPI_O_TXDATA ) = txdata ;
do
{
status = HWREG( SPI0_BASE + SPI_O_STA ) ;
} while( ! (status & SPI_STA_TXDONE_TX_DONE) );

  • Hi Robert,

    I am observing similar behavior from my end, and there is little to no documentation on this bit.  Are you using DMA to transfer your SPI bytes?  I recommend polling BUSY for now.  You also may consider using the driverlib APIs

    spi.h driverlib reference
    hw_spi.h file
    SPI0 CPU register descriptions

    Regards,
    Ryan

  • Hi Ryan,

    Thanks for the reply. I am currently polling BUSY just to get this going. Not using any DMA's at the moment, but not sure there'll be helpful anyway as I can't send a hug data block to my particular target, lots of command + data implementations.  The biggest block is five bytes, I think the overhead of setting up the DMA is probably more instructions than just trying to blast this quickly.

    I had hoped that polling TX Data, I could compress the time between the transactions, if BUSY is the only way I'll stick with that for now. 

    Documentation still needs improving. There is some errata sheets for the processor mentioning SPI but I can't find anything specific on that TX DONE flag, could still be a silicone bug maybe.

    I've save about 80us, down to <2us between transfer blocks compared to the TI Drivers, but still not matching the speed I had with the old CC2541 which is a little disappointing at the moment.

    I'll keep chipping away at this.

    Rob