Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

How do I send a float data by SPI?

0 votes
517 views
Hi,

I am trying to send a float data with a length of 32 bit in PLECS coder between two launchpads f28379D by SPI communication. As I warned, the register of SPI only support a data 16 bit and I have to implement two C-scripts. The first C-script to split the data float in two packets of 16 bit, and the second one is used to receive the same packet and restore the data float in the other end (a review of their code you can review the file attached named "C_float2bit").  

But when I try to implement the SPI communication to the transmission of two float data, two sinusoids, (one green and one red), just only the second data (red) is received by the slave (or Master) and the green signal replicates the red signal, e.i, are equivalent by phase and amplitude.

My question is Do you know how to fix that or why that happen? I attached the file model named "prueba SPI 28379D master-slave with float data 2" for more information.
asked Jan 25, 2021 by efrain ibaceta (38 points)

1 Answer

0 votes
Hi Efrain,

As I explained it to you in the email, the problem is with your C-script block for packing and unpacking the float. Use the attached blocks instead.

Regards,
Manu
answered Jan 25, 2021 by Manu Parimi (363 points)
...