AnsweredAssumed Answered

Temporization problems updating PWM configuration - ADuCM360

Question asked by Absel on Jan 17, 2018
Latest reply on Mar 12, 2018 by barryzhang

Hello.  I am having a lot of issues trying to implement a PWM modulation in order to control a tri-state buffer. The main problem is related to the temporization: I am trying to reconfigurate the PWM High-side by using PwmTime and PwmLoad at every PWM interrupt. I have it implemented in the main function, being it enabled by a flag every time an interruption of the PWM occurs. I will attach my code.

The problem comes when I try to visualize if this is going accordingly with the interruption time, which comes with a period of 10 ms. The results are these:

 

 

 

Where the upper signal is the inverted PWM signal and the lower one is a DioTgl executed every loop in the main function. As you can in the signal below, this is a total mess. It should Toggle every 10 ms and it's actually doing it randomly. (Note that in this case, I have disabled the UART send function)

Any ideas?

 

 

EDIT: I feel like there is no way to activate the main loop every time an interruption of the PWM is triggered, I have cleaned my code just to see if the main loop was being activated every PWM period but it doesn't work. Well, If I clean the code and I only Toggle the LED every time the flag coming from the interrupt is enabled I find a good temporization, with a Toggling of 10 ms, but once I put some code in the function it gets a total mess.

 

 

 

It's kind of urgent, so any help will be really grateful.

 

Regards,

Attachments

Outcomes