cancel
Showing results for 
Search instead for 
Did you mean: 

SPI DMA with CRC Question

psd
Associate II
Posted on August 19, 2009 at 06:01

SPI DMA with CRC Question

3 REPLIES 3
psd
Associate II
Posted on May 17, 2011 at 13:20

Hi,

I developing a high speed SPI connection between 2 STM32 chips. I would like to use the CRC feature. I got the SPI master connection working with DMA (Tx channel). When the DMA is completed it automatically sends the CRC byte per spec. On the other chip I got the SPI slave connection working with DMA (Rx channel) too, but I can't seem to get it to automatically send the CRC when the master is sending its CRC. I checked the control register and everything is what it is supposed to be (CRCEN=1), and the DMA interrupt fires when the DMA is finished receiving the last data byte, but it does NOT send the CRC byte, like the master does.

I have two questions:

1 - Do I have to setup a Tx DMA channel on the slave side to get the SPI to automatically send the CRC byte ? I am not using it right now because the slave has nothing to send while it is receiving bytes from the master.

2 - There is a warning in the spec sheet about mixing SPI DMA and IRQs. I start out each transmission with an RX interrupt. Once the SPI IRQ determines everything is OK, it masks the RX IRQ, setups up DMA, and enables the DMA. The DMA proceeds, and when it is done it's IRQ fires and I disable DMA and ummask the RX IRQ to complete the protocol. Is this the way to do it ? Does anyone know anything about the internals of the peripheral ? I just can't seem to get enough information out of the reference manual to figure this out myself.

Thanks,

Phil

no answer to be seen here.

Yeah, to a post from nearly a decade ago, congrats on poking a zombie, hope you don't catch anything...

ST's SPI + CRC implementation was implemented by someone with about zero comprehension of an actual use case, ditto the NSS functionality.

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