subsidiaries, including Spansion LLC (“Cypress”). This document, including any software or firmware included or
referenced in this document (“Software”), is owned by Cypress under the intellectual property laws and treaties of the United
States and other countries worldwide. Cypress reserves all rights under such laws and treaties and does not, except as
specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other intellectual property
rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with
Cypress governing the use of the Software, then Cypress hereby grants you under its copyright rights in the Software, a
personal, non-exclusive, nontransferable license (without the right to sublicense) (a) for Software provided in source code
form, to modify and reproduce the Software solely for use with Cypress hardware products, only internally within your
organization, and (b) to distribute the Software in binary code form externally to end users (either directly or indirectly through
resellers and distributors), solely for use on Cypress hardware product units. Cypress also grants you a personal, non-
exclusive, nontransferable, license (without the right to sublicense) under those claims of Cypress’s patents that are
infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely to
the minimum extent that is necessary for you to exercise your rights under the copyright license granted in the previous
sentence. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR
ANY SOFTWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes to this document without further
notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in this
document. Any information provided in this document, including any sample design information or programming code, is
provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and
test the functionality and safety of any application made of this information and any resulting product. Cypress products
are not designed, intended, or authorized for use as critical components in systems designed or intended for the operation
of weapons, weapons systems, nuclear installations, life-support devices or systems, other medical devices or systems
(including resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other
uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”).
A critical component is any component of a device or system whose failure to perform can be reasonably expected to cause
the failure of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and
Company shall and hereby does release Cypress from any claim, damage, or other liability arising from or related to all
Unintended Uses of Cypress products. Company shall indemnify and hold Cypress harmless from and against all claims,
costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended
Uses of Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, PSoC, CapSense, EZ-USB, F-RAM,
and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries. For a more
complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their
respective owners.
1.3 Jumper and Connector ....................................................................................................................................... 8
1.4 Getting Started ................................................................................................................................................... 9
1.6 Technical Support ............................................................................................................................................... 9
2. Installation and Test Operation ............................................................................................................................... 11
2.3 Test Operation .................................................................................................................................................. 15
3.1 System Block Diagram ..................................................................................................................................... 22
3.2 Hardware Features ........................................................................................................................................... 22
4. Software Development ............................................................................................................................................. 28
4.2 Example Projects .............................................................................................................................................. 33
A.2 Bill of Materials ................................................................................................................................................. 56
Revision History ................................................................................................................................................................ 59
Document Revision History ........................................................................................................................................ 59
Thank you for your interest in the FM4-120L-S6E2HG FM4 S6E2H-Series Starter Kit. The FM4
S6E2H-Series Starter Kit enables customers to evaluate and develop projects using the FM4
device family. Flexible MCU 4 (FM4) is a portfolio of high-performance ARM® Cortex®-M4 MCUs
that includes hardware support for digital signal processing and floating-point operations,
designed for safety-critical, industrial systems and home appliance applications. There are
multiple series of device families in this portfolio. The S6E2C-Series, S6E2H-Series and S6E2GSeries are few of the prominent series of device families. This kit uses a device from the S6E2HSeries.
Devices in the S6E2H-Series are highly integrated 32-bit microcontrollers with high performance
at a competitive cost. This series is based on the ARM® Cortex®-M4 processor, including
floating point instructions, with on-chip flash memory and SRAM. The series has peripherals
such as motor control timers, A/D converters, and communications interfaces like CAN, UART,
CSIO, I2C and LIN. The S6E2H-Series of FM4 devices offers up to a 160-MHz CPU, 512 Kbytes
Main Flash, 32 Kbytes Work Flash, 64KB SRAM, 100 GPIOs,24 digital peripherals and 2 analog
peripherals.
The FM4 S6E2H-Series Starter Kit routes all pins out, which provides limitless options for
application development. It is intended to aid the customer to evaluate the featured peripherals
of the S6E2H-Series. In order to properly enable our customers, the FM4 S6E2H-Series Starter
Kit is aligned to our low cost development systems, aligning this kit with our successful line of
Starter Kits in form, price and flexibility.
This guide will help you get started with the FM4 S6E2H-Series Starter Kit:
The Installation and Test Operationchapter describes the kit installation and test
operation. This includes the CMSIS-DAP driver to enable the CMSIS-DAP debugger,
Serial Port Viewer Tool to view the serial port communication, Flash MCU programmer
and Flash USB Direct programmer to program the hex files on the device.
The Hardwarechapter describes the major features of the FM4 S6E2H-Series Starter
Kit and functionalities such as CMSIS-DAP debugger, RGB LED, and buttons.
The Software Developmentchapter describes the available software resources and
tools, and how to create a project based on the Peripheral Driver Library (PDL).
The Appendix provides the kit schematics, and the bill of materials (BOM).
1.5 Additional Learning Resources
Cypress provides a wealth of data at www.cypress.com to help you to select the right MCU
device for your design, and quickly and effectively integrate the device into your design. The
following is an abbreviated list for FM4 family resources:
Overview: S6E2H-Series fact sheet
Device Selector : Microcontroller Select Guide
Datasheets: S6E2H-Series datasheet and Handling precautions.
FM4 Peripheral Manual: Main Section, Communication Macro Section, Analog Macro
Section, Timer Section.
The documents listed above can be accessed from the kit’s webpage at
www.cypress.com/FM4-120L-S6E2HG.
1.6 Technical Support
For assistance, visit Cypress Support or contact customer support at +1(800) 541-4736 Ext. 2
(in the USA) or +1(408) 943-2600 Ext. 2 (International).
This chapter describes the steps to install the software tools on a PC for using the FM4
S6E2H-Series Starter Kit. After successful installation, the user can run pre-programmed test
code on the device.
2.1 Install Software
Follow the steps below to install the FM4 S6E2H-Series Starter Kit software:
1. Download the FM4 S6E2H-Series Starter Kit installer from the webpage
www.cypress.com/FM4-120L-S6E2HG. The Kit software is available for download in three
formats.
FM4 S6E2H-Series Starter Kit Complete Setup: This installation package contains the
files related to the kit, including the Documentation, Hardware, Firmware, Software tools
and drivers. However, it does not include the Windows Installer or Microsoft .NET
framework packages. If these packages are not installed on your computer, the installer
directs you to download and install them from the Internet.
FM4 S6E2H-Series Starter Kit Only: This executable file installs only the kit contents,
which include kit code examples, hardware files, and user documents. This package can
be used if all the software prerequisites (listed in step 7) are already installed on your
PC.
FM4 S6E2H-Series Starter Kit DVD ISO: This file is a complete package, stored in a
DVD-ROM image format, which you can use to create a DVD or extract using an ISO
extraction program such as WinZip® or WinRAR. The file can also be mounted like a
virtual CD/DVD using virtual drive programs such as Virtual CloneDrive and MagicISO.
This file includes all the required software, utilities, drivers, hardware files, and user
documents.
2. If you have downloaded the ISO file, mount it as a virtual drive. Extract the ISO contents if
you do not have a virtual drive to mount the ISO file. Double-click cyautorun.exe in the
root directory of the extracted content or the mounted ISO if “Autorun from CD/DVD” is not
enabled on the PC. The installation window will appear automatically.
Note:If you are using the “Kit Complete Setup” or “Kit Only” package, then go to step 4 for
3. Click Install FM4-120L-S6E2HG to start the kit installation, shown as Figure 2-1.
Figure 2-1: Kit Installation Window
4. Select the folder in which you want to install this package or use the default folder and
click Next.
5. Choose the Typical, Custom, or Complete installation type (select 'Typical' if you do not
know which one to select) in the Product Installation Overview window, as shown in
Figure 2-2. Click Next after you select the installation type.
Figure 2-2: Product Installation Overview
6. Read the License agreement and select I accept the terms in the license agreement to
continue with installation.
7. When you click Next, the FM4 S6E2H-Series Starter Kit installer automatically installs the
required software, if it is not present on your PC. Following are the required software and
driver:
FM Universal Peripheral Driver Library (PDL)
Serial Port Viewer
FLASH USB DIRECT Programmer
FLASH MCU Programmer
CMSIS-DAP driver
8. When the installation begins, a list of packages appears on the installation page. A green
check mark appears next to each package after successful installation.
9. If you are an un-registered user either enter your contact information or select the check
box Continue without Contact Information. If you are a registered user, then the
installation procedure will not request you to enter the contact information. Click Finish to
complete the kit installation.
Note: Ensure that the check boxes Extract Example Projects and Extract FM PDL 2.0
are selected.
10. View the documents and select the folder in which you want to extract the FM Peripheral
Driver Library (PDL) and example projects or leave it as default. Click Install.
Figure 2-4: Extract the Example Projects
11. Click Close to finish the extraction.
After the installation is complete, the documents and hardware files are available at the following
default location:
Windows OS (64-bit): C:\Program Files (x86)\Cypress
\FM4 S6E2H-Series Starter Kit
Windows OS (32-bit): C:\Program Files\Cypress\FM4 S6E2H-Series Starter Kit
The Peripheral Driver Library (PDL) will be extracted to this default directory:
The FM4 S6E2H-Series Starter Kit has been pre-programmed with a test demo code, which
helps you to test all on-board features. The Motorola s-record file, tp_fm4-120l-s6e2hg.srec, is
provided in the following directory and can be programmed on the MCU by using the FLASH
MCU Programmer.
Follow the instructions to run the test demo code.
1. Ensure the jumpers J7, J10 and J19 are closed. Close Pin 1 and Pin 2 of J15 and J20.
Close Pin2 and Pin3 of J21 and connect CN3 to a PC using the USB cable provided.
Figure 2-5: Power the Board from CN3
2. Ensure the power LED (LED5) is on and the LED3 blinks with a breathing effect. The RGB
LED (LED2) will alternately flash red, green, and blue.
3. If not already launched, then launch the Serial Port Viewer from the start menu under
All Programs > Cypress > Serial Port Viewer.
5. Click on the Serial Port Viewer icon in the task bar and select the FM-Link/CMSIS-DAP Cypress FM Communications Port.
Figure 2-6: FM-Link/CMSIS-DAP Cypress FM Communications Port
6. Select the baud rate 115200, and click the Disconnect button to connect the board.
Figure 2-7: Select the Baud Rate
7. Press the Enter key on your keyboard to run the test procedure. Key in the option number
to run the test and press the Enter key to complete the test.
This section explains the test procedure. This test procedure is based on the Serial Port Viewer.
The user has to key-in the test procedure number displayed on the menu to run the test
procedures and then press the Enter key on the PC to complete the test. The firmware on the
board will run the test procedure and display the results. There are eight test procedures. A short
description of each test procedure is given below:
Red LED (RGB LED) Test: This procedure will test whether red LED works normally.
Key in 1 to run the test procedure and the red LED will blink. Then press the Enter key
on the PC to complete the test and TESTED will be displayed next to the test.
Figure 2-11: Red LED Test
Green LED (RGB LED) Test: This procedure will test whether green LED works
normally. Key in 2 to run the test procedure and the green LED will blink. Then press the
Enter key on the PC to complete the test and TESTED will be displayed in the console.
Blue LED (RGB LED) Test: This procedure will test whether blue LED works normally.
Key in 3 to run the test procedure and the blue LED will blink. Then press the Enter key
on the PC to complete the test. TESTED will be displayed as shown in Figure 2-13.
Figure 2-13: Blue LED Test
SW2 User Key Test: This procedure is to test switch SW2. Key in 4, and then press
SW2 on the starter board. The RGB LED (LED2) will glow green while SW2 is held down.
Release SW2 and press the Enter key to complete the test. It will display OK.
SW3 User Key Test: This procedure is to test switch SW3. Key in 5, and then press
SW3 on the starter board. The RGB LED (LED2) will glow green while SW3 is held down.
Release SW3 and press Enter to complete the test. It will display OK.
Figure 2-15: SW3 User Key Test
Potentiometer Test: This procedure tests the potentiometer. Key in 6 and "Turn Pot
clockwise/anti-clockwise" appear in the serial port viewer window depending on the
potentiometer’s (R11) current position. When the potentiometer is turned clockwise from
the min to the max position, RGB LED (LED2) color changes from red to green to blue.
When turned anticlockwise, LED color varies from blue to green to red.
SD Card Test: This procedure tests the SD Card. Key in 7 and press the Enter key. If
an SD Card is found in the SD card slot (CN5) and read successfully, the console will
display OK. If an SD Card is not found in the slot, the console will display Fail.
Figure 2-17: SD Card Test
Sub Clock Test: This procedure will test whether the sub clock is at 32.768 KHz or not.
Key in 8 and press the Enter key, the main routine will shift the system clock to the sub
clock, and then shift back to main clock after the sub clock is confirmed to be running at
32.768 KHz. It displays OK if the sub clock is running at 32.768 KHz otherwise it will
display Fail.
Reset button
20-pin JTAG interface
Selectable on-board voltage (3.3 V or 5.0 V)
3.3 Hardware Details
3.3.1 FM4 Series MCU
The FM4 S6E2HG MCU is a family of highly integrated 32-bit microcontrollers dedicated for high
performance embedded controllers at competitive price.
This series is based on the ARM® Cortex®-M4 processor with on-chip flash memory and SRAM,
and has peripherals such as motor control timers, A/D converters, and communication interfaces
like CAN, UART, CSIO, I2C, and LIN.
3.3.2 User Button and LED
The FM4 S6E2H-Series Starter Kit features two user buttons and a 3-color LED. The LED and
switches are connected to the S6E2HG MCU device via pins listed in Table 3-1.
Table 3-1: Button and LED
Pin 56 is used to drive the blue LED; it is also connected to MD1 pin which is used for the serial
programming mode setting. Jumper J21 can be used to switch the functions. Table 3-2 shows
the configuration.
CN5 is an SD card interface connected with the SDIO macro of the S6E2HG device. This SD
card interface supports full function of the SDIO including data transmission, card detection and
write protection.
Figure 3-2: SD Card Circuit
The pin arrangement of the SD card is shown in Figure 3-3.
Table 3-3 shows the signals of the SD card interface.
Table 3-3: Signals of SD Card Interface
3.3.4 CMSIS-DAP
The FM4 S6E2H-Series Starter Kit features an on-board CMSIS-DAP module to enable
programming and debugging of the FM4 S6E2HG MCU. The CMSIS-DAP firmware solution
supports full JTAG configuration and a two-wire Serial Wire Debug (SWD) interface.
The CMSIS-DAP module can also power the FM4 S6E2H-Series Starter kit via the CN3
connector.
The FM4 S6E2H-Series Starter Kit provides an interface, CN2, to connect an external
programmer for programming the FM4 S6E2HG MCU or for connecting a third-party debugging
tool. CN2 is a standard ARM 0.1’’ 10*2-pin Cortex debug connector.
Figure 3-5: 10-pin JTAG I/F
3.3.6 Potentiometer
The FM4 S6E2H-Series Starter Kit has a potentiometer with resistance value ranging from 0 to
10 kΩ. The middle terminal is connected to the ADC channel AN18.
The FM4 S6E2H-Series Starter Kit provides two sets of expansion ports which route all the MCU
pins. The user can access all pins of the S6E2HG device from these ports. Figure 3-7 shows the
details.
This chapter provides information about the available software resources supporting the
S6E2HG device and FM4 S6E2H-Series Starter kit.
4.1 Tool Options
The FM4 S6E2H-Series is supported by several third party tools/IDEs, and the user can choose
their preferred tool for development. Any one of below listed IDEs can used for opening and
building the example projects packaged with this kit:
IAR Embedded Workbench for ARM
Keil ARM RealView® Microcontroller Development System
Download evaluation versions of these tools from the vendor’s website. A full license may be
required to build or debug some of the example projects. For detailed information on using the
tools, see the documentation in the Help section of the tool chain or the website of the tool’s
supplier.
4.1.1 Build an Example Project with IAR IDE
The following steps describe how to open, build, and run an example project in the IAR IDE.
The s6e2hg_adc is one example project that is available after a successful installation.
1. Launch IAR Embedded Workbench IDE V7.40.5.9739 (or later).
Sets MB9AF312K (CMSIS-DAP) in run mode. Power from CMSIS-DAP (CN3)
J7
Closed
Sets S6E2HG (CMSIS-DAP) in run mode.
J10
Closed
Sets SW3 user button connected.
J15
Pin1 to Pin2
Sets S6E2HG to 3.3V.
J19
Close
CMSIS-DAP virtual COM connection
J20
Pin1 to Pin2
CMSIS-DAP virtual COM connection
J21
Pin2 to Pin3
PE0 drives blue LED
3. Click Project > Rebuild All to build the project.
4. Make sure the jumpers on the FM4 S6E2H-Series Starter board are placed according to
Table 4-1.
Table 4-1: Debugging Jumper Settings
5. Connect the USB cable to the CN3 port.
6. Observe that Power LED (LED5) is glowing green.
7. Click the Download and Debug icon in the tool bar, use Shortcut Crtl+D, or choose
Project > Download and Debug to start downloading and debugging.
Note: When downloading the code example into the board, if you get a following warning:
"Skipping flash loading pass because there is no data in the designated range:
0x200C0000-0x200C7FFF", you can safely ignore it.
The S6E2HG processor includes two banks of flash, the main flash and a smaller work
flash at address 0x200C0000. The code examples do not use the work flash. However, the
debugger memory map includes the work flash, as it should. In effect, the IAR IDE tells you
the code example doesn't use the work flash. That's correct, and not a problem.
8. Click the Run icon to run the program once it is downloaded successfully.
Refer to the Example Projects section for more details on example projects.
9. Click the Stop icon to stop the program.
For more information about the IAR Embedded Workbench IDE, please click Help from within
the tool.
4.1.2 Build an Example Project with Keil µVision IDE
The following steps describe how to open, build and run an example project in Keil µVision IDE.
Before doing this, please check the availability of the flash loader file of the S6E2HG device
(S6E2HG4X0A.FLM & S6E2HG6X0A.FLM) in this directory:
<Keil_Install_Directory>:\ARM\flash.
If the flash loader files are not there, copy them to the above folder from:
Title: Analog-to-Digital Converter
Description: This project demonstrates the analog to digital conversion of the S6E2HG
device. This example sets the ADC to channel 18 in single conversion mode with
interrupt enabled. ADC channel 18 is connected to a potentiometer. The conversion is
started using a software trigger. When an ADC conversion is completed, the interrupt
callback function is called, it reads the result data and prints it to UART0. Refer to
section AD Converter for details.
2
s6e2hg_bt_pwm
Title: Base Timer
Description: This project demonstrates the base timer operation of the S6E2HG
device. This project configures a base timer in PWM mode to generate a PWM
sequence. The PWM outputs from TIOA6_2 which drives the red LED of LED2. The
PWM duty cycle is updated every 1ms by another base timer to produce a breathing
LED effect.
3
s6e2hg_dma
Title: Direct Memory Access (DMA)
Description: This project demonstrates DMA operation of the S6E2HG device. This
example shows how to use DMA for software block transfer. In this example DMA
channel 0 is used to transfer the contents of an array to another array using software
block transfer. After the transfer a callback function is executed, which sets a DMA
operation finished flag. Refer to section Direct Memory Access (DMA) for details.
4
s6e2hg_ext_int
Title: External Interrupt
Description: This project demonstrates the external interrupt operation of the S6E2HG
device. SW2 key press is detected by the external interrupt. Pressing the SW2 key on
the board will change the color of RGB LED (LED2) from red to green to blue.
5
s6e2hg_flash
Title: Flash Write
Description: This project demonstrates the flash writing operation of the S6E2HG
device. A specific set of four values each of four bytes in size will be written into a
specific address location in the flash memory. Refer to section Flash Write for the
details.
4.2 Example Projects
The FM4 S6E2H-Series Starter Kit includes twelve example projects to help the user get a quick
start with the S6E2HG device. The example projects are located in this directory:
These examples listed in the Table 4-3 are based on the Peripheral Driver Library (PDL). The
PDL provides APIs for initializing and operating on-chip peripherals. PDL documentation is
available at:
<User_Directory>:\FM_PDL_2.0.1\doc
Use either IAR Embedded Workbench v7.40.5.9739 (or later) or Keil µVision IDE v5.16a (or later)
to open these example projects.
Title: GPIO
Description: This project demonstrates the GPIO operations of the S6E2HG device by
driving an LED. Pin P38 sinks current from the green LED of the RGB LED (LED2). Pin
P38 will output a pulse sequence to blink the LED continuously.
7
s6e2hg_mfs_uart
Title: Multi-function Serial Interface
Description: This project demonstrates the UART communication of the S6E2HG
device. This program enables the MFS0 as a UART to communicate with the CMSISDAP. The CMSIS-DAP serves as the bridge between the MCU and the PC. Refer to
section UART Communication for details.
8
s6e2hg_mft_frt
Title: Multi-function Timer
Description: This project demonstrates the multi-function timer (MFT) operation of the
S6E2HG device. This example demonstrates the access of FRT (Free Run Timer) in
Up/Down-count mode with peak/zero match interrupt. The blue LED (RGB LED2) will
turn on/off when peak/zero match interrupt occurs.
9
s6e2hg_rtc
Title: Real Time Clock
Description: This project demonstrates the RTC operation of the S6E2HG device. The
program enables the RTC in calendar mode, and sends out the current calendar data
through UART0. The calendar starts from 2015/9/30 23:59:01 Wednesday. The
calendar data will be displayed in the Serial Port Viewer window. When time reaches
"2015-10-01 00:00:00", the Serial Port Viewer window displays ‘alarm occurs’
message, and at the same time, RGB LED2 starts blinking. A new time "2015-10-01
09:30:00" is set.
10
s6e2hg_sleep_mode
Title: Sleep Mode
Description: This project demonstrates the sleep mode operation of the S6E2HG
device. The MCU will enter sleep mode after blinking the green LED five times. It can
be woken up by pressing SW3. After wakeup, the green LED will turn on. Refer to
section Sleep Mode for the details.
11
s6e2hg_sw_wdt
Title: Software Watchdog
Description: This project demonstrates the operation of the S6E2HG watchdog by
considering two different situations when the watchdog is enabled: a) when the
watchdog is fed and b) when the watchdog is not fed. If the watchdog is enabled and is
fed in time, the program will run normally, and the RGB LED will blink green. If the
watchdog is enabled and not fed in time, the device will reset, and the green LED will
remain ON continuously. Refer to section Software Watchdog for the details.
12
s6e2hg_wc
Title: Watch Timer
Description: This project demonstrates the Watch Timer function of the S6E2HG
device. The Watch Timer generates an interrupt every second. In the interrupt service
routine, pin P38 will drive the RGB LED (LED2) to blink green.
This project demonstrates the Analog-to-Digital conversion of the S6E2HG device. This example
sets the ADC channel 18 in single conversion mode with interrupt enabled. ADC channel 18 is
connected to a potentiometer. The conversion is started using a software trigger. When ADC
conversion is completed, the interrupt callback function is called, it reads the result data and
prints it to UART0.
4.2.1.2 Hardware Connection
No specific hardware connections are required for this project. All connections are hardwired on
the board.
4.2.1.3 Verify Output
1. Power the FM4 S6E2HG-Series Starter board from CN3 using a USB cable, refer to
Figure 2-5.
2. Open the project file in IAR Embedded Workbench or Keil µVision IDE from the following
directory on your PC:
3. Build the project and download the code into the S6E2HG device.
4. Run the Serial Port Viewer, set the baud rate as 115200, and click the Disconnected
button to connect the board with PC, as described insectionRun the Test Demo.
5. Run the program and the ADC value will be displayed in the Serial Port Viewer window.
Figure 4-2: ADC value
6. Turn the potentiometer, the ADC values will change accordingly.
4.2.2 Direct Memory Access (DMA)
4.2.2.1 Project Description
This project demonstrates DMA operation of the S6E2HG device. The program configures DMA
to move the data from au32SourceData (source array) to au32DestinationData (destination
array), and then compares the content of the arrays to verify the data.
4.2.2.2 Hardware Connection
No specific hardware connections are required for this project. All connections are hardwired on
the board.
4.2.2.3 Verify Output
4.2.2.3.1 Instructions for IAR Embedded Workbench
1. Power the FM4 S6E2H-Series Starter board from CN3 using a USB cable, refer to
Figure 2-5.
2. Open the project file in IAR Embedded Workbench from the following directory on your
PC:
IAR project: <User_Directory>:
\FM4 S6E2H-Series Starter Kit_Ver01\Firmware
\Demo Projects\s6e2hg_dma\IAR\s6e2hg_dma.eww.
3. Build the project and download the code into the S6E2HG device.
5. Add the arrays au32SourceData and au32DestinationData in Watch1 window.
6. Run the program for a while (>10 seconds).
7. Stop the program and check the arrays mentioned above. The Program Counter (PC) will
stop at the routine as shown below which means the content of the arrays are the same.
You can also verify the content of the arrays in the watch window.
4.2.2.3.2 Instructions for Keil µVision IDE
1. Power the FM4 S6E2H-Series Starter board from CN3 using a USB cable, refer to
Figure 2-5.
2. Open the project s6e2hg_dma in Keil µVision IDE from the following directory on your PC:
5. Add the arrays au32SourceData and au32DestinationData in Watch1 window.
6. Run the program for a while (>10 seconds).
7. Stop the program and check the arrays mentioned above. The Program Counter (PC) will
stop at the routine as shown below which means the content of the arrays are the same.
You can also verify the content of the arrays in the watch window.
4.2.3 Flash Write
4.2.3.1 Project Description
This project demonstrates the flash writing operation of the S6E2HG device. A specific set of
four values each of four bytes in size will be written into a specific address location in the flash
memory.
4.2.3.2 Hardware Connection
No specific hardware connections are required for this project. All connections are hardwired on
the board.
4.2.3.3 Verify Output
4.2.3.3.1 Instructions for IAR Embedded Workbench
1. Power the FM4 S6E2H-Series Starter board from CN3 using a USB cable, refer to
4. Open the Memory1 window from the View > Memory Windows. Enter 0x00070000 in the
Address table and press the Enter Key on your PC.
5. Run the program for a while (>10 seconds).
6. Stop the program and check the content of 0x00070000 in the flash.
4.2.4 UART Communication
4.2.4.1 Project Description
This project demonstrates the UART communication of the S6E2HG device. This program
enables the MFS0 as a UART to communicate with the CMSIS-DAP. The CMSIS-DAP serves
as the bridge between the MCU and the PC.
4.2.4.2 Hardware Connection
No specific hardware connections are required for this project. All connections are hardwired on
the board.
4.2.4.3 Verify Output
1. Power the FM4 S6E2H-Series Starter board from CN3 using a USB cable, refer to
Figure 2-5.
2. Open the project file in IAR Embedded Workbench or Keil µVision IDE from the following
directory on your PC:
3. Build the project and download the code into the S6E2HG device.
4. Run the program.
5. Run the Serial Port Viewer, set the baud rate as 115200, and click the Disconnected
button to connect the board with the PC, as described in sectionRun the Test Demo.
This project demonstrates the sleep mode operation of the S6E2HG device. The MCU will enter
sleep mode after blinking the green LED 5 times. It can be woken up by pressing the SW3 key.
After wakeup, the green LED will turn on.
4.2.5.2 Hardware Connection
No specific hardware connections are required for this project. All connections are hardwired on
the board.
4.2.5.3 Verify Output
1. Power the FM4 S6E2G-Series Starter board from CN3 using a USB cable, refer to
Figure 2-5.
2. Open the project file in IAR Embedded Workbench or Keil µVision IDE from the following
directory on your PC:
3. Build the project and download the code into the S6E2HG device.
4. Run the program.
5. The RGB LED (LED2) will blink 5 times (green color), and then the MCU enters sleep
mode.
Figure 4-6: MCU in sleep mode
6. Press the SW3 key to wake up the MCU.
7. The RGB LED (LED2) will glow with green color.
4.2.6 Software Watchdog
4.2.6.1 Project Description
This project is to demonstrate the operation of the S6E2HG watchdog. The project demonstrates
two different situations: when the watchdog is fed and when the watchdog is not fed.
If the watchdog is enabled and the watchdog is fed in time, the program will run properly, and
the RGB LED (LED2) will blink green.
3. Build the project and download the code into the S6E2HG device.
4. Run the program.
5. The RGB LED (LED2) will blink green.
6. Stop the program, comment out the line of Swwdg_Feed(); in main.c, and click File >
Save
7. Repeat steps 3 to 4.
8. The RGB LED (LED2) will glow green but will not blink.
4.3 Flash Programming
This section describes how to program the S6E2HG MCU using the FLASH MCU Programmer
and how to program the CMSIS-DAP device using the FLASH USB DIRECT Programmer.
4.3.1 Programming the S6E2HG using the FLASH MCU Programmer
1. The FLASH MCU Programmer gets installed on your PC as part the Kit installer. Follow
Install Software to install the kit.
2. Make sure the jumpers on the FM4 S6E2H-Series Starter board are placed according to
Table 4-4.
Table 4-4: Jumper Settings for S6E2HG programming using FLASH MCU Programmer
10. Enter the Virtual COM Port listed in the Ports of Windows Device Manager in COM box in
the Customize setting window (This window appears when the Set Environment button is
clicked).
11. Click on the Full Operation (D+E+B+P) button to start programming.
12. Reset the S6E2HG device by pressing the reset button (SW1) on the board, and click OK.
Note: Please click on Help for any issues or errors encountered during programming.
Enable MB9AF312K CMSIS-DAP for
programming and debugging purpose.
J5
Closed
Sets MB9AF312K (CMSIS-DAP) in
programmer mode.
J7
Closed
Selects CMSIS-DAP as power source.
J10
Closed
Sets S6E2HG in programming mode
J15
Pin1 to Pin2
Sets S6E2HG to 3.3V.
J18
Open
Sets S6E2HG in run mode
J19
Closed
CMSIS-DAP virtual COM connection (SIN0 to
pin 21 of MB9AF312K)
J20
Pin1 to Pin2
CMSIS-DAP virtual COM connection (SOT0
to pin 20 of MB9AF312K)
J21
Pin2 to Pin3
Sets pin PE0 to drive the LED
4.3.2 Programming the CMSIS-DAP (MB9AF312K) Device Using the FLASH USB DIRECT
Programmer
By default, the latest CMSIS-DAP firmware is programmed on the MB9AF312K. It is not required
for the user to re-program firmware again before running the CMSIS-DAP debugger. Follow the
steps below to update the firmware, if needed.
1. The FLASH USB DIRECT Programmer gets installed on your PC as part the kit installer.
2. Make sure the jumpers on the FM4 S6E2H-Series Starter board are placed according to
Table 4-5.
Table 4-5: Programming Jumper Settings for CMSIS-DAP programming
3. Connect the USB cable to the CN3 port.
4. Observe that the Power LED (LED5) is glowing green.
5. Launch the FLASH USB DIRECT Programmer from Windows
Start Menu > All Programs > Cypress > FLASH USB DIRECT Programmer >
USBDirect
6. Select the Target MCU as MB9AF312K.
7. Select the Motorola-S format file or Intel-HEX format file to be programmed on
MB9AF312K. The hex file is included in the following directory: