how to use SCB SPI 4.0

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
li09c_3970351
Level 1
Level 1

Hi Expert,

   I use the SCB SPI 4.0 component. it created code automatically. I just need polling read/write, but I can't find any read/write functions. does it access the fifo registers for r/w data?

pastedImage_0.png

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I don't know where you are searching for APIs, but a brief look into the datasheet will show up

SpiGetRxBuffersize() and SpiGetTxBuffersize() APIs which return the number of bytes in the resp. buffer.

Keep in mind:

For every bit (byte) the SPI interface gets, one bit (byte) is returned immediately. When the very first byte is sent, the interface does not "know" yet what to answer, so a dummy byte is returned which should be skipped.

SPI has no read command, so you must send dummy bytes to retrieve the information wanted.

A pitfall is the select line, which is automatically taken low when a byte is sent. When the buffer is empty it is taken high again. This can lead to interface errors when the byte sequence is not provided fast enough resulting in ss-line glitches.

Bob

View solution in original post

0 Likes
1 Reply
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I don't know where you are searching for APIs, but a brief look into the datasheet will show up

SpiGetRxBuffersize() and SpiGetTxBuffersize() APIs which return the number of bytes in the resp. buffer.

Keep in mind:

For every bit (byte) the SPI interface gets, one bit (byte) is returned immediately. When the very first byte is sent, the interface does not "know" yet what to answer, so a dummy byte is returned which should be skipped.

SPI has no read command, so you must send dummy bytes to retrieve the information wanted.

A pitfall is the select line, which is automatically taken low when a byte is sent. When the buffer is empty it is taken high again. This can lead to interface errors when the byte sequence is not provided fast enough resulting in ss-line glitches.

Bob

0 Likes