Can K26 perform hardware CRC within its DMA engine?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can K26 perform hardware CRC within its DMA engine?

1,302 Views
lucasrangit
Contributor III

Is it possible to perform a CRC within the DMA engine of an SPI read on the K26 or similar Kinetis MCU?

I currently use the KSDK to issue a `DSPI_DRV_EdmaMasterTransfer()` followed by a `CRC_DRV_GetCrcBlock()` to validate the data. It would be ideal if the KSDK `DSPI_DRV_EdmaMasterGetTransferStatus()` could be augmented to return not only the number of frames transferred but also a CRC result. i.e.

dspi_status_t DSPI_DRV_EdmaMasterGetTransferStatus(uint32_t instance, uint32_t * framesTransferred, uint16_t * crcResult)

I have read through the K26 reference manual but could not find a configuration option for the DMA engine or a way to feed the output of a DMA transfer through the CRC data register.

Is this possible? Does the ARM Kinetis support this optimization? I am more than happy to add support for this to the KSDK drivers as necessary.

Thanks for the advice.

Labels (1)
Tags (4)
4 Replies

889 Views
ndavies
Contributor V

Hi Lucas.

You can do this by chaining 2 DMA channels together. The first DMA channel is set up to transfer the data from the SPI to a reception buffer. This DMA transfer then triggers the chained DMA channel to copy the data from the reception buffer into the CRC generator.

Norm Davies

889 Views
lucasrangit
Contributor III

Thanks ndavies​​! I'll try that once I figure out how to link two DMA channels using the KSDK. I ran into some issues and posted a question to https://community.freescale.com/docs/DOC-329546#comment-33681​ . After that I will add the code to configure the CRC engine with the destination address of the chained DMA transfer and report back.

0 Kudos

889 Views
ndavies
Contributor V

Sorry, I can't help you with the SDK side of it. We're not using the SDK. I just wanted to point out that the hardware is capable of doing what you need. You'll probably have to write additional SDK compatible code to get it to work.

We have an in-house designed peripheral that needs 5 DMA channels all chained together. It's needed to provide timing, command processing, intensive data IO transfers and CRC generation.

There's an app Note on using the ADC with chained DMA channels that may help you with the DMA chaining. It's where I started when I needed to get my peripheral up. AN4590.pdf "Using DMA to Emulate ADCFlexible Scan Mode on Kinetis KSeries"

http://cache.nxp.com/files/32bit/doc/app_note/AN4590.pdf?fpsp=1&WT_TYPE=Application Notes&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation&fileExt=.pdf

889 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hello Lucas

I am sorry to tell you that there are no such functions in KSDK1.3 and KSDK2.0(not released yet).

The DMA can transfer spi data into the receiveBuffer , but the DMA can't transfer the spi data into CRC module at the same time.

You need transfer the receiveBuffer into CRC module manually , for example using CRC_DRV_GetCrcBlock.

Best Regard

Robin

0 Kudos