2024-10-10 07:42 AM
I am currently working on calculating the FLASH CRC through DMA on the NUCLEO-H755ZI-Q development board. I've successfully read from flash and calculated the CRC using DMA in memory-to-memory.
Now, I'm facing challenges while configuring DMA for DMA_MEMORY_TO_PERIPH. I attempted to read directly from flash into the CRC register using the following call:
" HAL_DMA_Start(&hdma_dma_generator0, (uint32_t)flash_start_addr, (uint32_t)&CRC->DR, FLASH_BUFFER_SIZE); "
Is it feasible to calculate the CRC using DMA_MEMORY_TO_PERIPH? I would appreciate any suggestions or insights you might have!
Here are my current DMA configurations:
hdma_dma_generator0.Instance = DMA1_Stream0;
hdma_dma_generator0.Init.Request = DMA_REQUEST_GENERATOR0;
hdma_dma_generator0.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_dma_generator0.Init.PeriphInc = DMA_PINC_ENABLE;
hdma_dma_generator0.Init.MemInc = DMA_MINC_ENABLE;
hdma_dma_generator0.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_dma_generator0.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_dma_generator0.Init.Mode = DMA_NORMAL;
hdma_dma_generator0.Init.Priority = DMA_PRIORITY_HIGH;
hdma_dma_generator0.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
Thank you for your help!
2024-10-10 08:00 AM
Use "memory to memory".
Don't let the "peripheral" and/or "memory" confuse you, it is (mostly) not about physical memory or peripheral, but about the way how DMA is triggered. In M2M transfers, DMA is triggered automatically by DMA itself and performs all transfers at once. Other transfers require some peripheral to trigger them.
JW
2024-10-15 07:50 AM
Hello @Dilip_Kumar
the Peripheral Increment Mode should be set to DMA_PINC_DISABLE to keep the peripheral address constant. Additionally, you need to ensure that the data alignment settings match the requirements of the CRC peripheral.