2024-09-09 01:57 PM
Hello,
- STM32H743
-SPI2 Slave mode, RX only
If the frame has the format N x data + CRC, is it possible to receive the CRC and not just the result of comparing it with the calculated CRC?
Receiving a CRC does not set the RXP bit and is not entered into the FIFO.
An attempt to read the RXCRC register during transmission always gives the result of the CRC for the previous frame.
I really need to calculate the CRC for the entire frame because I have the N x Data format without CRC. These are image frames and I want to recognize through CRC whether the frame is the same as the previously received one.
But turning on SPI CRC mode means I don't have access to the last data.
I tried to see if CRC is calculated with TSIZE=0 but the RXCRC register always returns a value of 0.
BR JarekC
2024-09-12 02:07 AM
SPI in 'H7 is an overcomplicated beast and I don't use it so this is not a solution just an idea: what about mimicking receiving a longer than N-byte message?
JW
2024-09-12 01:15 PM
Then I will lose the first data from the next packet.
JarekC
2024-09-12 01:34 PM
Isn't the mechanics that it just drops out with a zero remainder on the host side?
That's how this stuff normally works, you read ALL the bytes, and the CRC thru-itself divides to zero, and it checks the CRC "accumulator == 0" not a byte for byte comparison.
Computing in software via a table, is pretty efficient so consider that too.
2024-09-13 11:06 AM
The main problem is that the RXCRC register is updated only after receiving TSIZE data and reading it during transmission gives the result 0. Although the reference manual says otherwise
When CRC calculation is enabled, the RXCRC[31:0] bits contain the computed CRC value
of the subsequently received bytes. CRC calculation is initialized when the CRCEN bit of
SPI_CR1 is written to 1 or when a data block is transacted completely.
Note: A read to this register when the communication is ongoing could return an incorrect
value.