AN210985 Getting Started with FM0+ Development.pdf

AN210985
Getting Started with FM0+ Development
Author: James Trudeau
Associated Part Family: All FM0+ parts
Related Application Notes & Code Examples: See the FM0+ Family Resources section
AN210985 introduces you to the FM0+ family of 32-bit general-purpose microcontrollers. The FM0+ family is
based on the ARM® Cortex®-M0+ processor core, ideal for ultra-low-power designs. This note provides an
overview of hardware features and capabilities, firmware development, and the multitude of technical
resources available to you. This application note uses the FM0+ S6E1B8-Series Starter Kit as an example.
Contents
1
2
FM0+ Family Overview .............................................2
Firmware Development ............................................3
2.1
Software Tools Overview .................................3
2.2
Peripheral Driver Library Overview ..................4
2.3
MCU Template Projects ...................................6
3
Build and Run a PDL Project ....................................6
3.1
Before You Begin.............................................7
3.2
Building with IAR Embedded Workbench ........8
3.3
Building with Keil µVision ............................... 12
www.cypress.com
4
Programming Embedded Flash .............................. 17
4.1
Before You Begin........................................... 17
4.2
Using the FLASH MCU Programmer ............. 17
4.3
Using the FLASH USB DIRECT Programmer 21
5
FM0+ Family Resources......................................... 23
Document History............................................................ 24
Worldwide Sales and Design Support ............................. 25
Products .......................................................................... 25
PSoC® Solutions ............................................................. 25
Cypress Developer Community ....................................... 25
Technical Support ........................................................... 25
Document No. 002-10985 Rev. **
1
Getting Started with FM 0+ Development
1
FM0+ Family Overview
Cypress’ FM0+ is a family of 32-bit, general-purpose and energy-efficient microcontrollers based on the ARM
Cortex-M0+ processor. FM0+ microcontrollers operate at 40 MHz and support a diverse set of on-chip peripherals
ideal for white goods, sensors, meters, HMI systems, power tools, and network-aware (Internet of Things) batterypowered or wearable devices.
There are three series within the FM0+ Family. Table 1-1 list some of the defining characteristics of each family.
Table 1-1. FM0+ Family Series
Series
CPU Speed
Operating Voltage
Flash up to…
SRAM up to…
S6E1A
40 MHz
2.7-5.5 V
88 KB
6 KB
S6E1B
40 MHz
1.65-3.6 V
512 KB
64 KB
S6E1C
40 MHz
1.65-3.6 V
128 KB
16 KB
Key features of the FM0+ family include:

Performance and Energy Savings
The MCUs are based on the ARM Cortex-M0+ core, the most energy-efficient ARM processor available
today. The optimized processing and flash architecture of the FM0+ family make it the industry's most energyefficient Cortex-M0+ MCU, achieving an industry-leading 35 µA/CoreMark® score.

Ultra Low Power
The ultra-low-power devices in this family have an operating voltage range of 1.65 - 3.6 V; a maximum CPU
clock frequency of 40 MHz; active mode current of 40 μA/MHz; and an RTC standby mode current of 0.6 μA.
The devices also feature a segment LCD controller and analog peripherals.

High Performance Flash Memory
Memory densities range from 56 KB to 512 KB flash and up to 64 KB RAM – densities typically found only in
MCUs with larger Cortex-M3/M4 cores. The flash memory features a true zero-wait-state operation at full
CPU speed and data retention of up to 20 years.

Other Major Features
A simplified bus matrix reduces power consumption. The devices also include local clock gating for each
peripheral, a separated clock divider for the CPU and peripherals, low pin counts, and low memory density.
The FM0+ MCUs feature Full-Speed USB2.0 Host and Device capabilities, and also offer multiple serial
communication interfaces and AES encryption.
Figure 1-1 shows the block diagram for the S6E1B series as an example. The FM0+ family provides a range of
peripherals, such as A/D converters, LCD controller, USB, a configurable multi-function serial interface, and realtime clock. Peripheral support varies among the series and variants in this family. For details on each series, such
as pin counts, package options, voltage operating range, available peripherals, and Flash/SRAM options, review
the Product Selector Guide and data sheets.
www.cypress.com
Document No. 002-10985 Rev.**
2
Getting Started with FM 0+ Development
Figure 1-1. Block diagram for the FM0+ S6E1B-Series
2
Firmware Development
Cypress provides the Peripheral Driver Library (PDL) to simplify FM0+ software development. The PDL eases
software development for the extensive set of peripherals in the FM0+ family by reducing the need to understand
peripheral registers and bit structures. You configure the library for the particular device, and then use API calls
to initialize and use a peripheral. In addition to the FM0+ family, the PDL supports Cypress FM4 processors and
peripherals. Using the PDL makes it easier to port code from one family to the other.
For developers who wish to work at the register level, Cypress also provides template projects configured for
each particular processor series. You can use these template projects as a starting point for your software
development. The template projects provide support for several additional IDEs. You can also use the PDL source
code as a learning tool. Combined with study of the appropriate data sheet and peripheral manual, you can learn
the information you need to use the peripheral. Refer to the FM0+ Family Resources section of this document for
links to the extensive technical documentation available.
2.1
Software Tools Overview
There is a large ecosystem of tools and tool providers that support the FM0+ family. There is an extensive list of
choices at the Support Tools for FM0+ Family web page.
This document walks you through the process of building an example project with IAR Embedded Workbench or
Keil µVision IDEs.
www.cypress.com
Document No. 002-10985 Rev.**
3
Getting Started with FM 0+ Development
2.2
Peripheral Driver Library Overview
The PDL is a superset of all the code required to build any driver for any supported device. This superset design
has two key features:


