cancel
Showing results for 
Search instead for 
Did you mean: 

How can I send 32 bit data with STM32 ?

fatihaksoy59
Associate II

I want to send 32 bit data and I want to read 16 bit data. 

How can I make this ?

Best

7 REPLIES 7
AvaTar
Lead

By any of the interfaces.

Being more specific would surely be helpful.

fatihaksoy59
Associate II

Okey .

I'm using STM32L052K6 and SPI1 and I want to use TI ADS8661 . But I couldnt make this.

32-bit data is a collection of 4 bytes, send the data as you would a collection of 4 bytes.

Do you understand data representation concepts and C programming, pointers, casting?

STM32 represents a few hundred different and varied parts at this point, care to be more specific?

Send data where?

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

I want to use a ADC Converter from Texas Instruments. I'm newbie in C Programming . I designed new circuit board and I want to communicate on STM32 with ADS8661.

If you are doing this in an educational context you should perhaps review this with your teacher/supervisor? Teachers can be revered whilst still expecting them to do their job.

With SPI you'd likely want to send out a packet covering the total size of the transaction (command, address, data, etc), whilst reading the data symmetrically returned into a similarly sized array. Then extract the word from the bytes in the array. There should be a HAL SPI "TransmitReceive" function that facilitates the interaction. You will likely need to drive the chip select signals low and high manually.

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

I ask a question and you always give a bad answer.I just want to learn and I want it from the community, not my teacher.Don't answer if you don't know my question.

Someone else can come and give the right answer.

S.Ma
Principal

Keep it simple then optimize: Use the SPI in 8 bit mode and slice your 32 bit in 4x8 bits, because anyway, the ADC and the STM32 may not store the 4x8 in the same order (MSB byte first or LSB byte first).

Later you will discover the optimisations such as use of DMA or SPI FIFO or 16 bit SPI data registers to make sure the transfer of a complete block of bytes goes without time gaps.