MIMXRT1180 how to output a pwm signal on the pin M16 - GPIO_AD_27

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

MIMXRT1180 how to output a pwm signal on the pin M16 - GPIO_AD_27

2,289 Views
silvio-vallorani
Contributor III

Hi guys, 

I have a MIMXRT1189CVM8C.
I am not able to output a simple PWM signal from the pin M16 - GPIO_AD_27.

I have attached the screenshots of the MCUXpresso Config Tool which I set.

Can someone help me, please?

Tags (2)
0 Kudos
Reply
4 Replies

2,138 Views
silvio-vallorani
Contributor III

My new related question is about a function I need to implement, but I can't figure out how to do it cleanly and possibly totally in hardware.

I have a periodic square signal generated by my application.
I need to generate a new periodic square signal that is 8 time more fast and that perfectly sync with the signal above, every it's rise edge.

wavedrom.png

 

In the Reference Manual I saw this block diagram:

rm1.png

However, going into more detail about the behavior of PWM_EXT_SYNC I found this block diagram:

rm2.png


It seems that the PWM peripheral is unable to simultaneously generate the PWM signal and synchronize with the external signal, is this true?

Can you help me to find a good solution for my needs?

Thank you very much,

Silvio

0 Kudos
Reply

1,878 Views
mayliu1
NXP Employee
NXP Employee

Hi @silvio-vallorani ,

Thanks for your updated information.

Q: It seems that the PWM peripheral is unable to simultaneously generate the PWM signal and synchronize with the external signal, is this true?
 
A: The FlexPWM module on i.MX RT1180 can simultaneously generate PWM outputs and synchronize its counter to an external signal.

For more detailed information, I suggest you can refer to this Application Note : AN14196: Flex Pulse Width Modulator (FlexPWM) Usage on MCX N Series | NXP Semiconductors,

especially Section 3.2.2 “Counter Synchronization”, which describes how the FlexPWM counter can be synchronized across modules or via external sources.

mayliu1_0-1767758992316.png

 

Best Regards
MayLiu
0 Kudos
Reply

2,138 Views
silvio-vallorani
Contributor III

Thank you @mayliu1 for your reply. I found the problem, it was related to the "fault disable" signals. I tryed to disable the beahviour that involve faults, using the "MCUX Config Tool" is not possible: if I uncheck all the "fault disable" signals, the generated code totally remove the PWM_SetupFaultDisableMap() call and the "fault disable map" register stay to it's all enabled by default. I think this is a buggy beahviour of the tool, beacouse if I uncheck all the "fault disable" signals from the tool and then I manually add the PWM_SetupFaultDisableMap() call with "0" as the mask, I obtain the expected behaviour.
Anyway, on my code I finally leave enabled all the "fault disable" signals and I added XBAR signals to route "InputLogicHigh" on "Flexpwm2Faultx" signals and that's works fine.

Now I have a new question, but I ask it as a separate message below.

0 Kudos
Reply

2,219 Views
mayliu1
NXP Employee
NXP Employee

Hi @silvio-vallorani ,

Thank you so much for your interest in our products and for using our community.

I suggest you can refer to SDK demo "evkmimxrt1180_pwm_cm33".

1: Pin Configuration :

In MCUXpresso Config Tools, set pin M16 (GPIO_AD_27) to function as PWM2_B (submodule 1).

2: Add PWM Initialization Code

Follow the SDK demo for PWM setup. The demo project uses PWM1 submodule 0, submodule 1, and submodule 2 to generate waveforms.
You can adapt the same method for PWM2 Submodule 1.
 