All APIs needed to initialize, configure and use a peripheral are available.
The PDL includes error checking, because a peripheral may not be present on the selected device.
The superset design means the PDL is useful across all devices, whatever peripherals are available. This enables
code to maintain compatibility across platforms where peripherals remain present.
If you configure the PDL to include a peripheral that is unavailable on the specified hardware, your project will fail
at compile time, rather than at runtime. The PDL configuration logic knows the target processor and removes the
peripheral register headers for unsupported peripherals from the build.
Before writing code to use a peripheral, consult the datasheet for the particular series or device to confirm support
for the peripheral.
2.2.1
Getting and Installing the PDL
Most FM0+ Cypress starter kits install the PDL as part of the kit. If you install such a kit, the default location for
the PDL is My Documents/Cypress/FM_PDL_<version number>. Refer to the FM0+ Family Resources section
for available kits.
If your kit does not install the PDL, you can download the PDL Installer from the FM0+ product page. On the
Tools & Software tab, look for the link to download the PDL.
2.2.2
PDL Structure
The PDL is organized into several folders. Table 2-1 shows the PDL folder structure.
Table 2-1. PDL Folder Structure
Path\Folder
Description
common
doc
driver
example
Common header files
PDL documentation
Driver source code and headers
Code examples
template\ARM
Keil project and configuration files for use with code examples
template\IAR
IAR project and configuration files for use with code examples
template\source
template\source\backup
utility
Source files, replace with files from code example, or write your own code
Copy of original source files, used to restore template
Various utility files
When you use the PDL, you do need to make specific changes for your target processor, package option, and
peripherals. Typically you do not modify the common files, documentation, or the driver code.
To develop your own code (or use a code example) you work with three files in the template folder:



pdl_device.h
pdl_user.h
main.c
There is a single IAR Embedded Workbench IDE project for all the code examples, located in template\IAR.
Similarly, there is a single Keil µVision IDE project, located in template\ARM.
The Build and Run a PDL Project section explains how to use the source files and project files.
www.cypress.com
Document No. 002-10985 Rev.**
4
Getting Started with FM 0+ Development
2.2.3
Using a PDL Code Example
The PDL installation includes more than 100 code examples. Most peripherals have multiple examples. Each
example demonstrates the basic initialization and configuration for the peripheral. It includes a ReadMe file that
provides a description of what the example demonstrates, and how to use the example.
The Build and Run a PDL Project section of this document guides you step-by-step through the process of
configuring the PDL, building a project using an IDE, and running the code on the hardware, using a kit example.
To use the code example, you:
 Copy two files, main.c and pdl_user.h from the example folder into the template\source folder, replacing the
existing files of the same name.

Build and download the code to the target.
If you wish to restore the template to its initial state, copy the main.c and pdl_user.h files from the
template\source\backup folder into the template\source folder.
2.2.4
Writing Your Own Code Using the PDL
You typically begin with an existing project, like an example in a starter kit which already has the PDL files added,
project options set correctly, and peripherals selected for the example.
When developing firmware with PDL, you perform the following tasks:
 If necessary, modify project options in your IDE to target the correct device.




