PWM stops while debug session is paused

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PWM stops while debug session is paused

1,006 Views
sanjay25
Contributor I

I have configured a PWM for a display backlight. It works fine when not debugging. However, while debugging, if a breakpoint is hit or I place a breakpoint in the code, the PWM output goes low and the backlight turns off. I have verified this on the PWM output pin.
I am using an MIMXRT1052 controller with Zephyr RTOS. I also tried setting the pwm_a (FLEXPWM4_PWMA0, which I am using) fault state to 01, but I still encountered the same issue.
Has anyone else faced this issue?

Labels (1)
0 Kudos
Reply
1 Reply

929 Views
Habib_MS
NXP Employee
NXP Employee

Hello @sanjay25,

Please verify that bit 15, labeled “DBGEN,” in the Control 2 Register is set to 1. This setting ensures that the PWM operates in debug mode. For more details about this bit, refer to section 54.8.4 of the RM.
Additionally, there is an example that demonstrates PWM implementation using FlexPWM in Zephyr. The example is called “PWM LED” and can be found in the MCUXpresso extension for VS Code, which could be helpful.

Habib_MS_0-1762988466669.pngHabib_MS_0-1762988466669.png


BR
Habib

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2200799%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EPWM%20stops%20while%20debug%20session%20is%20paused%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2200799%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20have%20configured%20a%20PWM%20for%20a%20display%20backlight.%20It%20works%20fine%20when%20not%20debugging.%20However%2C%20while%20debugging%2C%20if%20a%20breakpoint%20is%20hit%20or%20I%20place%20a%20breakpoint%20in%20the%20code%2C%20the%20PWM%20output%20goes%20low%20and%20the%20backlight%20turns%20off.%20I%20have%20verified%20this%20on%20the%20PWM%20output%20pin.%3CBR%20%2F%3EI%20am%20using%20an%20MIMXRT1052%20controller%20with%20Zephyr%20RTOS.%20I%20also%20tried%20setting%20the%20pwm_a%20(FLEXPWM4_PWMA0%2C%20which%20I%20am%20using)%20fault%20state%20to%2001%2C%20but%20I%20still%20encountered%20the%20same%20issue.%3CBR%20%2F%3EHas%20anyone%20else%20faced%20this%20issue%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2200799%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MXRT%20105x%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2203952%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20PWM%20stops%20while%20debug%20session%20is%20paused%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2203952%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F256445%22%20target%3D%22_blank%22%3E%40sanjay25%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EPlease%20verify%20that%20bit%2015%2C%20labeled%20%E2%80%9CDBGEN%2C%E2%80%9D%20in%20the%20Control%202%20Register%20is%20set%20to%201.%20This%20setting%20ensures%20that%20the%20PWM%20operates%20in%20debug%20mode.%20For%20more%20details%20about%20this%20bit%2C%20refer%20to%20section%2054.8.4%20of%20the%20RM.%3CBR%20%2F%3EAdditionally%2C%20there%20is%20an%20example%20that%20demonstrates%20PWM%20implementation%20using%20FlexPWM%20in%20Zephyr.%20The%20example%20is%20called%20%E2%80%9CPWM%20LED%E2%80%9D%20and%20can%20be%20found%20in%20the%20MCUXpresso%20extension%20for%20VS%20Code%2C%20which%20could%20be%20helpful.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Habib_MS_0-1762988466669.png%22%20style%3D%22width%3A%20554px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Habib_MS_0-1762988466669.png%22%20style%3D%22width%3A%20554px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F365356iB38D5D45CEBD1835%2Fimage-dimensions%2F554x334%3Fv%3Dv2%22%20width%3D%22554%22%20height%3D%22334%22%20role%3D%22button%22%20title%3D%22Habib_MS_0-1762988466669.png%22%20alt%3D%22Habib_MS_0-1762988466669.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EHabib_MS_0-1762988466669.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EBR%3CBR%20%2F%3EHabib%3C%2FP%3E%3C%2FLINGO-BODY%3E