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.
Dear All,
I am using ADC ISR which is getting triggered by EPWM at COMPA match.
I am using TI's sample code and modifying it as per project need.
After some time PWM isr continues but ADC isr stops .
I am giving sine wave as input to ADC channel.
Thank You.
Dear Sir,
Thanks in advance for your prompt reply,
I have observed IER & IFR flag status. With previous version of software there was less instruction in ADC ISR Rouine &
it was working fine with IER zeroth bit (for ADC interrupt) toggling & 4th bit (ECAP interrupt) remains steady to 1.
IFR all bits are at zero.
But after further modification ADC ISR takes more time & before failing of ADC ISR, IER status is 1001 (remains constant)
IFR all bits are at zero.
But if in watch window i set IFR zeroth bit ADC ISR again starts & IER zeroth bit starts toggling & after some time ADC ISR it again stops
Hi,
As per your explanation, it seems, after you added additional code in the ADC ISR, it is taking more time.
Which might be leading to ISR overrun..
1. What is the rate of the ADC ISR.?
2. What is the time taken by your functions inside the ISR?
If (2) > (1) , then its ISR overrun, which you need to handle by reducing the time taken to perform the operations.
Regards,
Mohan
Hi,
Time taken by ADC ISR is 41.666KHz & ADC ISR is triggered at 20.48KHz.
& why IER register's status is changing execution of program.
If failures reason is ISR overrun then why is this happening after some time & not within a short period
of time ?
Please I am confussed & stuck.
Thanks & Regards
bhuvaneshwar
1 / 20k = 0.05 ms
1 / 40k = 2 ms
This is clear indication of the frame overrun, as you function is taking 2ms, when your ADC ISR is 0.05ms.
This is happenning after certain time, because, you may not be having much task during the intial time, and may be certain other functionalities added a over head to the ISR function.\
You can debug, by referring back to your old function which wa working and check by adding one by one functionality and check when its overrunning,.
Or start commenting the fucntions in the issue sw, and see when the issue gets resolved. this will help you in identifying the root cause and to fix the issue.
And you can try to optimize the software by using the compiler optimization, which may help in reducing the time.
You may make run your ISR function in the RAM , so that the time taken to acces the related function and variables are consideribly less, which will reduce the time taken by the function.
Regards,
Mohan
Dear Mohan,
Thanks in advance .
ADC ISR triggring timming is 20k so its 50micro seconds, & time taken by ADC ISR is 40micro seconds
which is 25micro seconds , which is approximatly half of it.
So why it should stop ?
I am using lots of static variables is it due to this reason
all function are time critical so should be executed whithin ISR only.
is there other alternative or Global varible can stop this problem ?
regards,
Bhuvaneshwar
Dear Mohan.
ADC ISR triggring timming is 20k so its 50micro seconds, & time taken by ADC ISR is 40micro seconds which is 25micro seconds , which is approximatly half of it. So why it should stop ? I am using lots of static variables is it due to this reason all function are time critical so should be executed whithin ISR only. is there other alternative or Global varible can stop this problem ?
Thank You