Specify the target device and package in pdl_device.h.
Configure the PDL in pdl_user.h.
Add your firmware in main.c, or additional source files as required.
Build and download the code to the target.
As noted, pdl_device.h, pdl_user.h and main.c are pre-defined in the code example. The project files for both IAR
and Keil tools use the PDL source code and these three files.
2.2.5
Other PDL Resources
The PDL User Quick Start Guide is installed with the PDL, in the doc folder.
API documentation is available in the doc\doxy path. Figure 2-1 shows the home page, index.html.
Figure 2-1. PDL Documentation
Refer to the FM0+ Family Resources section of this document for additional information.
www.cypress.com
Document No. 002-10985 Rev.**
5
Getting Started with FM 0+ Development
2.3
MCU Template Projects
An MCU template project does not include or use the PDL. A template project is a simple software framework
that serves as a starting point to develop any software (user applications, third-party algorithms, peripheral drivers,
or others) running on Cypress FM family microcontrollers. A template project contains startup files, the peripheral
header file, the GPIO header file, the system initialization file, the CMSIS System View Description (SVD) file,
and all IDE options set correctly such as those for the compiler, assembler, linker, and debugger.
There is a template project file for every FM0+ series. Unlike the PDL, which has a single IDE project file that you
configure for your target processor, a template project is already configured. However, the main() function
contains an empty loop. You write your own code to initialize, configure, and use any peripheral.
See the FM0+ Family Resources section for links to MCU template projects and additional code examples.
3
Build and Run a PDL Project
In this section you build and run an example PDL project, using either of these IDEs:
 IAR Embedded Workbench version 7.3 or later

Keil µVision , version 5 or later
These instructions use the FM0+ S6E1B8-Series Starter Kit shown in Figure 3-1, along with an example project
from that kit.
Figure 3-1. The S6E1B8-Series Starter Kit Board
www.cypress.com
Document No. 002-10985 Rev.**
6
Getting Started with FM 0+ Development
For either IDE you will perform three major tasks:
 Examine the IDE’s project options for your hardware.


Configure the PDL for your hardware.
Build and run the code example.
The example projects that come with a Starter Kit have project options set correctly, because the kit has a specific
processor. If you use an example project from a kit, you do not need to configure the IDE.
3.1
Before You Begin
Ensure that you have three items: hardware on which to run the code, the PDL, and a development environment.
Hardware
This application note uses the FM0+ S6E1B8-Series Starter Kit. If you prefer to use different hardware, you must
adapt the instructions as required.
PDL
If you do not have the PDL installed, see Getting and Installing the PDL.
These instructions assume the PDL is installed in the default location, Documents\Cypress.
Development Environment
Ensure that you have installed a development environment. These instructions cover:


