Problem porting tpm_simple_pwm.c functionality over to my application

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

Problem porting tpm_simple_pwm.c functionality over to my application

Jump to solution
411 Views
smachin_kinematics
Contributor I

Hi All,

I am using an FRMD-K32L2B3 board and the latest MCUXpresso IDE v11.6.0 [Build 8187] [2022-07-13] IDE.

I have a fairly simple C based application I've developed using the UARTs and some GPIO on that board, it works fine.  However I wanted to add PWM output to one of the GPIOs.  The sample project tpm_simple_pwm.c works fine and generates the expected PWM output signal on the green LED output on the board.  When I try to cut and paste that exact file into my custom project and run it, I get no PWM output on the pin however, just a constant voltage of about 1.5V.

Are there any additional settings I should be carrying over from the tpm_simple_pwc project into my custom project to get PWM output working?

Also if it has any effect, in my custom project I had to change a few symbol defines to get floating point printf working, the full set of defined symbols in my custom project is:

-std=gnu99 -D__REDLIB__ -DPRINTF_ADVANCED_ENABLE=1 -DCPU_K32L2B31VLH0A -DCPU_K32L2B31VLH0A_cm0plus -DFRDM_K32L2B -DFREEDOM -DMCUXPRESSO_SDK -DSDK_DEBUGCONSOLE=1 -DPRINTF_FLOAT_ENABLE=1 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -I"C:\project\source" -I"C:\project\utilities" -I"C:\project\drivers" -I"C:\project\device" -I"C:\project\component\uart" -I"C:\project\component\lists" -I"C:\project\CMSIS" -I"C:\project\board" -I"C:\project\frdmk32l2b\driver_examples\gpio\led_output" -O0 -fno-common -g3 -c -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -fmerge-constants -fmacro-prefix-map="$(<D)/"= -mcpu=cortex-m0plus -mthumb -D__REDLIB__ -fstack-usage -specs=redlib.specs

Labels (1)
Tags (1)
0 Kudos
1 Solution
398 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi smachin_kinematics,

Can you tell me which pin you need to output the PWM waveform on?
Besides tpm_simple_pwm.c, you may also need pin_mux.c.h and clock_config.c.h generated by Pins Tool and Clocks Tool

pin_mux and clock_config.pngPins Tool.png

If you use your MCUXpresso Config Tools in your project, then no need to copy them.


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
399 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi smachin_kinematics,

Can you tell me which pin you need to output the PWM waveform on?
Besides tpm_simple_pwm.c, you may also need pin_mux.c.h and clock_config.c.h generated by Pins Tool and Clocks Tool

pin_mux and clock_config.pngPins Tool.png

If you use your MCUXpresso Config Tools in your project, then no need to copy them.


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos