PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
PDL for FM4 - Documentation

Spansion_logo.png

Copyright (C) 2014 Spansion LLC. All Rights Reserved.

This software is owned and published by: Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").

BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.

This software contains source code for use with Spansion components. This software is licensed by Spansion to be adapted only for use in systems utilizing Spansion components. Spansion shall not be responsible for misuse or illegal use of this software for devices not supported herein. Spansion is providing this software "AS IS" and will not be responsible for issues arising from incorrect user implementation of the software.

SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE, REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS), ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED WARRANTY OF NONINFRINGEMENT. SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT, NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA, SAVINGS OR PROFITS, EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED FROM, THE SOFTWARE.

This software may be replicated in part or whole for the licensed use, with the restriction that this Disclaimer and Copyright notice must be included with each copy of this software, whether used in part or whole, at all times.



History

  • 2013-07-01
    • Version 0.0.1
    • Author: FSL, FLSA, FSEU
    • Comment: First alpha release version
  • 2013-09-01
    • Version 0.0.2
    • Author: FSL, FLSA, FSEU
    • Comment: Beta-one release version
  • 2013-10-31
    • Version 1.0
    • Author: Spansion Inc., Japan, China, Europe
    • Comment: Version 1.0 release
  • 2014-05-27
    • Version 1.2
    • Author: Spansion Inc., Japan, China, Europe
    • Comment: Version 1.2 release
    • Enhancements:
    • Bug fixes:
      • extint.c: Channel enable bug in Exint_Init() fixed.
      • system_mb9abxxx.h: CHECK_RSVD() macro fixed for HS-CR PLL usage.
      • USB general: IRQ naming, mcu headerfile typedef fixes; IRQ double definition with use of PDL > V1.0 solved
      • USB host: Speedup in package handling; fixes in fifo initialization ISO transfers added; Fixes in some variable initializations in disconnect routine; PUSBHOST_CONNECTION_DELAY to specify a delay in interations added for bus-reset/connection delay

Implementations in PDL:

ADC  Analog Digital Cionverter
BT  Base Time
CAN  Controller Area Network
CLK  Clock Module
CRC  Cyclic Redundancy Check
CR  High-CR trimming
CSV  Clock supervisor
DAC  Digital Analog Converter
DMA  Direc Memory Access
DT  Dual Timer
DTSC  Descriptor System data Transfer Controller
EXINT  External Interrupt
EXTIF  External Bus Inerface
Flash  Main/Work Flash operation
GPIO  General Purpose Inoput/Output Ports (only header file)
LPM  Low Power Modes
LVD  Low Voltage Detection
MFS  Multi Function Serial Interface
MFT  Multi Function Timer
PPG  Programmable Pulse Generator
QPRC  Quad Decoder and Position/Revolution Counter
RESET  Reset Cause Register
RTC  Real Time Clock
SDIF  SD Card Interface
UID  Unique ID
USB  Universal Serial Bus
WC  Watch Counter
WDG  Watch Dog Timer (Hardware/Software)

USB Middleware:

USB Device   CDC Com - Virtual Com Port
USB Device   HID Com - Data Communicaton
USB Device   HID Joystick
USB Device   HID Keyboard
USB Device   HID Mouse
USB Device   LibUSB
USB Device   Printer Class
USB Host   HID Com - Data Communicaton
USB Host   HID Keyboard
USB Host   HID Mouse
USB Host   Mass Storage