Building with IAR Embedded Workbench
Building with Keil µVision
Because the kit has a particular processor, all project options are set correctly. There is a project for every code
example in the kit.
When targeting a different processor or board, you must update project options accordingly. The precise options,
and how to set them, vary based on your IDE. The PDL Quick Start Guide (installed with the PDL) addresses this
issue in detail. Among the project options you may need to update would be the target device, the linker
configuration file, and the flash loader file.
www.cypress.com
Document No. 002-10985 Rev.**
7
Getting Started with FM 0+ Development
3.2
Building with IAR Embedded Workbench
This section guides you through the steps required to build, download, and run a PDL project with IAR tools.
These instructions use the Descriptor System Transfer Controller (DSTC) example from the S6E1B8 starter kit.
This code creates a buffer in memory, initializes the values in that buffer, copies the data to a different location
using DTSC, and then verifies that the two buffers are identical.
1. Open the IAR workspace for the DSTC example.
The file name is s6e1b8_dstc.eww. In a default kit installation, the path to the file is:
Documents\Cypress\FM0+ S6E1B-Series Starter Kit\Firmware\Demo Projects\s6e1b8_dstc\IAR
Double-click the file, and the IAR Embedded Workbench IDE opens, as shown in Figure 3-2
Figure 3-2. Open the IAR Workspace for the DSTC Example
2. Configure the PDL for the target processor.
For this example you don’t need to do anything; the code already configures the PDL correctly. This step
ensures you are aware of how this works and what you need to do when developing your own project.
You specify the target processor in pdl_device.h.
A.
Open pdl_device.h.
Choose File > Open > File… and navigate to the Documents\Cypress\FM0+ S6E1B-Series Starter
Kit\Firmware\Demo Projects\s6e1b8_dstc folder. Locate the file and open it. It appears in the source
window.
B.
Examine the code.
Look for the code that defines the values of PDL_MCU_SERIES and PDL_MCU_PACKAGE.
At the time of this writing, the code at line 57 defines the series targeted in this example.
#define PDL_MCU_SERIES
PDL_DEVICE_SERIES_S6E1B8X
The code at line 68 defines the package targeted in this example.
#define PDL_MCU_PACKAGE
PDL_DEVICE_PACKAGE_S6_F
Note that the comments in the file also point you to the location where you can find the available
definitions.
C.
Close the file. You don’t need to make any changes.
www.cypress.com
Document No. 002-10985 Rev.**
8
Getting Started with FM 0+ Development
3. Configure PDL functionality.
For this example you don’t need to do anything; the code already configures the PDL correctly. This step
ensures you are aware of how this works and what you need to do when developing your own project.
You configure PDL functionality in pdl_user.h.
A.
Open pdl_user.h.
Use File > Open > File… and navigate to the Documents\Cypress\FM0+ S6E1B-Series Starter
Kit\Firmware\Demo Projects\s6e1b8_dstc folder. Locate the file and open it. The file appears in the source
window.
B.
Examine the contents of the file.
This file contains a long list of #define statements, one for each configurable feature of the PDL. To enable
a feature, you define it as PDL_ON. Otherwise it is PDL_OFF. Pertinent to this example, find the line of
code that sets PDL_PERIPHERAL_ENABLE_DSTC to the value PDL_ON. At the time of this writing, it
is at line 122 of the file.
// DSTC
#define PDL_PERIPHERAL_ENABLE_DSTC
C.
PDL_ON
Close the file. You don’t need to make any changes.
4. Connect the board to your PC.
If you have not already done so, follow the directions in the kit. Use the provided cable and connect to the
CN3 (CMSIS-DAP) port on the board. There are two similar ports side by side. If you’re not sure which to use,
refer to Figure 3-1.
When properly connected, LED3 Power on the board will be green.
5. Select the debug build for the project.
The debug build has options set to generate debugger symbols. You will use the debugger in subsequent
steps.
Click the Build drop-down menu and select debug. See Figure 3-3.
Figure 3-3. Select the Debug Build for the Project
www.cypress.com
Document No. 002-10985 Rev.**
9
Getting Started with FM 0+ Development
6. Download the code and launch the debugger.
Choose Project > Download & Debug.
The IDE compiles, links, downloads the code to the board, and launch the debugger. You should see no
warnings or errors. The program counter will be halted at the first line of main() as shown in Figure 3-4.
Figure 3-4. Debugger Halted at the main() Function
7. Initialize the source data buffer.
A.
Set a breakpoint as shown in Figure 3-5.
The code is: Dstc_SwTrigger(0u);
B.
Click the Go button. Execution halts at the breakpoint.
Figure 3-5. Break at Dstc_SwTrigger(0u);
C.
Observe the source data values in the Watch window.
In the Watch window, expand the array by clicking the + control next to au32SourceData to see the
contents of the buffer. The buffer will be full of data. See Figure 3-6.
www.cypress.com
Document No. 002-10985 Rev.**
10
Getting Started with FM 0+ Development
Figure 3-6. Contents of the Source Data Buffer
D.
Optional: Observe the destination data values.
The destination buffer is filled with zeros. If you want to confirm this, examine the contents of
au32DestinationData in the Watch window.
8. Use DSTC to copy the data to the destination data buffer.
A.
Choose Debug > Go or click the Go button as shown in Figure 3-7. The code will take a moment to
execute completely.
Figure 3-7. Click the Go Button to Run the Code
B.
Choose Debug > Break or click the Break button as shown in Figure 3-8.
Figure 3-8. Click the Break Button to Stop the Code
C.
Observe the values of au32DestinationData in the Watch window. They should match the contents of the
SourceData buffer.
The application used the DTSC peripheral to copy the data from the source buffer to the destination buffer. You
have successfully built a simple application using the PDL.
www.cypress.com
Document No. 002-10985 Rev.**
11
Getting Started with FM 0+ Development
3.3
Building with Keil µVision
This section guides you through the steps required to build, download, and run a project that uses the PDL. These
instructions use the DSTC example from the S6E1B8 starter kit. This code creates a buffer in memory, initializes
the values in that buffer, copies the data to a different location using DSTC, and then verifies that the two buffers
are identical.
1. Open the µVision project for the DSTC example.
The file name is s6e1b8_dstc.uvprojx. In a default kit installation, the path to the file is:
Documents\Cypress\FM0+ S6E1B-Series Starter Kit\Firmware\Demo Projects\s6e1b8_dstc\ARM
Double-click the file, and the µVision IDE opens, as shown in Figure 3-9.
Figure 3-9. Open the µVision project for the DSTC Example
2. Configure the PDL for the target processor.
For this example you don’t need to do anything; the code already configures the PDL correctly. This step
ensures you are aware of how this works and what you need to do when developing your own project.
You specify the target processor in pdl_device.h.
A.
Open pdl_device.h.
Choose File > Open > File… and navigate to the Documents\Cypress\FM0+ S6E1B-Series Starter
Kit\Firmware\Demo Projects\s6e1b8_dstc folder. It appears in the source window.
B.
Examine the code.
Look for the code that defines the values of PDL_MCU_SERIES and PDL_MCU_PACKAGE.
At the time of this writing, the code at line 57 defines the series targeted in this example.
#define PDL_MCU_SERIES
PDL_DEVICE_SERIES_S6E1B8X
The code at line 68 defines the package targeted in this example.
#define PDL_MCU_PACKAGE
PDL_DEVICE_PACKAGE_S6_F
Note that the comments in the file also point you to the location where you can find the available
definitions.
C.
Close the file. You don’t need to make any changes.
www.cypress.com
Document No. 002-10985 Rev.**
12
Getting Started with FM 0+ Development
3. Configure PDL functionality.
For this example you don’t need to do anything; the code already configures the PDL correctly. This step
ensures you are aware of how this works and what you need to do when developing your own project.
You configure PDL functionality in pdl_user.h.
A.
Open pdl_user.h.
Use File > Open > File… and navigate to the Documents\Cypress\FM0+ S6E1B-Series Starter
Kit\Firmware\Demo Projects\s6e1b8_dstc folder. Locate the file and open it. The file appears in the source
window.
B.
Examine the contents of the file.
This file contains a long list of #define statements, one for each configurable feature of the PDL. To enable
a feature, you define it as PDL_ON. Otherwise it is PDL_OFF. Pertinent to this example, find the line of
code that sets PDL_PERIPHERAL_ENABLE_DSTC to the value PDL_ON. At the time of this writing, it
is at line 122 of the file.
// DSTC
#define PDL_PERIPHERAL_ENABLE_DSTC
C.
PDL_ON
Close the file. You don’t need to make any changes.
4. Connect the board to your PC.
If you have not already done so, follow the directions in the starter kit. Use the provided cable and connect to
the CN3 (CMSIS-DAP) port on the board. There are two similar ports side by side. If you’re not sure which to
use, refer to Figure 3-1.
When properly connected, LED3 Power on the board will be green.
5. Select the debug build for the project.
The debug build has options set to generate debugger symbols. You will use the debugger in subsequent
steps.
Click the Build drop-down menu and select Debug. See Figure 3-10.
Figure 3-10. Select the Debug Build for the Project
6. Build the code.
Choose Project > Build Target.
The IDE compiles and links the code. You should see no warnings or errors.
www.cypress.com
Document No. 002-10985 Rev.**
13
Getting Started with FM 0+ Development
7. Download the code and launch the debugger.
Choose Debug > Start/Stop Debug Session.
The IDE downloads the code to the board and the debugger launches. The program counter will be stopped
at the first line of main() as shown in Figure 3-11.
Figure 3-11. Debugger Stopped at the main() Function
Note: If you get an error from the Keil IDE that it cannot load the flash description, this is easy to resolve. The
problem is that in your setup the IDE is missing a file. The kit has the necessary file.
In a default kit installation, path to the file is:
Documents\Cypress\FM0+ S6E1B-Series Starter Kit\Firmware\Demo Projects\s6e1b8_dstc\ARM\flashloader
The file name is S6E1B86XHA.FLM.
Copy this file to the correct place in the Keil tools. In a Keil installation, the path is:
<Installation-Path>\Keil_v5\ARM\Flash
Then repeat this step.
www.cypress.com
Document No. 002-10985 Rev.**
14
Getting Started with FM 0+ Development
8. Configure a Watch window.
In this step you open a Watch window in the debugger and add two arrays so you can watch what happens
as the code executes. Figure 3-12 shows the result.
A.
Add au32SourceData to the Watch window.
Double-click au32SourceData in the source code to select that variable name.
Right-click the selected variable name and choose Add ‘au32SourceData’ to > Watch 1.
B.
Add au32DestinationData.
Double-click the variable au32DestinationData. This selects just the variable name.
Right-click the selected variable name and choose Add ‘au32DestinationData’ to > Watch 1.
Figure 3-12. Configure a Watch Window
9. Initialize the source data buffer.
A.
Set a breakpoint as shown in Figure 3-13.
The code at that line is: Dstc_SwTrigger(0u);
B.
Click the Run button. Execution halts at the breakpoint.
Figure 3-13. Break at Dstc_SwTrigger(0u);
C.
Observe the source data values in the Watch window.
In the Watch window, expand the array by clicking the + control next to au32SourceData to see the
contents of the buffer. The buffer should be full of data. See Figure 3-14.
www.cypress.com
Document No. 002-10985 Rev.**
15
Getting Started with FM 0+ Development
Figure 3-14. Contents of the Source Data Buffer
D.
Optional: Observe the destination data values.
The destination buffer is filled with zeros. If you want to confirm this, examine the contents of
au32DestinationData in the Watch window.
10. Use DSTC to copy the data to the destination data buffer.
A.
Choose Debug > Run or click the Run button as shown in Figure 3-15. The code will take a moment to
execute completely.
Figure 3-15. Click the Run Button to Run the Code
B.
Choose Debug > Stop or click the Stop button as shown in Figure 3-16.
Figure 3-16. Click the Stop Button to Stop the Code
C.
Observe the values of au32DestinationData in the Watch window. They should match the contents of the
SourceData buffer.
The application used the DSTC peripheral to copy the data from the source buffer to the destination buffer.
You have successfully built a simple application using the PDL.
www.cypress.com
Document No. 002-10985 Rev.**
16
Getting Started with FM 0+ Development
4
Programming Embedded Flash
Most IDEs are capable of programming embedded flash. However, a flash programmer may be your preferred or
only solution in some cases. This section shows you how to program embedded flash using either a serial or a
USB connection. The USB connection requires USB support on the target.
These instructions target the board found in the FM0+ S6E1B8-Series Starter Kit. See Figure 3-1 for a key to the
components on the hardware.
If you are not using this kit, you must modify the instructions to fit your specific target hardware. Check the
documentation provided with your board for jumper configuration and other details.
4.1
Before You Begin
Ensure you have a programmer. These instructions cover the tools listed here.


