SPI CRC via DMA dosen't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 2:37 AM
Dear ST,
I use STM32F777 and try to receive SPI Data as a slave via SPI DMA. That works only pretty fine, when I don't activate the CRC Checksum calculation. I receive after the DMA threshold the expected data, but when I set:
Poly is 0x1021
Inti value is 0x0000
If I use the CRC HW Unit via SW, that works as well. But I still have to use the combination of DMA and CRC, because that part is on our application, very time critical. I still can not use the CPU instead.
- Labels:
-
STM32F7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 4:18 AM - edited ‎2024-11-25 4:19 AM
Disclaimer: I've never used the CRC facility in STM32 SPI.
> The received data traped in a Error Callback from the SPI, always.
What is "Error Callback from the SPI"?
Do you use some "library"? Which one? How? Why? Did you try your own code with possibly better control?
Have you tried using polled implementation?
> Dear ST,
While this forum is monitored by ST, it's primarily user-driven.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 5:10 AM
Hi JW,
ErrorCallBack is:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 5:18 AM
So, the problem is, that CRC calculated by the SPI unit does not match CRC calculated by FPGA, correct?
Can you give a couple of examples?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 8:25 AM
Example: Teststring= 0xA5 A6 8C 00
Poly= 0x1021
Init Value=0x0000
I would be expect as result= 0x07 FA
I try to verify the CRC from DR register at least and got: 0x008C
When is use the the SW calculation routine I got also the result 0x7FA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 10:19 AM
I have the feeling CRC->DR is only 8bit wide? I wondering why is the value only 0x8c, looks like a copy of the third byte.
I configure:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-26 2:45 AM
I'm confused: are you talking about the CRC module or about the CRC feature of SPI module?
In the latter case, you'd be presumably looking at the content of SPIx_RXCRCR.
Using DMA may be tricky: the CRC feature in SPI apparently assumes, that master actually transmits the CRC after data.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-26 3:01 AM
Jan the Master send the CRC 16bit in the data end. I need to use the CRC on the SPI with DMA.
x 8 bit data Input
16 bit crc output. See example above.
This fails all the time in a SPI Error, because the SPI Errocode shows me 0x2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-14 5:51 AM
Any updates regarding that problem? The problem is still not solved and need attention from STM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-12 2:21 PM
Hello Ulfs,
CRC peripheral is only CRC32 with polynomial 0x4C11DB7. The configuration below you provided is related to CRC calculator of SPI peripheral.
.CRCCalculation = SPI_CRCCALCULATION_ENABLE, // ToDo activate CRC
.CRCPolynomial = CRC16_CCIT_ZERO, // ToDo activate CRC
So CRC->DR register has nothing to do with your implementation. I suggest you to review the section "CRC transfer managed by DMA" under SPI in reference manual.
For any CRC calculation this site helps a lot: https://www.sunshine2k.de/coding/javascript/crc/crc_js.html.
As waclawek.jan suggested, check content of SPIx_RXCRCR as well.
