AnsweredAssumed Answered

iMXRT1064 PWM

Question asked by Anuj Tanksali on Jan 13, 2020
Latest reply on Jan 31, 2020 by Felipe García

Hello,

 

I am using iMXRT1064 device and wanted to configure PWM on GPIO_SD_B0_00 pin.

I configured GPIO_SD_B0_00 to use using MCU config tools as below,

 

routed: J4

Peripheral: PWM1

Signal: A,0

Routeto : GPIO_SD_B0_00

 

but how to configure the PWM properties such as frequency, duty cycle in code.

I referred the demo code evkmimxrt1064_pwm but not able to figure out what parameters to use for above pin.

 

I configured the parameters in code such as 

 

PWM_GetDefaultConfig(&pwmConfig);

/* Use full cycle reload */
pwmConfig.reloadLogic = kPWM_ReloadPwmFullCycle;
/* PWM A & PWM B form a complementary PWM pair */
pwmConfig.pairOperation = kPWM_Independent;
pwmConfig.enableDebugMode = true;

/* Initialize submodule 0 */
if (PWM_Init(BOARD_PWM_BASEADDR, kPWM_Module_0, &pwmConfig) == kStatus_Fail)
{
PRINTF("PWM initialization failed\n");
return 1;
}

 

Then,

 

pwmSignal[0].pwmChannel = kPWM_PwmA;
pwmSignal[0].level = kPWM_HighTrue;
pwmSignal[0].dutyCyclePercent = 50; /* 1 percent dutycycle */
pwmSignal[0].deadtimeValue = deadTimeVal;

 

PWM_SetupPwm(BOARD_PWM_BASEADDR, kPWM_Module_0, pwmSignal, 1, kPWM_SignedCenterAligned, pwmFrequencyInHz,
pwmSourceClockInHz);

 

 

/* Set the load okay bit for all submodules to load registers from their buffer */
PWM_SetPwmLdok(BOARD_PWM_BASEADDR, kPWM_Control_Module_0, true);

/* Start the PWM generation from Submodules 0 */
PWM_StartTimer(BOARD_PWM_BASEADDR, kPWM_Control_Module_0);

 

But do not see any output. My pwm signal is connected to LCD display.

 

I want to generate any frequency with 50% duty cycle on the pin GPIO_SD_B0_00.

 

Can you please help me out regarding this?

 

Thanks

 

Regards,

 

Anuj 

Outcomes