2024-04-22 11:54 PM
I enabled the SPI CRC calculation (with a length SPI_CRC_LENGTH_16BIT) in my STM32H563ZI master application. During Tx, I want the 2 bytes of the calculated CRC to be swapped and transmitted i.e. a CRC of 0xABCD must be sent out as 0xCD 0xAB and not as 0xAB 0xCD.
Can someone let me know how to do this?
Thanks.
Solved! Go to Solution.
2024-04-23 12:38 AM
Well, i never used it, so i am just guessing:
- if you use the spi-auto-generated crc, you cannot "swap" this. It expects an STM32 with same crc unit as target.
- if you calculate the crc yourself , maybe with the crc unit or just in software, swap bytes, and put it as last value to the send-array , then send all; this should work, if you calculate crc exact in the way, the target expects.
2024-04-23 12:14 AM
>CRC of 0xABCD must be sent out as 0xCD 0xAB and not as 0xAB 0xCD.
Why this ?
2024-04-23 12:21 AM
My slave application running on a different target receives the CRC in that order ( lower byte first ).
2024-04-23 12:25 AM
Can this be done using CRC peripheral itself rather than using SPI's CRC feature?
2024-04-23 12:38 AM
Well, i never used it, so i am just guessing:
- if you use the spi-auto-generated crc, you cannot "swap" this. It expects an STM32 with same crc unit as target.
- if you calculate the crc yourself , maybe with the crc unit or just in software, swap bytes, and put it as last value to the send-array , then send all; this should work, if you calculate crc exact in the way, the target expects.