FLASH MCU Programmer for FM0+/FM3/FM4
FLASH USB Direct Programmer
There are two ways to use these flash programmers: single step or automatic programming (full operation). Note
that only single step works for secured flash devices that need chip erase. In this example we use automatic
programming.
You also need a file to download. The file format must be either Motorola S-Record or Intel-HEX. The instructions
use a Motorola S-Record file provided with the kit.
When you build code in an IDE, you may be able to generate an S-Record or Intel-HEX format file. Consult the
documentation for your IDE. In IAR Embedded Workbench, use the Project > Options > Output Converter
panel. In Keil µVision, use the Project > Options for Target > Output panel.
4.2
Using the FLASH MCU Programmer
These instructions assume you have downloaded and installed the starter kit so you have access to the required
S-Record file. If not, locate an S-Record or Intel-HEX file, and use that file instead.
All FM0+ devices can be programmed by serial connection. There are two connectors on the S6E1B8-Series
Starter Kit Board. One is for the CMSIS-DAP programmer and debugger, the other for USB. Refer to Figure 3-1,
items 4 and 7 in the legend. Programming and debugging is realized by establishing a virtual COM port via USB
to the PC. This virtual COM port allows two independent channels. One is used for debugging and the other for
programming. In case of programming the USB communication is converted to serial data for the MCU’s MultiFunction Serial Interface (MFS).
1. Configure the jumpers.
Make sure the jumpers on the board are placed according to Table 4-1.
Table 4-1. Jumper Settings for S6E1B8 programming by FLASH MCU Programmer.
Jumper
Default
Program by Serial
Purpose
J1
Open
Open
Sets MB9AF312K (CMSIS-DAP) to run mode.
J2
Open
Closed
Sets S6E2GM to programming mode.
J3
Pin 1 to Pin 2
Pin 1 to Pin 2
Sets for UART programming mode.
J4
Pin 1 to Pin 2
Pin 1 to Pin 2
Get power from the CMSIS-DAP port
2. Provide power to the board.
Connect the USB cable to the CMSIS-DAP port (CN3). The Power LED (LED3) should be lit (green). See
Figure 3-1 for the location of the correct port.
3. Identify the COM port in use.
You need to know which COM port your board is connected to. You will use this number to configure the flash
programmer.
www.cypress.com
Document No. 002-10985 Rev.**
17
Getting Started with FM 0+ Development
If you don’t know the COM port, open the Device Manager and look for Ports (COM & LPT). You should see
an entry for FM-Link/CMSIS-DAP. The COM port is listed at the end of that entry, as shown in Figure 4-1.
Remember the number.
Figure 4-1. Identify the COM Port In Use
4. Launch the FLASH MCU Programmer.
You can do this from the Start menu, using this path:
Start Menu > All Programs > Cypress > FLASH MCU Programmer > FM0+ FM3 FM4
www.cypress.com
Document No. 002-10985 Rev.**
18
Getting Started with FM 0+ Development
5. Configure the programmer.
In this and the next step you configure the programmer for the target device. See Figure 4-2.
A.
Set Target MCU to S6E1B86E/F/G.
B.
Set Crystal Frequency to 4 MHz.
C.
Set Hex File to the file you wish to flash to the board.
For purposes of this example we use tp_fm-100l-s6e1b8.srec. This file restores the starter kit board to its
initial state.
In a default installation of the kit, the S-Record file is here:
Documents\Cypress\FM0+ S6E1B-Series Starter Kit\Firmware\Demo Projects\Test_Demo_Code
Figure 4-2. Configure the Programmer
6. Set the COM Port in the programmer.
A.
Click Set Environment.
B.
Set COM (1-256) to the value you saw in the Device Manager. See Figure 4-3.
Figure 4-3. Set the COM Port in the Programmer
www.cypress.com
Document No. 002-10985 Rev.**
19
Getting Started with FM 0+ Development
7. Program the Flash.
You will need to reset the board as it is programmed. See Figure 4-4 and Figure 4-5.
A.
Click Full Operation (D+E+B+P) to start programming. (Note: Full Operation does not work on secured
flash. You must use single steps.)
Figure 4-4. Click the Full Operation Button
The programming process begins, and a dialog window appears, as shown in Figure 4-5.
B.
Reset the board.
Press the reset switch (SW1) on the board, and then click OK.
Figure 4-5. Reset the Microcontroller
The programmer downloads the selected file to the board.
To confirm success, you can use the Serial Port Viewer tool (installed with the kit) to connect to the board and
run the demo code. Full instructions are in the starter kit guide. Click Help for any issues or errors encountered
during programming.
www.cypress.com
Document No. 002-10985 Rev.**
20
Getting Started with FM 0+ Development
4.3
Using the FLASH USB DIRECT Programmer
These instructions assume you have downloaded and installed the starter kit, so you have access to the required
S-Record file. If not, locate an S-Record or Intel-HEX file, and use that file instead. The USB connection requires
USB support on the target.
1.
Configure the jumpers.
Make sure the jumpers on the board are placed according to Table 4-2.
Table 4-2: Jumper Settings for S6E1B8 programming by FLASH USB DIRECT Programmer
Jumper
Default
Program by USB
Purpose
J1
Open
Open
Sets MB9AF312K (CMSIS-DAP) to run mode.
J2
Open
Closed
Sets S6E2GM to programming mode.
J3
Pin 1 to Pin 2
Pin 2 to Pin 3
Sets for USB programming mode.
J4
Pin 1 to Pin 2
Pin 2 to Pin 3
Get power from the USB port
2. Provide power to the board.
Connect the USB cable to the CN4 port. The Power LED (LED3) should be lit (green). See Figure 3-1 for the
location of the correct port.
3. Identify the COM Port in use.
You need to know which COM port your board is connected to. You will use this to configure the flash
programmer.
If you don’t know the COM port, open the Device Manager and look for Ports (COM & LPT). ). You should
see an entry for USBVCOM. The COM port is listed at the end of that entry, as shown in Figure 4-6.
Remember the number.
Figure 4-6. Identify the COM Port In Use
4. Launch the FLASH USB DIRECT Programmer.
You can do this from the Start menu, using this path:
Start Menu > All Programs > Cypress > FLASH USB DIRECT Programmer > USBDirect
www.cypress.com
Document No. 002-10985 Rev.**
21
Getting Started with FM 0+ Development
5. Configure the programmer.
In this step you set up the programmer for the target device. See Figure 4-7.
A.
Set Target MCU to S6E1B86E/F/G.
B.
Set Hex File to the file you wish to flash to the board.
For this example we use tp_fm-100l-s6e1b8.srec. This file restores the starter kit board to its initial state.
In a default installation of the kit, the S-Record file is here:
Documents\Cypress\FM0+ S6E1B-Series Starter Kit\Firmware\Demo Projects\Test_Demo_Code
Set COM (1-256) to the value you saw in the Device Manager.
Figure 4-7. Configure the Programmer
6. Program the Flash.
You will need to reset the board as it is programmed.
A.
Click Full Operation (D+E+B+P) button to start programming. (Note: Full Operation does not work on
secured flash. You must use single steps.)
The programming process begins, and a dialog window appears.
B.
Reset the board.
Press the reset switch (SW1) on the board, and then click OK, as shown in Figure 4-8.
You may need to do this more than once during the process.
Figure 4-8. Reset the Microcontroller
To confirm success, use the Serial Port Viewer tool (installed with the kit) to connect to the board and run the
demo code. Full instructions are in the starter kit guide.
www.cypress.com
Document No. 002-10985 Rev.**
22
Getting Started with FM 0+ Development
5
FM0+ Family Resources
Cypress provides many resources to help you learn about and become productive with the FM0+ family. Use
Table 5-1 to identify and choose the resource you want based on where you are in the design process.
Table 5-1. FM0+ Family Resources Navigator
I Want To
Resources
Read this document.
Explore the FM0+ product pages on the Cypress website.
Purchase an FM0+ Starter Kit.
Evaluate FM0+
FM0+ S6E1A1 MCU Evaluation Board
FM0+ S6E1B8 MCU Starter Kit
FM0+ S6E1C3-Series Starter Kit
Refer to FM0+ Datasheets.
Read AN202487 - Differences Among FM0+, FM3, and FM4 Families
Select an FM Part
Download and review the Product Selector Guide.
Read AN202487 - Differences Among FM0+, FM3, and FM4 Families
Visit the FM0+ Support Tools page.
Learn About
Available Tools
Visit the FM Ecosystem page. Follow the links to learn about partners who provide IDEs,
compilers, debuggers, operating systems, middleware, boards, training, and more. Some items
may not apply to FM0+
Purchase an FM0+ Starter Kit that installs and uses the PDL.
FM0+ S6E1B8 MCU Starter Kit
FM0+ S6E1C-Series Starter Kit
Learn About the
Peripheral Driver Library
Read the Peripheral Driver Library Overview in this document.
Download the PDL. See Getting and Installing the PDL in this document.
Review the PDL Quick Start Guide, installed as part of the PDL.
Work with the 100+ code examples included with the PDL
Refer to FM0+ Datasheets.
Use the FM0+ Peripheral Manuals as a technical reference.
Get a template project as a starter for development
Visit the FM0+ S6E1A1 MCU Evaluation Board page for a template project and code examples.
Develop Software
Without Using the PDL
Search for an FM0+-related application note. Some examples include:
AN205411 - FM0+ IEC60730 Class_B Self-Test Library
AN202483 - FM0+ S6E1A1 Series MCU Low-Voltage 3-Phase BLDC and PMSM Control
AN99218 - Multi Function Serial Interface of FM MCU
AN99231 - Using Interrupts in FM0+ Family S6E1C3 Series
Get a Flash programmer.
FLASH MCU Programmer for FM0+/FM3/FM4
FLASH USB DIRECT Programmer
Learn About Flash
Programming
Read the Programming Embedded Flash section of this document.
Read the Flash Programming Manual for your FM0+ series:
S6E1Ax
S6E1Bx
S6E1Cx
Read AN204438 - How to Setup Flash Security for FM0+, FM3 and FM4 Families
www.cypress.com
Document No. 002-10985 Rev.**
23
Getting Started with FM 0+ Development
About the Author
Name:
James Trudeau
Title:
Senior Application Engineer
Background:
Jim Trudeau started at Cypress in 2015, continuing a long career in technical
support, technical communication, and developer relations in the software tools and
semiconductor industry.
Document History
Document Title: AN210985 - Getting Started with FM0+ Development
Document Number: 002-10985
Revision
**
www.cypress.com
ECN
5132964
Orig. of
Change
JETT
Submission
Date
2016-02-10
Description of Change
New Application Note.
Document No. 002-10985 Rev.**
24
Getting Started with FM 0+ Development
Worldwide Sales and Design Support
Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To
find the office closest to you, visit us at Cypress Locations.
PSoC® Solutions
Products
ARM® Cortex® Microcontrollers
cypress.com/arm
cypress.com/psoc
Automotive
cypress.com/automotive
PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP
Clocks & Buffers
cypress.com/clocks
Cypress Developer Community
Interface
cypress.com/interface
Lighting & Power Control
cypress.com/powerpsoc
Memory
cypress.com/memory
PSoC
cypress.com/psoc
Touch Sensing
cypress.com/touch
USB Controllers
cypress.com/usb
Wireless/RF
cypress.com/wireless
Community | Forums | Blogs | Video | Training
Technical Support
cypress.com/support
PSoC is a registered trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property
of their respective owners.
Cypress Semiconductor
Phone
: 408-943-2600
198 Champion Court
Fax
: 408-943-4730
San Jose, CA 95134-1709
Website : www.cypress.com
© Cypress Semiconductor Corporation, 2016. The information contained herein is subject to change without notice. Cypress Semiconductor
Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply
any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical
control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products
for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to
the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in
doing so indemnifies Cypress against all charges.
This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to
worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to
licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source
Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in
conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or
representation of this Source Code except as specified above is prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of
the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in lifesupport systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’
product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against
all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.
www.cypress.com
Document No. 002-10985 Rev.**
25