cancel
Showing results for 
Search instead for 
Did you mean: 

Why must we call MX_X_CUBE_AI_Process(); constantly in the while loop?

KSOdin2
Associate III

I have been working on taking measurements with the STMH7 microcontroller and using the measurements with ML to make classification predictions. When I generate the code MX_X_CUBE_AI_Process(); is generated and placed at the end of the while loop.

If I remove this process, as I do not want it to run constantly, my DAC which is with DMA does not work. I found a way around it to allow my DAC to work.

I find that if I do not run MX_X_CUBE_AI_Process(); then my DMA that reads the ADC doesn't return the correct values and returns 0's. This was the same behaviour with the DAC where the DAC signal would drop to 0.

Is the CubeAI designed to affect the DMA?

I find that it needs to run ai_run(); for no errors to appear?

Thanks

2 REPLIES 2
Piranha
Chief II

I've disabled the D-Cache, but the same issues occur. The DMA works fine, and so does the ADC DMA. Before I enabled CubeAI, it all works perfectly.

It's after I enable CubeAI I need to call ai_run() otherwise the DAC does not work and output the correct waveform. Then in the while loop, I need to call ai_run otherwise the ADC buffer values are sometimes 0 causing weird results.

I'll read up on those links again.

Thanks