MG32L003 Standard Peripherals Firmware Library
TIM1_PWM_ComDeadBreak example
  ****************** (C) COPYRIGHT 2023 megawin Technology *******************
  * @file    TIM/TIM1_PWM_ComDeadBreak/readme.txt 
  * @author  megawin Application Team
  * @version V0.0.5
  * @date    13-August-2024
  * @brief   Description of the GPIO TIM1_PWM_ComDeadBreak example.
  ******************************************************************************
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, MEGAWIN SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
  * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM
  * THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  ******************************************************************************
Example Description

This example describes how to use TIM1 complementary channel, dead zone insertion, and brake functions.

In this example, Main clock is configured at 24MHz.

TIM1_CH1 PD4 Output PWM waveform with frequency of 10KHz and duty cycle of 42%.
TIM1_CH1N PD5, as the complementary output channel of CH1, outputs PWM waveform with frequency of 10KHz and duty ratio of 58%.
The deadband insertion value is 11, the operating frequency of TIM1 is 24MHz, and the deadband insertion time is 458ns.
TIM1_BKIN PC5 as the input source of brake signal, the high level is effective, when the brake signal input is high, the PWM output
is suspended, PD4, PD5 keep the low level, and the output is resumed when the brake signal is low.

Directory contents
  • TIM/TIM1_PWM_ComDeadBreak/TIM1_PWM_ComDeadBreak.uvprojx MDK5 project file
  • TIM/TIM1_PWM_ComDeadBreak/TIM1_PWM_ComDeadBreak.uvoptx MDK5 project options file
  • TIM/TIM1_PWM_ComDeadBreak/JLinkSettings.ini link settings file
  • TIM/TIM1_PWM_ComDeadBreak/main.c Main program
Hardware and Software environment
  • Hardware environment
    • The chip pins are connected as follows:
      • TIM1_CH1 PD4 is connect to oscilloscope
      • TIM1_CH1N PD5 is connect to oscilloscope
      • TIM1_BKIN PC5 is Connect to brake signal input source
How to use it ?

In order to make the program work, you must do the following :

  • Open TIM1_PWM_ComDeadBreak.uvprojx from this example folder by Keil MDK5
  • Rebuild all files and load your image into target memory
  • Run the example

    © COPYRIGHT 2023 megawin Technology