MartyBrown
Member
Hello
for a project I need to generate two interleaved pwm signals with a deadtime of 2uS in between.
The frequency and duty cycle have to be adjustable at any moment.
the frequency's max value is about 100kHz
My Problem is, that i don't know how to initialize the timers and set the corresponding registers.
Perhaps anyone of you is a expert on this field and can help me out here
All my notes until now are these:
(I probably have to use FlexPWM2)
IO Muxing:
IOMUXC_FLEXPWM2_PWMA0_SELECT_INPUT = 0 => GPIO_EMC_06_ALT1 (Pin 4) => available pin on Teensy 4
IOMUXC_FLEXPWM2_PWMB0_SELECT_INPUT = 0 => GPIO_EMC_07_ALT1 (Pin 33) = available pin on Teensy 4
Clocking:
CCM_CCGR4_PWM2 (clock enable) ??? set to 1 ???
Clocksource:
FLEXPWM_SMCTRL2_CLK_SEL = 0; // 0=UPbus, extclock=1, aux_clk =2
Prescaler:
FLEXPWM_SMCTRL_PRSC;
FLEXPWM2_MCTRL2 => 0 = complementary Channels
Register Reloading:
CTRL[FULL] = every Cycle reload => used to get the ability to load new frequency and duty cycle values?
Definitions from the imxrt.h file:
(I don't know which register is for what... don't find clear information either in the reference manual)
#define FLEXPWM2_SM0CNT (IMXRT_FLEXPWM2.SM[0].CNT)
#define FLEXPWM2_SM0INIT (IMXRT_FLEXPWM2.SM[0].INIT)
#define FLEXPWM2_SM0CTRL2 (IMXRT_FLEXPWM2.SM[0].CTRL2)
#define FLEXPWM2_SM0CTRL (IMXRT_FLEXPWM2.SM[0].CTRL)
#define FLEXPWM2_SM0VAL0 (IMXRT_FLEXPWM2.SM[0].VAL0)
... and many more definitions of course ...
for a project I need to generate two interleaved pwm signals with a deadtime of 2uS in between.
The frequency and duty cycle have to be adjustable at any moment.
the frequency's max value is about 100kHz
My Problem is, that i don't know how to initialize the timers and set the corresponding registers.
Perhaps anyone of you is a expert on this field and can help me out here
All my notes until now are these:
(I probably have to use FlexPWM2)
IO Muxing:
IOMUXC_FLEXPWM2_PWMA0_SELECT_INPUT = 0 => GPIO_EMC_06_ALT1 (Pin 4) => available pin on Teensy 4
IOMUXC_FLEXPWM2_PWMB0_SELECT_INPUT = 0 => GPIO_EMC_07_ALT1 (Pin 33) = available pin on Teensy 4
Clocking:
CCM_CCGR4_PWM2 (clock enable) ??? set to 1 ???
Clocksource:
FLEXPWM_SMCTRL2_CLK_SEL = 0; // 0=UPbus, extclock=1, aux_clk =2
Prescaler:
FLEXPWM_SMCTRL_PRSC;
FLEXPWM2_MCTRL2 => 0 = complementary Channels
Register Reloading:
CTRL[FULL] = every Cycle reload => used to get the ability to load new frequency and duty cycle values?
Definitions from the imxrt.h file:
(I don't know which register is for what... don't find clear information either in the reference manual)
#define FLEXPWM2_SM0CNT (IMXRT_FLEXPWM2.SM[0].CNT)
#define FLEXPWM2_SM0INIT (IMXRT_FLEXPWM2.SM[0].INIT)
#define FLEXPWM2_SM0CTRL2 (IMXRT_FLEXPWM2.SM[0].CTRL2)
#define FLEXPWM2_SM0CTRL (IMXRT_FLEXPWM2.SM[0].CTRL)
#define FLEXPWM2_SM0VAL0 (IMXRT_FLEXPWM2.SM[0].VAL0)
... and many more definitions of course ...