cancel
Showing results for 
Search instead for 
Did you mean: 

How can I communicate with a 32-bit SPI device?

arnold_w
Senior
Posted on February 08, 2016 at 12:58

I need to communicate with a device that only supports 32-bit SPI transfers. I see that the stm32f4-family only supports 8 and 16 bits. Can I somehow do a hack to make it work?

5 REPLIES 5
Radosław
Senior
Posted on February 08, 2016 at 13:46

drive CS by software, split data

arnold_w
Senior
Posted on February 08, 2016 at 14:17

I forgot to mention, the stm32f4-microcontroller is the slave.

Posted on February 08, 2016 at 18:45

The SPI bus is synchronous, you'll just get 4x bytes, or 2x half-words per interaction.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
arnold_w
Senior
Posted on February 08, 2016 at 23:23

I don't understand, the SPI->DR register can only hold 2 bytes. So, I guess I would either receive the first 2 bytes in every transmission or the last 2 bytes. The spacing between the 2nd and the 3rd bytes is too small for me to have time to read the SPI->DR register in between. Likewise, I would problems with the data I would send to the master, I guess I would sent the same 2 bytes twice.

Posted on February 09, 2016 at 01:19

The data is buffered, the DR is not the shift register, so TXE will assert as soon as the DR moves to the shift register, and the first bit leaves. You have 16 clock cycles to replenish the DR in 16-bit mode, there is no inter-symbol time. If you don't think you can sustain it manually, use DMA.

Either way, as long as you don't underflow the consecutive 8/16-bit of data will pack back-to-back. With SD cards you're sending thousands of bytes with a continuous clock.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..