Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
PWMA Example 2 for UC3L-EK Documentation

Introduction

This is the documentation for the data structures, functions, variables, defines, enums, and typedefs for the PWMA driver.
It also gives an example of the usage of the PWMA module.
This example will generate peripheral event from Analog Comparator(ACIFB). When positive input(Vinp) of ACIFB is greater than the negative input(Vinn), the event will be generated from ACIFB and the duty cycle value of PWMA will be increased by one. When negative input(Vinn) of ACIFB is greater than the positive input(Vinn), the event will be generated from ACIFB and the duty cycle value of PWMA will be increased by one. The event_count variable will keep track of the number of positive/negative event by generating the interrupt from ACIFB for each comparison. In the ISR, the duty cycle value and the event_count values will be reset to either zero [or] TOP value accordingly.

The output PWMA frequency configured in this example is 1MHz and the SPREAD is loaded with the value of 0. Initially the duty cycle value will be loaded with 0. By giving Vinp > Vinn [or] Vinn>Vinp in ACIFB , the output frequency of 1MHz with duty cycle value varying from 0 to TOP value can be seen on the Oscilloscope. Once the duty cycle reaches the TOP value, the duty cycle value will be loaded with 0 and starts again. Once it reaches zero, it will be loaded with TOP value and starts again.

Main files

References

  • Respective device datasheet
  • Respective Board Schematics
  • Schematics of the respective Routing card {for STK600 Board)

Compiler Support

This example application supports

  • GNU GCC for AVR32
  • IAR EWAVR32 for UC3L064 device

Device support

  • AT32UC3L0 Series
  • ATUC[64/128/256]L3/L4 devices

Test Information

This example has been tested with the following boards:

  • UC3L-EK evaluation kit with an AT32UC3L064 MCU.
  • UC3L0-Xplained kit with an AT32UC3L064 MCU.
  • STK600 + RCUC3L0 routing card with an AT32UC3L0256 MCU.
  • STK600 + RCUC3L3U routing card with an ATUC256L3U MCU.

Hardware Setup Information

  • CPU Clock Source : DFLL(48MHz) with internal RCSYS as source
  • CPU Speed : 12MHz
  • PBA Speed : 12MHz
  • PBB Speed : 12MHz
  • PWMA_GCLK Source : PBA Clock
  • PWMA_GCLK Speed : 12MHz
  • ACIFB_GCLK Speed : 10KHz

Hardware Setup Information

In UC3L0-XPLAINED KIT:

  • PWMA Channel used : channel 11
  • ACIFB Channel used : channel 4
  • ACIFB Input Voltage pins:
    -------------------------—
    | Input pin | Pin on Board |
    -------------------------—
    | Vinp(PB00) | J4.Pin5 |
    | Vinn(PB02) | J4.Pin7 |
    -------------------------—
  • The output can be measured with Oscilloscope as given below:
    -----------------------------------------------------------—
    PWMA Channel | LED on Board | OUTPUT pins on Board
    -----------------------------------------------------------—
    channel 11(PA11) | LED0 | Pin 8(PWMA7) of Header J3
    -----------------------------------------------------------—
  • The LED2(LED_RED) will be turned on in case of any failure in the PWMA configuration.

In UC3L-EK KIT:

  • PWMA Channel used : channel 9
  • ACIFB Channel used : channel 3
  • ACIFB Input Voltage pins:
    --------------------------—
    | Input pin | Pin on Board |
    --------------------------—
    | Vinp(PA04) | J14.Pin 9 |
    | Vinn(PB09) | J15.Pin 14 |
    --------------------------—
  • The output can be measured with Oscilloscope as given below:
    -------------------------------—
    PWMA Channel | OUTPUT pin
    -------------------------------—
    channel 11 (PA11) | J14.Pin 4
    -------------------------------—
  • The LED2 will be turned on in case of any failure in the PWMA configuration.

For STK600 + RCUC3L0 routing card with an AT32UC3L0256 MCU:

  • PWMA Channel used : channel 11
  • ACIFB Channel used : channel 4
  • ACIFB Input Voltage pins:
    ------------------------—
    | Input pin | In STK600 |
    ------------------------—
    | Vinp(PB00) | PortD.PD0 |
    | Vinn(PB02) | PortD.PD2 |
    ------------------------—
  • The output can be measured with Oscilloscope as given below:
    -------------------------------—
    PWMA Channel | In STK600
    -------------------------------—
    channel 11 (PA11) | PortB.PB3
    -------------------------------—
  • The port PA08 (portB.PB0 in STK600) can be connected to any of the LEDs on the board. This will be turned on in case of any failure in the PWMA configuration.

For STK600 + RCUC3L3U routing card with an ATUC256L3U MCU:

  • PWMA Channel used : channel 11
  • ACIFB Channel used : channel 4
  • ACIFB Input Voltage pins:
    ------------------------—
    | Input pin | In STK600 |
    ------------------------—
    | Vinp(PB00) | PortD.PD0 |
    | Vinn(PB02) | PortD.PD2 |
    ------------------------—
  • The output can be measured with Oscilloscope as given below:
    -------------------------------—
    PWMA Channel | In STK600
    -------------------------------—
    channel 11 (PA11) | PortB.PB3
    -------------------------------—
  • The port PA08 (portB.PB0 in STK600) can be connected to any of the LEDs on the board. This will be turned on in case of any failure in the PWMA configuration.

Contact Information

For further information, visit : Atmel AVR32 .
Technical support & faq, visit : Support and FAQ .

Author
Microchip Technology Inc : http://www.microchip.com