Skip to main content
Explorer
August 2, 2024
Solved

PWM on STM32U599

  • August 2, 2024
  • 1 reply
  • 834 views

Dear All,

I am attempting to migrate a project from a STM32F74NGH MCU to a STM32U599NJH MCU.

In the F7 MCU I am applying the PWM on CH1 of TIM3 that corresponds to pin PB4.
On the new setup I need to apply the PWM to pin PC5, which corresponds to TIM1, CH4N.

I am a bit confused on what exactly does the N mean in CH4N. So far I have not been able to drive my device as expected using the PWM. If I set PC5 to output and set it properly then my external device is operating as expecting for a 100% dutycycle.

In my old project the Internal Clock was set to 200MHz and this is the configuration of timer 3:

G_Anastasopoulos_0-1722607604849.png

G_Anastasopoulos_1-1722607624978.png

Initing PWM is done like this:

 

HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);

 

Changing the dutycycle:

 

__HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_1, value);

 

where the value is between 0 and 100.


In my new project the clock is running at 160MHz.

My CubeMX configuration looks like this:

G_Anastasopoulos_2-1722608382008.png

 

G_Anastasopoulos_3-1722608787175.png

The rest for now remains the same except that I am using TIM1 and TIM_CHANNEL_4 for init an changing the dutycycle, but I do not see any response from the device.

Thank you very much for any ideas or assistance



    This topic has been closed for replies.
    Best answer by TDK

    To start channel 4N, you use HAL_TIMEx_PWMN_Start.

    Channel 4N is usually the reverse polarity of channel 4, but the details are more complicated.

    1 reply

    TDKAnswer
    Super User
    August 2, 2024

    To start channel 4N, you use HAL_TIMEx_PWMN_Start.

    Channel 4N is usually the reverse polarity of channel 4, but the details are more complicated.