2025-01-31 11:52 AM - edited 2025-01-31 12:40 PM
Hello,
I am trying to get my ADC using DMA working in my freertos program running on the M33 core of the stm32mp257 processor. I set up ADC1 on HPDMA3 using cube MX see config below.
I am getting a few issues.
1. If I used the generated code I get a runtime crash because the HAL layer was trying to access of null object hacd->DMA_Handle. I got around that issue by adding this line to HAL_ADC_MspInit()
hadc->DMA_Handle = &handle_HPDMA3_Channel11;
Not sure why this was not getting generated by MX.
2. I was getting another crash because of another reference to null variable pQueueLinkList. MX generated this in HAL_ADC_MspInit(). pQueueLinkList was defined but never initialized to anything. I needed to remove this piece of code as well.
if (HAL_DMAEx_List_SetCircularMode(&pQueueLinkList_HPDMACH11) != HAL_OK)
{
Error_Handler();
}
Once I got past these issues I was able to start up my program without crashing. Now the main issue that I would like help with is that I do not get the interrupt triggered for HAL_ADC_ConvCpltCallback(). I am calling HAL_ADC_Start_DMA() and HAL_ADC_Stop_DMA().
I do get the interrupt when I call the non DMA versions. HAL_ADC_Start_IT() and HAL_ADC_Stop_IT(). So it seems to be an issue with the DMA.
Any ideas? Thanks.
Edit: I attached the stm32mp2xx_hal_msp.c and noticed that it is generating stuff for linked list when I have my DMA channel set to standard request mode. Is that what is supposed to be generated?