2024-08-18 08:42 AM
I am trying to get the PCM1808 ADC working on my STM32H7 using Cube IDE, but get stuck regarding endianness.
I understood STM32 is little endian and i2s is big endian. I am trying to receive 24 bit data via DMA but when reading my DMA buffer I am not sure of the endianness. The buffer is 16 bit so the 24 bit data is split into two and some zero's get added if I am understanding it correctly. My first byte is some number, the second is all zero's e.g.
1011110000000000
Then the third is always all 1's or all 0's and the last byte is some number again e.g.
1111111111111010 or 100
But I was expecting either the first three bytes to be a number or the last three and the rest to be 0's.
Does it automatically change the endianness from big to little per index in the buffer (16bits) or does it do it for the whole 32 bits. Or does the STM32 not do anything with the big endian number and just literally copy it into the DMA in big endian representation.
Is there something I'm missing?
DMA is set to circular word and SAI i2s is set to 32bit data.