Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
SuMa_296631
Level 5
Level 5
50 replies posted 25 replies posted 10 replies posted

I have created a small test program (attached) that runs on the CY8CKit-050.

   

Basically I have a UDB PWM that triggers an interrupt on the terminal count and both of the compare events (which are set up to be about 1/3 and 2/3 through the period). The PWM ISR sets a pin high and also starts an ADC conversion (which itself has an ISR that drops the pin and also outputs the ADC value).

   

The idea is that I want to time turning on a LED with the PWM signal and then get an ADC reading while LED is lit (and also later when the LED is not lit for comparison purposes).

   

The issue I have is that the pin signal is raised about 3uSec (as seen on my scope) BEFORE the PWM output pin goes high. I would have expected the PWM signal to go high, THEN the ISR to trigger and THEN the code to set the pin high be executed which would ensure that the ADC sampling is started after the LED is lit.

   

As it stands, the processor seems to be calling the ISR and executing code before the UDB is actually raising it's output.

   

Is this correct order of events? Is there a way to achieve having the ISR called AFTER the PWM event?

   

Susan

   

Edit: By way of a cross-check I changed the PWM form UDB to Fixed and the issue remains.

6 Replies