32 bit SPI

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

cross mob
himc_284346
Level 3
Level 3
Welcome! 10 replies posted 5 replies posted

 Hi,

   

I need to transfer 32 bit over SPI. How can I do that?

   

Thanks

0 Likes
1 Solution
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Just configure the SPI master to 8 bit data width, and send 4 bytes. Nothe that, when the clock is fast enough, you need to control the slave select line manually (otherwise it might go high inbetween consecutive bytes).

View solution in original post

0 Likes
4 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Just configure the SPI master to 8 bit data width, and send 4 bytes. Nothe that, when the clock is fast enough, you need to control the slave select line manually (otherwise it might go high inbetween consecutive bytes).

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Hi Hi-Z,

   

We can send 32-bit data via SPI with the available 8/16bit SPI component by controlling the slave select pin in firmware. To achieve this, place a GPIO pin in the top-design of your project and control the slave select pin of SPI slave component by writing to this pin. Write zero to the pin before tranfering the data and write one when 32 bit data is transfered. I am attaching a code example which will describe the same.

   

Regards,

   

Thinkle

himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

 Hi,

   

Adding to the above mentioned points the SS pin will be active until SPIM_STS_SPI_DONE flag is set. This flag will be set only when the TX FIFO is empty. If you are transferring data continuously to the Tx FIFO at a very fast rate, such that before completing the tranfer of the  btye which was written first , if the next byte is written to the FIFO, then SS pin will not get deactivated in between. You can use, DMA for transferring data to SPI TX FIFO.

   

Thanks

GrRa_284656
Level 2
Level 2
5 sign-ins 10 replies posted 5 replies posted

Hi to all!

   

Inside the SPI_32_bit.zip file, there is also a SPIM_32bit library that contains a component: SPI_Master32_v2_40.

   

This is a SPI Master component that works up to 32 bit.

   

Dear GORE, is this component fully functional?

   

If this components works (I will test it in the next days), it is possible to include it into new versions of PSoC Creator?

   

Thank you very much.

   

Graziano G. Ravizza

0 Likes