cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

New Contributor II

Hi,

I'm using CYBLE-416045-02 mcu and want to change PWM Alignment during run time.

Please Help.

Thanks

0 Likes
Reply
1 Solution
Honored Contributor

AyKo,

If you allocated the PWM at the HAL-level, then you can make a call to cyhal_pwm_init_adv() (Hardware Abstraction Layer (HAL) )  In this call, there is a parameter for alignment.

You will probably have to perform a cyhal_pwm_free() first to have the halmgr free up the resources on the previously allocated PWM resource.

If you allocated the PWM at the PDL-level, I believe you need to perform the following steps:

  1. Cy_TCPWM_PWM_Disable();
  2. Cy_TCPWM_PWM_DeInit();
  3. change the .pwmAlignment varaible in the cy_stc_tcpwm_pwm_config_t  to the alignment type you want.
  4. Cy_TCPWM_PWM_Init();
  5. Cy_TCPWM_PWM_Enable();

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
Reply
1 Reply
Honored Contributor

AyKo,

If you allocated the PWM at the HAL-level, then you can make a call to cyhal_pwm_init_adv() (Hardware Abstraction Layer (HAL) )  In this call, there is a parameter for alignment.

You will probably have to perform a cyhal_pwm_free() first to have the halmgr free up the resources on the previously allocated PWM resource.

If you allocated the PWM at the PDL-level, I believe you need to perform the following steps:

  1. Cy_TCPWM_PWM_Disable();
  2. Cy_TCPWM_PWM_DeInit();
  3. change the .pwmAlignment varaible in the cy_stc_tcpwm_pwm_config_t  to the alignment type you want.
  4. Cy_TCPWM_PWM_Init();
  5. Cy_TCPWM_PWM_Enable();

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
Reply
Top labels