Starter Kit Users Guide 32-bit ARM® Cortex®-M0+ based Microcontroller S6E1B8 Series APPLICATION NOTE Publication Number FM4_AN709-00005 Revision 1.0 Issue Date February 1, 2015 A P P L I C A T I O N N O T E Target products This application note describes the below products: Series S6E1B8 Series 2 Product Number (Not Including Package Suffix) All products FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N N O T E Table of Contents 1. 2. 3. 4. 5. 6. Introduction ..................................................................................................................................... 5 1.1 Purpose ........................................................................................................................... 5 1.2 Definitions, Acronyms, and Abbreviations ........................................................................... 5 1.3 Document Overview ............................................................................................................ 5 Overview and Features .................................................................................................................. 6 2.1 Overview ........................................................................................................................... 6 2.2 Features ........................................................................................................................... 6 2.3 System Block Diagram ........................................................................................................ 7 Getting Started ............................................................................................................................... 8 3.1 Components Layout ............................................................................................................ 8 3.2 Jumpers Description............................................................................................................ 8 3.3 Connectors Description ....................................................................................................... 8 3.4 Powering the board ............................................................................................................. 9 Hardware ...................................................................................................................................... 10 4.1 MCU and Base Level Components of Board ..................................................................... 10 4.1.1 MCU ................................................................................................................. 10 4.1.2 User Button and LED ....................................................................................... 10 4.1.3 Arduino interface .............................................................................................. 10 4.1.4 Free Pins .......................................................................................................... 12 4.1 Stereo Codec .................................................................................................................... 13 4.2 Micro SD Card ................................................................................................................... 14 4.3 Accelerometer ................................................................................................................... 15 4.4 USB ......................................................................................................................... 15 4.5 Potentiometer .................................................................................................................... 16 4.6 Debug Options .................................................................................................................. 16 4.6.1 CMSIS-DAP ..................................................................................................... 16 4.6.2 JTAG ................................................................................................................ 17 Software Development ................................................................................................................. 18 5.1 Source Code ..................................................................................................................... 18 5.2 Tool Options ...................................................................................................................... 18 5.3 Using Template Project in IAR .......................................................................................... 18 Additional Information ................................................................................................................... 22 Figures Figure 2-1: Board Overview ....................................................................................................................... 6 Figure 2-2: System Block Diagram ............................................................................................................. 7 Figure 3-1: Components Layout ................................................................................................................. 8 Figure 3-2: Powering the Board ................................................................................................................. 9 Figure 4-1: Pin Definition of Arduino interface .......................................................................................... 10 Figure 4-2: Free Pins................................................................................................................................ 12 Figure 4-3: Stereo Codec Circuit .............................................................................................................. 13 Figure 4-4: Micro SD Card in SPI mode ................................................................................................... 14 Figure 4-5: Pin arrangement of Micro SD card ......................................................................................... 14 Figure 4-6: Acceleration Sensor ............................................................................................................... 15 Figure 4-7: USB Device............................................................................................................................ 15 Figure 4-7: Potentiometer ......................................................................................................................... 16 Figure 4-8: CMSIS-DAP ........................................................................................................................... 16 Figure 4-9: 10-pin JTAG I/F ...................................................................................................................... 17 February 1, 2015, FM4_AN709-00005-1v0-E 3 A P P L I C A T I O N N O T E Tables Table 3-1: Jumper Description .................................................................................................................... 8 Table 3-2: Connectors Description ............................................................................................................. 8 Table 4-1: Connectors Description ........................................................................................................... 10 Table 4-2: Pins in Arduino interface ........................................................................................................... 11 Table 4-3: Free pins.................................................................................................................................. 12 Table 4-4: Micro SD Card Signals ............................................................................................................ 14 4 FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N N O T E 1. Introduction 1.1 Purpose This guide is the user guide for the SK-FM0-100L-S6E1B8 starter kit. It provides a hardware description for the kit and software development resources for application development. 1.2 1.3 Definitions, Acronyms, and Abbreviations UART Universal Asynchronous Receiver/Transmitter USB Universal Serial Bus LED Light Emitting Diode LDO Low-Drop-Out linear voltage regulator I/F Interface Document Overview The rest of document is organized like this: Chapter 2 is Overview and Features. Chapter 3 is Getting Started Chapter 4 is Hardware Chapter 6 is Software Development Chapter 6 is Additional Information February 1, 2015, FM4_AN709-00005-1v0-E 5 A P P L I C A T I O N N O T E 2. Overview and Features 2.1 Overview The SK-FM0-100L-S6E1B8 starter kit provides a low-cost solution to quickly start development on an ARM® Cortex®-M0+ microcontroller. The board features peripheral devices to demonstrate the features of the FM0+ S6E1B8 microcontroller. It also has an Arduino-compatible interface to connect with shields, making application development options limitless. The FM0+ S6E1B8 microcontroller comes pre-programmed with an interactive application to test all of the on-board features using a virtual communication port to send message prompts, input test parameters, and output test results. Figure 2-1: Board Overview 2.2 Features 6 Spansion FM0+ S6E1B8 MCU On-board ICE (CMSIS-DAP compatible) USB device interface Micro SD card interface Acceleration sensor Potentiometer RGB LED User button Arduino-compatible interface Free pin headers FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N 2.3 N O T E System Block Diagram Figure 2-2 helps on fast review and understanding the system. Figure 2-2: System Block Diagram February 1, 2015, FM4_AN709-00005-1v0-E 7 A P P L I C A T I O N N O T E 3. Getting Started To initially start with the SK-FM0-100L-S6E1B8 starter kit, it is recommended to follow the Quick Start Guide. This will guide you through the initial steps of powering the board and running the preprogrammed demonstrations. The following sections will introduce the components, jumpers and connectors. 3.1 Components Layout Figure 3-1: Components Layout 3.2 Jumpers Description On this starter kit, there are 5 jumpers as listed below: Table 3-1: Jumper Description Number J1 Name Descriptions CMSIS-DAP MD0 Open: normal operation J2 FM0 MD0 Closed: serial programming mode Open: normal operation J3 UART or USB programing mode select J4 5V power supply select Closed: serial programming mode Pin 2 to Pin 1: UART programming mode Pin 2 to Pin 3: USB programming mode Pin 2 to Pin 1: USB power supply (CN3) Pin 2 to Pin 3: DAP power supply (CN4) 3.3 Connectors Description The connectors are listed in the Table 3-2. Table 3-2: Connectors Description Number 8 Name Descriptions 1 CN1 3.5mm headphone and microphone jack 2 3 CN2 CN3 10-pin JTAG interface USB port of CMSIS-DAP 4 5 CN4 CN5,CN6,CN12,CN14 USB port of FM0 MCU Free pin headers (male) 6 7 CN7,CN8,CN9,CN10 CN11 Arduino compatible headers (female) Micro SD card socket FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N 3.4 N O T E Powering the board There are two options for powering the SK-FM0-100L-S6E1B8 starter kit. In this document, CN3 will be used for the default USB connection. Connect the USB cable to CN3 to power the board. The green power LED3 will light. If it does not, ensure that jumper J4 is in 1-2 position as shown below. Figure 3-2: Powering the Board February 1, 2015, FM4_AN709-00005-1v0-E 9 A P P L I C A T I O N N O T E 4. Hardware 4.1 MCU and Base Level Components of Board This section contains information on the MCU, user button and user LED, and Arduino interface. 4.1.1 MCU S6E1B8 Series is ARM® Cortex®-M0+ core based MCU .It is designed for low-power and cost-sensitive applications such as white goods, sensors, meters, HMI systems, power tools and internet of things (IoT) battery powered or energy harvesting wearable devices. It has not only some basic peripherals such as base timers, MFS, ADC but some featured peripherals like USB, I2S, segment LCD driver and ISO7816 interface etc. 4.1.2 User Button and LED There is a user button and a user tri-color LED on the starter kit board. Table 4-1: Connectors Description Pin No. Port External Device 85 P0A SW2 22 P3D LED4 – Red 23 P3E LED4 – Green 24 P3F LED4 – Blue The port P3D/P3E/P3F are also assigned as the PWM output pins, so user can diming the LED by configuring the base times in PWM mode and outputting PWM signals from the pins. 4.1.3 Arduino interface This starterkit provides female headers which are compatible with the headers of Arduino UNO R3. These headers expand the possibility for user to develop more applications based on this starterkit and different Arduino compatible shields. Figure4-1 shows the definition of the pins. Figure 4-1: Pin Definition of Arduino interface 10 FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N N O T E The following table shows the full functions of the pins connected with the Arduino headers. It is useful for planning your design and pin usage. Table 4-2: Pins in Arduino interface Pin No. Pin Name Arduino designation Function (part) 15 P36/IC02_0/SIN5_2/INT09_1/WKUP11 D0 UART – RX 16 P37/IC01_0/SOT5_2/INT10_1 D1 UART – TX 17 P38/IC00_0/SCK5_2/INT11_1 D2 IO 19 P3A/RTO00_0/TIOA0_1/INT07_0/RTCCO_2/SUBOUT_2/IC 1_CIN_0/COM2 D3 PWM 18 P39/DTTI0X_0/ADTG_2/TIOB4_0/INT06_0/COM3 D4 IO 20 P3B/RTO01_0/TIOA1_1/IC1_DATA_0/COM1 D5 PWM 21 P3C/RTO02_0/TIOA2_1/INT18_2/IC1_RST_0/COM0 D6 PWM 14 P35/SCS62_1/IC03_0/TIOB5_1/INT08_1/SEG37 D7 IO 32 P45/LVDI/TIOA5_0/SEG32/IC0_CIN_1 D8 PWM 31 P44/TIOA4_0/INT10_0/SEG33/RTS1_2/IC0_DATA_1 D9 PWM 30 P43/TIOA3_0/INT09_0/ADTG_7/CTS1_2/IC0_RST_1 D10 SPI -- #CS 28 P41/TIOA1_0/INT13_1/SOT1_2/IC0_VCC_1 D11 SPI -- SOT 27 P40/TIOA0_0/INT12_1/SIN1_2/IC0_CLK_1 D12 SPI -- SIN 29 P42/TIOA2_0/INT08_0/SCK1_2/IC0_VPEN_1 D13 SPI -- SCK 44 P4C/TIOB2_0/SOT7_1/INT12_0/SEG29/CEC0_0 D14 I2C -- SDA 45 P4D/TIOB3_0/INT13_0/SCK7_1/WKUP6/SEG28 D15 I2C -- SCL 69 P1D/AN13/CTS4_1/DTTI0X_1/INT22_2/SEG14 A0 AN13 70 P1E/AN14/RTS4_1/ADTG_5/FRCK0_1/INT23_2 A1 AN14 71 P23/AN16/SCK0_0/TIOA7_1/RTO00_1/SEG13 A2 AN16 66 P1A/AN10/SIN4_1/IC01_1/INT05_1/SEG17 A3 AN10 67 P1B/AN11/SOT4_1/IC02_1/INT20_2/SEG16 A4 AN11/I2C--SDA 68 P1C/AN12/SCK4_1/IC03_1/INT21_2/SEG15 A5 AN12/I2C--SCL 36 INITX RESET RESET February 1, 2015, FM4_AN709-00005-1v0-E 11 A P P L I C A T I O N 4.1.4 N O T E Free Pins Except the Arduino headers, there is a set of free pin headers (CN5, CN6, CN12, and CN14). They are placed in parallel with the Arduino headers. Figure 4-2: Free Pins These free pin headers make it easy for user to access more pins and peripherals, like MFS, PWM, ISO7816 interface and I2S etc. The following table shows details of the pins. Table 4-3: Free pins 12 Pin No. Pin Name Designation Functions (part) N/A N/A CN6-1 GND N/A N/A CN6-2 3V3 94 P62/SCK5_0/I2SCK5_0/ADTG_3/INT07_1/SEG01/TIOA6_1/IC0_RST_0 CN6-3 MFS,I2S,PWM,INT 95 P61/SOT5_0/I2SDO5_0/TIOB2_2/DTTI0X_2/SEG00 CN6-4 MFS,I2S 86 P09/TIOB0_2/RTS4_2/INT17_0/SEG05 CN6-5 IO,INT 97 P80/SIN7_2/INT20_1/C0 CN6-6 MFS,INT 98 P81/SOT7_2/INT11_0/C1 CN6-7 MFS,INT 99 P82/SCK7_2/MD2 CN6-8 MFS 2 P50/INT00_0/SIN3_1/VV4 CN5-1 MFS,INT 5 P53/SIN6_0/TIOA1_2/INT07_2/VV1/WKUP8 CN5-2 MFS,PWM,INT 6 P54/SOT6_0/TIOB1_2/INT18_1/VV0 CN5-3 MFS,PWM 7 P55/SCK6_0/ADTG_1/INT19_1/SEG39 CN5-4 MFS,INT 13 P34/SCS61_1/FRCK0_0/TIOB4_1 CN5-5 IO, Base Timer 39 P48/VREGCTL CN5-6 IO 40 P49/VWAKEUP CN5-7 IO 42 P4A/TIOB0_0/SCS70_1/INT21_1/SEG31 CN5-8 IO,INT, Base Timer N/A N/A CN5-9 3V3 N/A N/A CN5-10 GND 90 P0D/RTS4_0/TIOA3_2/INT20_0/SEG04/IC0_VPEN_0 CN14-6 PWM,INT 91 P0E/CTS4_0/TIOB3_2/INT21_0/SEG03/IC0_VCC_0 CN14-5 INT, Base Timer FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N N O T E 92 P0F/NMIX/CROUT_1/RTCCO_0/SUBOUT_0/I2SMCK5_0/WKUP0 CN14-4 NMIX,I2S 93 P63/SIN5_1/I2SWS5_0/INT03_0/SEG02/TIOB6_1/IC0_DATA_0 CN14-3 MFS,I2S,INT,ISO7816 79 P02/SIN3_2/TIOB5_0 CN14-2 MFS, Base Timer 59 P17/AN07/SIN2_2/INT04_1/SEG20 CN14-1 ADC,MFS,INT 52 P10/AN00/IC1_CLK_1/CTS1_1/SEG27 CN12-1 ADC,ISO7816 54 P12/AN02/IC1_VPEN_1/SOT1_1/IC00_2/SEG25 CN12-2 ADC,MFS,ISO7816 55 P13/AN03/IC1_RST_1/SCK1_1/RTCCO_1/IC01_2/SUBOUT_1/SEG24 CN12-3 ADC,MFS,ISO7816 56 P14/AN04/IC1_DATA_1/RTS1_1/SIN0_1/INT03_1/IC02_2/SEG23 CN12-4 ADC,INT,ISO7816 57 P15/AN05/IC1_CIN_1/SOT0_1/IC03_2/INT14_0/SEG22 CN12-5 ADC,MFS,INT,ISO7816 58 P16/AN06/SCK0_1/INT15_0/SEG21 CN12-6 ADC,MFS,INT 4.1 Stereo Codec WM8731 is a low power stereo codec with an integrated headphone driver. It has I2S interface for the audio data transmission and I2C interface for itself configuration. The I2C address is 0x0A. It offers the unique ability to independently program the ADC and DAC sample rates from a single clock source. The respective sample rates from the clock source are on signals ADCLRC and DACLRC. There is only one frame clock source on MCU, so the ADCLRC and DACLRC are connected together with the I2SWS signal. Note, the I2S interface of S6E1B8 series MCU only have master mode, which means the clock will derive from MCU to codec as an external clock of it. The 12.288MHz crystal, and two 22pF capacitors will not been mounted when assembly. Figure 4-3: Stereo Codec Circuit February 1, 2015, FM4_AN709-00005-1v0-E 13 A P P L I C A T I O N 4.2 N O T E Micro SD Card U14 is a Micro SD card socket that supports the Micro SD card. The socket is connected with MCU via a SPI due to this MCU doesn’t have a standard SD card peripheral. Figure 3-11 shows the Micro SD card connection with S6E1B8 MFS in SPI mode. Figure 4-4: Micro SD Card in SPI mode The pin arrangement of the Micro SD card is shown as below: Figure 4-5: Pin arrangement of Micro SD card Table 4-4: Micro SD Card Signals Number 14 Name Type Description 1 RSV - Reserved in SPI mode 2 3 CS DI I I Chip select Data in 4 VDD power Power supply 5 CLK I Clock 6 VSS power Power supply ground 7 DO O Data out 8 RSV - Reserved in SPI mode FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N 4.3 N O T E Accelerometer The KXCJK is a tri-axis ±2g, ±4g or ±8g silicon micro-machined accelerometer. The sense element is fabricated using Kionix’s proprietary plasma micromachining process technology. Acceleration sensing is based on the principle of a differential capacitance arising from acceleration-induced motion of the sense element, which further uses common mode cancellation to decrease errors from process variation, temperature, and environmental stress. This sensor communicates with MCU via I2C interface. The address of this device is 0x0E which is configured by the ADDR pin. An interrupt will occur once the data updated. Figure 4-6: Acceleration Sensor 4.4 USB Connector CN4 is a micro-B connector that interfaces to the USB0 peripheral of the S6E1B8 device to enable development of USB device applications. Transistor MMC8550 is used to force a termination of the USB communications. Figure 4-7: USB Device February 1, 2015, FM4_AN709-00005-1v0-E 15 A P P L I C A T I O N 4.5 N O T E Potentiometer This starter kit has a potentiometer whose resister vale ranges 0~10k.The middle terminal is connected with the ADC channel AN19. Figure 4-8: Potentiometer 4.6 Debug Options 4.6.1 CMSIS-DAP The CMSIS-DAP provides an on-board JTAG emulator to enable programming and debugging of the S6E1B8 device. The CMSIS-DAP is supported by almost major IDEs, like IAR, Keil. The CMSIS-DAP also provides a virtual communication port that connects to the UART0 of the S6E1B8 device. The CMSIS-DAP module provides power to the SK-FM0-100L-S6E1B8 board via the CN3 connector when J1 is open. The CMSIS-DAP firmware solution supports full JTAG configuration and two-wire interface in the Serial Wire Debug (SWD) interface. The CMSIS-DAP firmware can be updated with new revisions when necessary. For step-by-step instructions of updating the CMSIS-DAP firmware, download CMSIS-DAP update. Figure 4-9: CMSIS-DAP 16 FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N 4.6.2 N O T E JTAG This starter kit board has the option to populate the CN2 to connect an external JTAG emulator from a third party vendor. CN2 is a standard ARM 0.05’’ 10-pin Cortex debug pin-out. J-Link 9-pin Cortex-M adapter is an orderable part number for the CN2 connector. This connector supports the Serial Wire Debug (SWD) interface only. For more information on standard ARM debug pin outs, go to infocenter.arm.com. Figure 4-10: 10-pin JTAG I/F February 1, 2015, FM4_AN709-00005-1v0-E 17 A P P L I C A T I O N N O T E 5. Software Development This section contains information for the software resources that are available to support the S6E1B8 device and SK-FM0-100L-S6E1B8 starter kit. 5.1 Source Code The software resources provided with the SK-FM0-100L-S6E1B8 starter kit includes: Peripheral Driver Library (PDL) with API driver functions Prebuilt templates with PDL integrated for IAR, Keil, and Atollic Examples to demonstrate use of all S6E1B8 peripherals Examples to demonstrate the SK-FM0-100L-S6E1B8 starter kit features and target applications The Peripheral Driver Library (PDL) API set is a full suite of pre-written functions to initialize and operate the on-chip peripherals. It is available on the product web of S6E1B8. The examples in the PDL folder demonstrate the APIs being used to initialize, set the mode, and configure each peripheral. 5.2 Tool Options The S6E1B8 series is supported by several 3rd party tool vendors, and the user has the option to select their preferred vendor. For demonstrating examples, three main IDEs are supported by having a prebuilt template and examples with the PDL integrated. The main.c and pdl_user.h of any example can be copied and pasted into the source folder, and then opened and complied for immediate use in any one of these IDEs: Keil ARM RealView® Microcontroller Development System IAR Embedded Workbench for ARM Atollic GCC Compiler Download evaluation versions of these tools from the vendor’s website. A full license may necessary to build or debug some of the examples. For detailed information on using the tools, see the documentation in the tool chain help section or the website of the tools supplier. 5.3 Using Template Project in IAR This section is to provide step by step guide to programming an example into the S6E1B8 device on the SK-FM0-100L-S6E1B8 starter kit using CMSIS-DAP Jtag emulator with IDE. 18 1) Download and install the IAR Embedded Workbench version 7.1 or later 2) Download SK-FM0-100L-S6E1B8.zip and extract. 3) Install the USB drivers following the steps in Quick Start Guide, if it hasn’t been done before. 4) Powering the board as section 3.4. 5) Open the folder...//SK-FM0-100L-S6E1B8-v10.zip/sw-examples/template in IAR Embedded Workbench 6) Check and configure the items in “Project->Options”. FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N General : Linker : February 1, 2015, FM4_AN709-00005-1v0-E N O T E 19 A P P L I C A T I O N N O T E Debugger, Setup : 20 Debugger, Download : FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N 7) N O T E CMSIS-DAP, JTAG/SWD : Rebuild this project, and click the icon , shortcut “Crtl+D “or Project-> Download and Debug to start download and debugging. 8) 9) Click to run the application. icon halts the program. February 1, 2015, FM4_AN709-00005-1v0-E 21 A P P L I C A T I O N N O T E 6. Additional Information For more Information on Spansion semiconductor products, visit the following websites: English version address: http://www.spansion.com/Products/microcontrollers/ Chinese version address: http://www.spansion.com/CN/Products/microcontrollers/ Please contact your local support team for any technical question America: [email protected] China: [email protected] Europe: [email protected] Japan: [email protected] Other: http://www.spansion.com/Support/SES/Pages/Ask-Spansion.aspx 22 FM4_AN709-00005-1v0-E, February 1, 2015 A P P L I C A T I O N N O T E AN709-00005-1v0-E Spansion Application note FM0+ Family 32-BIT MICROCONTROLLER Starter Kit Users Guide April 2015 Rev. 1.0 Published: Edited: Spansion Inc. Communications February 1, 2015, FM4_AN709-00005-1v0-E 23 A P P L I C A T I O N N O T E Colophon The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions. If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the respective government entity will be required for export of those products. Trademarks and Notice The contents of this document are subject to change without notice. This document may contain information on a Spansion product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy, completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of the information in this document. ® ® ® TM TM Copyright © 2015 Spansion. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse , ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and other countries. Other names used are for informational purposes only and may be trademarks of their respective owners. 24 FM4_AN709-00005-1v0-E, February 1, 2015