PWM: Overview

Modbus RTU XMC47

PWM
Overview

Overview

The PWM APP provides the following functionalities using CCU4 or CCU8 peripheral:

  1. It allows to enter the desired PWM frequency and the duty cycle.
  2. The APP tries to get the best PWM resolution (timer tick). It calculates Timer Tick, Period Value (PV) and Compare Value (CV). Note: The desired values may not be exactly possible. The timer is always used in 16bit mode with prescalar.
  3. PWM can be started after initialization or at a later time as required by calling the API PWM_Start()
  4. PWM can operate in single shot mode or continuous mode.
  5. Allows generation of period match or compare match events for interrupt generation (to be connected to an INTERRUPT APP).
  6. Connects the PWM output to a GPIO (open drain, push/pull) or to other peripherals via interconnect (timer status flag/ period match event / compare match event)
Figure 1 : Overview of PWM APP

Figure 1, shows the functional overview of the PWM APP. The CCU peripheral starts a internal counter which counts the clock pulses provided by the prescalar. When the count reaches the compare match value, the PWM output state will change from passive state (either a high state or low state) to active state(either a low state or high state). The timer will still continue to count even after the compare match event has occurred. When the count value reaches the Period match value, the PWM output state is returned to the passive state. Thus completing one cycle of the PWM. If Single-Shot mode is not selected, then this cycle would repeat continuously. If Single-Shot mode is selected, then the PWM will remain in the passive state and the timer will stop running.
Period match(PM) value is calculated based on the frequency and Compare match is calculated based on duty cycle. The PWM output state changes at period and compare match.

Figure 2 : Hardware and Software connectivity of PWM APP

Figure 2 shows how the APP is structured in DAVEā„¢. XMC controllers provide the CCU4 or CCU8 module to generate the PWM waveforms. The LLD layer provides abstraction for these hardware modules. The PWM APP uses CCU4 or CCU8, SCU and GPIO LLDs and other dependent APPS like GLOBAL_CCUx (x =4, 8) and CLOCK_XMCx (x =4, 1) for the functionality.

Limitations

  • This APP does not support coherent update of multiple channels (i.e. multiple instances of the APP). For this purpose, please use the functions available in CCU4/8 LLD.
  • Currently, in the PWM APP, API: PWM_SetFreq allows the user to set frequency for the appropriate prescaler value to be used. However, PSIV value is updated immediately and not during period match. Due to this, if the frequency requires the prescaler to be changed, there is a cycle (1 pulse) where the on/off time is different.
    Figure 3 : Limitation of the PWM APP

Supported Devices
The APP supports below devices:

  1. XMC4800 / XMC4700 Series
  2. XMC4500 Series
  3. XMC4400 Series
  4. XMC4200 / XMC4100 Series
  5. XMC1400 Series
  6. XMC1300 Series
  7. XMC1200 Series
  8. XMC1100 Series

Reference

  1. XMC4800 / XMC4700 Reference Manual
  2. XMC4500 Reference Manual
  3. XMC4400 Reference Manual
  4. XMC4200 / XMC4100 Reference Manual
  5. XMC1400 Reference Manual
  6. XMC1300 Reference Manual
  7. XMC1200 Reference Manual
  8. XMC1100 Reference Manual