cancel
Showing results for 
Search instead for 
Did you mean: 

Suspecting the ADC measurements or PWM timer output coming wrong for every 65535 iterations.

Harish1
Associate III

Here below is the detail of my application.

I am running the PWM timer1 at 5Khz in up-down mode. Two interrupts, one in timer counter equal to zero and ADC fast conversion done.

Interrupt generates at every timer counter equal to zero then I start the ADC fast conversion and all my control runs in interrupt of ADC fast conversion.

All my currents are okay until 65535 timer carriers(13.1s = 65535/5000) and the currents are a little bit shifting after 65535 timer carrier for some time and settling normally.

Here, PWM timer and ADC fast conversions are making the 65535 iterations.

At this overflow condition, the only issue is coming constantly. I have changed from 5Khz to 4Khz and the issue is reproducing similarly(16.3s = 65535/4000).

Did anybody face this kind of overflow issue?

5 REPLIES 5
TDK
Guru

Can you show the code? Surely there's a bug in there somewhere.

If you feel a post has answered your question, please click "Accept as Solution".
Harish1
Associate III

Hi,

Two HAL files(PWM and ADC) and both are very big to share here. Is there any other way to discuss this with you?

Hello,

you can zip your files and post them here.

Harish1
Associate III

I have attached the required files, can you just look into them?

TDK
Guru

Where within those files do you get the incorrect value? I don't see a main logic loop in any file you've provided.

If you feel a post has answered your question, please click "Accept as Solution".