This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
The code initially ran normally in RAM, but after configuring FLASH to run, an ADC sampling abnormality occurred.
(Compared with Voltage1, 2 when running in ram before, the sampling value is too large), resulting in the calculated three-phase Ia/b/c current being too large. After clak transformation and park transformation, the ID/IQ calculated by the current loop PID is entered. The actual value of the current is too large, resulting in a large error. The accumulated value of the integral term directly reaches the integral limit value. The current loop PID solution is abnormal, causing the current loop to fail to operate normally.
At present, the problem of slow running speed of the current sampling function in FLASH can be eliminated, because the current sampling function has been moved to RAM for running, and the actual measurement running time is indeed shorter than that in FLASH.
参考下工程师的回复:
Do you put the control ISR and the ADC reading function to ".TI.ramfunc"? By doing this, the critical functions will be copied to RAM from Flash at the beginning of the program and eliminate the timing that needs to access Flash. You can refer to the universal motor lab project, in which you may find there is an extra statement: #pragma CODE_SECTION(motor1CtrlISR, ".TI.ramfunc") and "HAL_readMtr1ADCData" which reads the ADC signal as an inline function.