Data rates in K53 Kinetis for SPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data rates in K53 Kinetis for SPI

792 Views
samyuktaramnath
Contributor II

Hello all,

As I had mentioned earlier, I am trying to get an ADAS1000SDZ Analog Front End and a K53 microcontroller to talk to each other.

I managed to find out that the reason I wasn't getting any data into the RX FIFO register was that the SCLK I was giving from the microcontroller (master) was too high for the ADAS1000(slave), which was outputting data at 2kHz. SCLK was at 12.5 MHz.

When I keep the SCLK around 800kHz rate, I get some data (sometimes, at other times it still gives zero always). When I run the code in debug mode, after sending the read command to the slave from the master, it does return some data, byte by byte. In debug mode I get a final 32 bit hex value as the data outputted. (I have still not verified that this data is a sine wave, as it is supposed to be).  However when I run the program normally, all I get is a long stream of zeros.

I understand that the speed at which the microcontroller is looking in to the FIFO is much higher at normal run time than in debug mode. This suggests that I should reduce the SCLK given by the microcontroller. It would also seem that I should match the two speeds, giving a 2kHz output SCLK. However, in the datasheet for the ADAS1000, it says that the minimum SCLK for 2kHz output is around 800kHz.  (Reference to Unable to get data out on ADAS1000 SPI pin | EngineerZone  )

What could be the reason that I sometimes get a long stream of zeros no matter what data rate I put, (even in debug mode), sometimes I get legitimate data in debug mode but not in run time, and sometimes in normal run time, I get a long stream of zeros followed by a short burst of clusters of 32 bit data followed by another long stream of zeros?

Labels (1)
0 Kudos
Reply
1 Reply

617 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Samyukta,

I have downloaded and browsed  the data sheet of ADSA1000 from Analog Device website, I suppose you connect the SPI module of K50 to the primary SPI interface of ADSA1000, in other words, you connect the /CS, SCLK,SDI,SDO to the SPI pin of K50.

The frame size of ADAS1000 is 32 bits, but the maximum frame size of K53 is 16 bits, the TXDATA is 16 bits, fortunately, the SPI of K53 supports the Continuous mode, in other words, you can use two 16 bits frame as a 32 bits frame.  In detail, when you send the first word, set CONT bit in the SPIx_PUSHR, when you send second data, clear the CONT in SPIx_PUSHR, in this way, the /PCSx will cover 32 bits. Secondly, I suggest you do not use FIFO  mode, you can disable FIFO mode by

setting the DIS_TXF and DIS_RXF bits.

I suggest you write the SPI register directly instead of using SDK function, because SDK uses the stream data format, the writing function is to write the data to a buffer rather than writing SPIx_PUSHR directly.

Hope it can help you

BR

XiangJun Rong

0 Kudos
Reply