Best Regards
MayLiu
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2270005%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMIMXRT1180%20how%20to%20output%20a%20pwm%20signal%20on%20the%20pin%20M16%20-%20GPIO_AD_27%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2270005%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20guys%2C%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20MIMXRT1189CVM8C.%3CBR%20%2F%3EI%20am%20not%20able%20to%20output%20a%20simple%20PWM%20signal%20from%20the%20pin%26nbsp%3BM16%20-%20GPIO_AD_27.%3C%2FP%3E%3CP%3EI%20have%20attached%20the%20screenshots%20of%20the%20MCUXpresso%20Config%20Tool%20which%20I%20set.%3CBR%20%2F%3E%3CBR%20%2F%3ECan%20someone%20help%20me%2C%20please%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2270387%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MIMXRT1180%20how%20to%20output%20a%20pwm%20signal%20on%20the%20pin%20M16%20-%20GPIO_AD_27%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2270387%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252871%22%20target%3D%22_blank%22%3E%40silvio-vallorani%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20so%20much%20for%20your%20interest%20in%20our%20products%20and%20for%20using%20our%20community.%3C%2FP%3E%0A%3CP%3EI%20suggest%20you%20can%20refer%20to%20SDK%20demo%20%22evkmimxrt1180_pwm_cm33%22.%3C%2FP%3E%0A%3CP%3E1%3A%20Pin%20Configuration%20%3A%3C%2FP%3E%0A%3CP%3EIn%20MCUXpresso%20Config%20Tools%2C%20set%20pin%20M16%20(GPIO_AD_27)%20to%20function%20as%20PWM2_B%20(submodule%201).%3C%2FP%3E%0A%3CP%3E2%3A%20Add%20PWM%20Initialization%20Code%3C%2FP%3E%0A%3CDIV%3EFollow%20the%20SDK%20demo%20for%20PWM%20setup.%20The%20demo%20project%20uses%20PWM1%20submodule%200%2C%20submodule%201%2C%20and%20submodule%202%20to%20generate%20waveforms.%3CBR%20%2F%3EYou%20can%20adapt%20the%20same%20method%20for%20PWM2%20Submodule%201.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EBest%20Regards%3C%2FDIV%3E%0A%3CDIV%3EMayLiu%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2270672%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MIMXRT1180%20how%20to%20output%20a%20pwm%20signal%20on%20the%20pin%20M16%20-%20GPIO_AD_27%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2270672%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EMy%20new%20related%20question%20is%20about%20a%20function%20I%20need%20to%20implement%2C%20but%20I%20can't%20figure%20out%20how%20to%20do%20it%20cleanly%20and%20possibly%20totally%20in%20hardware.%3C%2FP%3E%3CP%3EI%20have%20a%20periodic%20square%20signal%20generated%20by%20my%20application.%3CBR%20%2F%3EI%20need%20to%20generate%20a%20new%20periodic%20square%20signal%20that%20is%208%20time%20more%20fast%20and%20that%20perfectly%20sync%20with%20the%20signal%20above%2C%20every%20it's%20rise%20edge.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22wavedrom.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wavedrom.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wavedrom.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22wavedrom.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F371604i808820953C200D1B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22wavedrom.png%22%20alt%3D%22wavedrom.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIn%20the%20Reference%20Manual%20I%20saw%20this%20block%20diagram%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22rm1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rm1.png%22%20style%3D%22width%3A%20856px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rm1.png%22%20style%3D%22width%3A%20856px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rm1.png%22%20style%3D%22width%3A%20856px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F371605i801F2BCE21E76ED2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22rm1.png%22%20alt%3D%22rm1.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHowever%2C%20going%20into%20more%20detail%20about%20the%20behavior%20of%20PWM_EXT_SYNC%20I%20found%20this%20block%20diagram%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22rm2.png%22%20style%3D%22width%3A%20859px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rm2.png%22%20style%3D%22width%3A%20859px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rm2.png%22%20style%3D%22width%3A%20859px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22rm2.png%22%20style%3D%22width%3A%20859px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F371606i03F41AD9FD08FB31%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22rm2.png%22%20alt%3D%22rm2.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIt%20seems%20that%20the%20PWM%20peripheral%20is%20unable%20to%20simultaneously%20generate%20the%20PWM%20signal%20and%20synchronize%20with%20the%20external%20signal%2C%20is%20this%20true%3F%3C%2FP%3E%3CP%3ECan%20you%20help%20me%20to%20find%20a%20good%20solution%20for%20my%20needs%3F%3C%2FP%3E%3CP%3EThank%20you%20very%20much%2C%3C%2FP%3E%3CP%3ESilvio%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2270662%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MIMXRT1180%20how%20to%20output%20a%20pwm%20signal%20on%20the%20pin%20M16%20-%20GPIO_AD_27%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2270662%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EThank%20you%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239163%22%20target%3D%22_blank%22%3E%40mayliu1%3C%2FA%3E%20for%20your%20reply.%20I%20found%20the%20problem%2C%20it%20was%20related%20to%20the%20%22fault%20disable%22%20signals.%20I%20tryed%20to%20disable%20the%20beahviour%20that%20involve%20faults%2C%20using%20the%20%22MCUX%20Config%20Tool%22%20is%20not%20possible%3A%20if%20I%20uncheck%20all%20the%20%22fault%20disable%22%20signals%2C%20the%20generated%20code%20totally%20remove%20the%20PWM_SetupFaultDisableMap()%20call%20and%20the%20%22fault%20disable%20map%22%20register%20stay%20to%20it's%20all%20enabled%20by%20default.%20I%20think%20this%20is%20a%20buggy%20beahviour%20of%20the%20tool%2C%20beacouse%20if%20I%20uncheck%20all%20the%26nbsp%3B%22fault%20disable%22%20signals%20from%20the%20tool%20and%20then%20I%20manually%20add%20the%20PWM_SetupFaultDisableMap()%20call%20with%20%220%22%20as%20the%20mask%2C%20I%20obtain%20the%20expected%20behaviour.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EAnyway%2C%20on%20my%20code%20I%20finally%20leave%20enabled%20all%20the%26nbsp%3B%22fault%20disable%22%20signals%20and%20I%20added%26nbsp%3BXBAR%20signals%20to%20route%20%22InputLogicHigh%22%20on%20%22Flexpwm2Faultx%22%20signals%20and%20that's%20works%20fine.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ENow%20I%20have%20a%20new%20question%2C%20but%20I%20ask%20it%20as%20a%20separate%20message%20below.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2289090%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MIMXRT1180%20how%20to%20output%20a%20pwm%20signal%20on%20the%20pin%20M16%20-%20GPIO_AD_27%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2289090%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252871%22%20target%3D%22_blank%22%3E%40silvio-vallorani%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThanks%20for%20your%20updated%20information.%3C%2FP%3E%0A%3CDIV%3EQ%3A%20It%20seems%20that%20the%20PWM%20peripheral%20is%20unable%20to%20simultaneously%20generate%20the%20PWM%20signal%20and%20synchronize%20with%20the%20external%20signal%2C%20is%20this%20true%3F%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EA%3A%20%3CSPAN%3EThe%20FlexPWM%20module%20on%20i.MX%20RT1180%20can%20simultaneously%20generate%20PWM%20outputs%20and%20synchronize%20its%20counter%20to%20an%20external%20signal.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%0A%3CP%3EFor%20more%20detailed%20information%2C%20I%20suggest%20you%20can%20refer%20to%20this%20Application%20Note%20%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.nxp.com%2Fbundle%2FAN14196%2Fpage%2Ftopics%2Fcounter_synchronization.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EAN14196%3A%20Flex%20Pulse%20Width%20Modulator%20(FlexPWM)%20Usage%20on%20MCX%20N%20Series%20%7C%20NXP%20Semiconductors%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3Eespecially%20Section%203.2.2%20%E2%80%9CCounter%20Synchronization%E2%80%9D%2C%20which%20describes%20how%20the%20FlexPWM%20counter%20can%20be%20synchronized%20across%20modules%20or%20via%20external%20sources.%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mayliu1_0-1767758992316.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22mayliu1_0-1767758992316.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F371919i53DAB8BB72F723D8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22mayliu1_0-1767758992316.png%22%20alt%3D%22mayliu1_0-1767758992316.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%0A%3CBR%20%2F%3E%0A%3C%2FDIV%3E%0A%3CDIV%3EBest%20Regards%3C%2FDIV%3E%0A%3CDIV%3EMayLiu%3C%2FDIV%3E%3C%2FLINGO-BODY%3E