Examples:

  • ADC
    • adc_scan_irq_bt       ADC scan sample with interrupt mode triggered by base timer
    • adc_scan_dma          Usage of ADC together with DMA in demand transfer mode
    • adc_scan_irq_sw       ADC scan conversion with usage of interrupt callback triggered by software
    • adc_scan_irq_mft      ADC scan conversion with usage of interrupt callback triggered by MFT
    • adc_scan_polling_sw   ADC scan conversion with polling for finished conversion triggered by software
    • adc_prio_irq_sw       ADC priority conversion with usage of interrupt callback triggered by software
    • adc_prio_polling_sw   ADC priority conversion with polling for finished conversion triggered by software
  • BT
    • bt_iomode             Base Timer IO modes demonstration
    • bt_ppg                Base Timer configured as Programmable Pulse Generator
    • bt_pwc                Base Timer configured as Pulse Width Counter
    • bt_pwm                Base Timer configured as Pulse With Modulator
    • bt_rt                 Base Timer configured as Reload Timer
  • CAN
    • can_simple       CAN communication with CANoe
  • CLK
    • clk_gating       Clock gating setting
    • clk_init         User clock initialization
  • CR
    • cr_trimming      CR trimming procedure demonstration
  • CRC
    • crc_16_32        Calculation of CRC-16 and CRC-32
  • CSV
    • csv_reset        CSV reset demonstration when main/sub clock frequency is abnormal
    • fcs_int          FCS interrupt demonstration when main clock frequency is abnormal
    • fcs_reset        CSV reset demonstration when main clock frequency is abnormal
  • DAC
    • dac_sine_wave    DAC channels generate sine wave tones
  • DMA
    • dma_software     The DMA perform a sotware block transfer (For demand transfer see ADC)
  • DSTC
    • dstc_hw_transfer DSTC triggered by peripheral (BT0)
    • dstc_sw_transfer DSTC software transfer
  • DT
    • dt_unuse_int     Dual Timer configured as periodic mode for ch.0 and one-shot mode for ch.1 with usage interruption callback
    • dt_use_int       Dual Timer configured as periodic mode for ch.0 and one-shot mode for ch.1 with polling for interruption
  • DSTC
    • sw_transfer      Perform DSTC transfer by software trigger
    • hw_transfer      Perform DSTC transfer by hardware trigger
  • EXINT
    • exint_simple     Simple external interrupt occurence demonstration
  • EXTIF   (no example)
  • Flash
    • main_flash_test  Main Flash operation test
    • work_flash_test  Work Flash operation test
  • GPIO
    • gpio_parameterized_ports  New macros with aibility of port parameterization
    • gpio_ports                Simple Port setting and Port read-out
  • LPM
    • lpm_bu_reg       Reading and writing to Backup Registers
    • lpm_sleep_stop   MCU is set to sleep and stop mode, EXINT0 wakes up MCU
  • LVD
    • lvd_unuse_int_27  LVD interrupts when voltage is vicinity of 2.7 volts. Interruption detection uses polling
    • lvd_unuse_int_28  LVD interrupts when voltage is vicinity of 2.8 volts. Interruption detection uses polling
    • lvd_unuse_int_30  LVD interrupts when voltage is vicinity of 3.0 volts. Interruption detection uses polling
    • lvd_use_int_26    LVD interrupts when voltage is vicinity of 2.6 volts. Interruption detection uses callback
    • lvd_use_int_28    LVD interrupts when voltage is vicinity of 2.8 volts. Interruption detection uses callback
    • lvd_use_int_32    LVD interrupts when voltage is vicinity of 3.2 volts. Interruption detection uses callback
  • MFS
    • High Level   The samples used High Level MFS driver.
      • CSIO
        • mfs_csio_normal_master_unuse_int           MFS performs as CSIO master mode by unusing interruption
        • mfs_csio_normal_master_unuse_int_with_tmr  MFS performs as CSIO master mode by unusing interruption and using timer mode
        • mfs_csio_normal_master_use_int             MFS performs as CSIO master mode by using interruption
        • mfs_csio_normal_master_use_int_with_tmr    MFS performs as CSIO master mode by using interruption and using timer mode
        • mfs_csio_normal_slave_use_int              MFS performs as CSIO slave mode by using interruption
        • mfs_csio_spi_master_unuse_int              MFS performs as SPI master mode by unusing interruption and controling CS by GPIO
        • mfs_csio_spi_master_unuse_int_with_cs      MFS performs as SPI master mode by unusing interruption and controling CS by peripheral
        • mfs_csio_spi_master_use_int                MFS performs as SPI master mode by using interruption and controling CS by GPIO
        • mfs_csio_spi_master_use_int_with_cs        MFS performs as SPI master mode by using interruption and controling CS by peripheral
        • mfs_csio_spi_slave_use_int                 MFS performs as SPI slave mode by using interruption and unusing CS peripheral
        • mfs_csio_spi_slave_use_int_with_cs         MFS performs as SPI slave mode by using interruption and using CS peripheral
      • LIN
        • mfs_lin                                    MFS performs as LIN master and slave mode communicating on same MCU
      • UART
        • mfs_uart_unuse_int                         MFS performs as UART normal mode by unusing interruption
        • mfs_uart_use_int                           MFS performs as UART normal mode by using interruption
    • Low Level   The samples used Low Level MFS driver.
      • CSIO
        • mfs_csio_normal_master_unuse_int           MFS performs as CSIO master mode by unusing interruption
        • mfs_csio_normal_master_unuse_int_with_tmr  MFS performs as CSIO master mode by unusing interruption and using timer mode
        • mfs_csio_normal_master_use_int             MFS performs as CSIO master mode by using interruption
        • mfs_csio_normal_master_use_int_with_tmr    MFS performs as CSIO master mode by using interruption and using timer mode
        • mfs_csio_normal_slave_use_int              MFS performs as CSIO slave mode by using interruption
        • mfs_csio_spi_master_unuse_int              MFS performs as SPI master mode by unusing interruption and controling CS by GPIO
        • mfs_csio_spi_master_unuse_int_with_cs      MFS performs as SPI master mode by unusing interruption and controling CS by peripheral
        • mfs_csio_spi_master_use_int                MFS performs as SPI master mode by using interruption and controling CS by GPIO
        • mfs_csio_spi_master_use_int_with_cs        MFS performs as SPI master mode by using interruption and controling CS by peripheral
        • mfs_csio_spi_slave_use_int                 MFS performs as SPI slave mode by using interruption and unusing CS peripheral
        • mfs_csio_spi_slave_use_int_with_cs         MFS performs as SPI slave mode by using interruption and using CS peripheral
      • LIN
        • mfs_lin                                    MFS performs as LIN master and slave mode communicating on same MCU
      • UART
        • mfs_uart_unuse_int                         MFS performs as UART normal mode by unusing interruption
        • mfs_uart_use_int                           MFS performs as UART normal mode by using interruption
  • MFT
    • FRT
      • frt_int                  Free-run Timer function with usage of zero/peak match interrupt callback
      • frt_polling              Free-run Timer function with polling for zero/peak match
    • ICU
      • icu_int                  Input Captuer Unit function with usage of interrupt callback
      • icu_polling              Input Captuer Unit function with polling for capture completion
    • OCU
      • ocu_ch_linked            Perform 2 change linked mode of Output Compare Unit
      • ocu_ch_single            Perform 1-change/low-active/high-active mode of Output Compare Unit
    • WFG
      • wfg_nzcl_dtif_dttix_trig Perform DTIF interrupt triggered DTTIX
      • wfg_nzcl_dtif_sw_trig    Perform DTIF interrupt triggered software
      • wfg_ppg_dead_timer_mode  Perform PPG-dead timer mode of Waveform Generator Unit
      • wfg_rt_dead_timer_mode   Perform RT-dead timer mode of Waveform Generator Unit
      • wfg_rt_ppg_mode          Perform RT-PPG mode of Waveform Generator Unit
      • wfg_through_mode         Perform through mode of Waveform Generator Unit
      • wfg_timer_ppg_mode       Perform Timer-PPG mode of Waveform Generator Unit
  • QPRC
    • qprc_pc_directional        Perform Count mode with direction (mode 3) of Position Counter
    • qprc_pc_updown             Perform Up/down count mode (mode 1) of Position Counter
    • qprc_pc_phase_diff         Perform Phase different count mode (mode 2) of Position Counter
    • qprc_rc_pc_ofuf_trig       Perform Revolution Counter mode 2 (triggered by Position Counter)
    • qprc_rc_zin_pcofuf_trig    Perform Revolution Counter mode 3 (triggered by ZIN or Position Counter)
    • qprc_rc_zin_trig           Perform Revolution Counter mode 1 (triggered by ZIN)
  • RTC
    • rtc_time_count             Usage of time counting and alarm interruption for RTC
    • rtc_timer_interval         Usage of time counting and timer interval mode for RTC
    • rtc_timer_oneshot          Usage of time counting and timer one shot mode for RTC
  • SD
    • sd_sector_wr      Write/read to/from a sector of SD card via SD I/F
  • UID
    • uid_read          Several methods to read the Unique ID
  • USB
    • sbdevice_cdc_virtual com port           MCU acting as virtual COM port using Communications Device Class
    • sbdevice_hid_data_cdc_virtual_com_port  MCU acting as composition device with HID and CDC
    • sbdevice_hid_data_communication         Data communication using HID class
    • sbdevice_hid_joystick                   MCU acting as a joystick
    • sbdevice_hid_keyboard                   MCU acting as a keyboard (writing a text)
    • sbdevice_hid_mouse                      MCU acting as mouse
    • sbdevice_hid_keyboard_mouse             MCU acting as composition
    • sbdevice_libusb                         Usage of LibUSB
    • sbdevice_lineprinter                    Data communication via USB Printer and CDC Class
    • sbhost_keyboard_mouse                   MCU is recognizing a USB keyoard and mouse
  • WC
    • wc_int            Watch Counter function with usage of interrupt callback
    • wc_polling        Watch Counter function with polling for interrupt occurrence
  • WDG
    • hwwdg             Usage of hardware watchdog
    • swwdg
      • swwdg_normal    Usage of normal mode for software watchdog
      • swwdg_normal    Usage of window mode for software watchdog

Usage of example code:

Each example code consists of a 'main.c' and a 'pdl_user.h' module. The main module contains the example code, where 'pdl_user.h' contains all necessary settings and definitions for the example itself. To use and compile an example, just copy these two modules to the 'template/source' folder, overwriting the modules located there. The overwritten modules have backups in the 'template/source/backup' folder for recovery. All adjustments for IAR Workbench and ARM/KEIL uVision IDE are done in the template project and will fit to the example code. Follow the explanations and advices in the main.c module's description in the comment lines at the top.