UM1853 User manual. STM32CubeF1 Nucleo demonstration firmware. Introduction

Similar documents
Getting started with X-CUBE-LED channel LED driver software expansion based on LED1642GW for STM32Cube

Getting started with the X-CUBE-IKA02A1 multifunctional software expansion for STM32Cube

UM2045 User manual. Getting started with the X-CUBE-NFC3 near field communication transceiver software expansion for STM32Cube.

Getting started with the X-CUBE-NFC5 high performance HF reader / NFC initiator IC software expansion for STM32Cube

AN4624 Application note

NUCLEO-L496ZG. STM32 Nucleo-144 board. Features. Description

Getting started with the X-CUBE-53L1A1 Time-of-Flight long distance ranging sensor software expansion for STM32Cube

UM2204. Getting started with STM32CubeH7 for STM32H7 Series. User manual. Introduction

P-NUCLEO-USB001. STM32 Nucleo pack for USB Type-C and Power Delivery. Features. Description

NUCLEO-L433RC-P NUCLEO-L452RE-P

Getting started with the STM32 Nucleo pack for USB Type-C and Power Delivery with the Nucleo-F072RB board and the STUSB1602

32F412GDISCOVERY. Discovery kit with STM32F412ZG MCU. Features. Description

P-NUCLEO-USB001. STM32 Nucleo pack for USB Type-C and Power Delivery Data brief. Features. Description

Bluetooth low energy profiles for the X-CUBE-BLE1 expansion for STM32Cube. Description

UM1727 User manual. Getting started with STM32 Nucleo board software development tools. Introduction

STM32L4R9I-EVAL. Evaluation board with STM32L4R9AI MCU. Features

Getting started with the STSW-BCNKT01 software package for STEVAL-BCNKT01V1 based on STM32Cube

USB Type-C and Power Delivery Nucleo pack with NUCLEO-F072RB expansion board based on STUSB1602. Description

Getting started with the software package for STEVAL-STLKT01V1 based on STM32Cube

STSW-BLUENRG1-DK. BlueNRG-1, BlueNRG-2 DK SW package

Getting started with the software package for L6474 stepper motor driver X-CUBE-SPN1 expansion for STM32Cube

Getting started with the FP-NET-6LPBLE1 function pack for 6LoWPAN IoT node connection to a smartphone via BLE interface

USB Type-C and Power Delivery Nucleo pack with NUCLEO-F072RB expansion board based on the STUSB1602

Getting started with the FP-IND-PLCWIFI1 function pack for PLC management via Wi-Fi

UM2051 User manual. Getting started with the STM32 Nucleo pack for USB Type-C and Power Delivery. Introduction

32F469IDISCOVERY. Discovery kit with STM32F469NI MCU. Features. Description

UM1754 User manual. Getting started with STM32CubeL0 firmware package for STM32L0 series. Introduction

Getting started with the X-CUBE-SPN3 high power stepper motor driver software expansion for STM32Cube

Getting started with the FP-SNS-ALLMEMS1 Bluetooth low energy and sensors software expansion for STM32Cube

Getting started with STEVAL-IDB007V1 and STEVAL-IDB008V1 evaluation boards

32F746GDISCOVERY. Discovery kit with STM32F746NG MCU. Features. Description

Getting started with the X-CUBE-SPN2 two-axis stepper motor driver software expansion for STM32Cube

STM32H7x3I-EVAL. Evaluation board with STM32H7x3XI MCUs. Data brief. Features

How to upgrade the firmware on the STEVAL-USBC2DP USB Type-C to DisplayPort adapter

Getting started with MotionPM real-time pedometer library in X CUBE-MEMS1 expansion for STM32Cube

EVALKITSTKNX. Miniature transceiver STKNX evaluation and development kit. Features

32L476GDISCOVERY. Discovery kit with STM32L476VG MCU. Features. Description

Getting started with VL53L0X ranging and gesture detection sensor software expansion for STM32Cube

Getting started with MotionPM real-time pedometer library in X-CUBE-MEMS1 expansion for STM32Cube

Getting started with the X-CUBE-MEMS1 motion MEMS and environmental sensor software expansion for STM32Cube

Quick Start Guide. Stepper motor driver expansion board based on L6474 for STM32 Nucleo (X-NUCLEO-IHM01A1) Version 1.

UM1862 User manual. Getting started with STM32F411E Discovery software Development Tools. Introduction

Getting started with X-NUCLEO-IHM06A1 low voltage stepper motor driver expansion board based on STSPIN220 for STM32 Nucleo

Getting started with osxmotiongc gyroscope calibration library for X-CUBE-MEMS1 expansion for STM32Cube

UM2350. Getting started with MotionPW real-time pedometer for wrist library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

Getting started with the digital MEMS microphone expansion board based on MP34DT01-M for STM32 Nucleo

UM2276. Getting started with MotionSD standing vs sitting desk detection library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

X-NUCLEO-53L1A1. Long distance ranging Time-of-Flight sensor expansion board based on VL53L1X for STM32 Nucleo. Description.

STM32SnippetsL0. STM32L0xx Snippets firmware package. Features. Description

UM1677 User manual. Getting started with STM32F030 Value Line Discovery development tools. Introduction

UM2216 User manual. Getting started with MotionFA fitness activity library in X CUBE MEMS1 expansion for STM32Cube. Introduction

UM1730 User manual. Getting started with STM32CubeF4 firmware package for STM32F4 Series. Introduction

Getting started with the software package for digital MEMS microphones in X-CUBE-MEMSMIC1 expansion for STM32Cube

UM2194. Getting started with MotionAW activity recognition for wrist library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

Quick Start Guide. Stepper motor driver expansion board based on L6474 for STM32 Nucleo (X-NUCLEO-IHM01A1) Version 1.2.

TN1235 Technical note

AN4749 Application note

Getting started with MotionAR activity recognition library in X-CUBE-MEMS1 expansion for STM32Cube

EVLKSTCOMET10-1. STCOMET smart meter system-on-chip development kit. Features

IoT node with BLE connectivity, digital microphone, environmental and motion sensors, motion and audio middleware libraries.

DT0095 Design tip. Datalogging the SensorTile through a PC. Purpose and benefits. Description

Getting started with X-NUCLEO-53L1A1 long distance ranging ToF sensor expansion board based on VL53L1X for STM32 Nucleo

Getting started with MotionAR activity recognition library in X-CUBE-MEMS1 expansion for STM32Cube

Getting started with FP-SNS-6LPNODE1 software for IoT sensor node connection to 6LoWPAN networks using sub-1ghz RF

X-NUCLEO-53L0A1. Ranging and gesture detection sensor expansion board based on VL53L0X for STM32 Nucleo. Description. Features

STSW-BNRGUI. BlueNRG GUI SW package. Data brief. Features. Description

Getting started with MotionMC magnetometer calibration library in X-CUBE-MEMS1 expansion for STM32Cube

External memory code execution on STM32F7x0 Value line and STM32H750 Value line MCUs

Getting started with osxacousticsl real-time sound source localization software expansion for STM32Cube

UM2084 User manual. Getting started with the ultra-low-power STM32 and LoRa Nucleo pack. Introduction

UM2255 User manual. SPC58NG-DISP user manual. Introduction

Running a simple 6LowPAN network consisting of one receiver node and one or more sensor nodes in a Sub-1GHz RF band

P-NUCLEO-53L1A1. VL53L1X nucleo pack with X-NUCLEO-53L1A1 expansion board and STM32F401RE nucleo board. Description. Features

Getting started with osxmotionmc magnetometer calibration library for X-CUBE-MEMS1 expansion for STM32Cube

Getting started with the X-NUCLEO-IHM14A1 stepper motor driver expansion board based on STSPIN820 for STM32 Nucleo

UM1754. Getting started with STM32CubeL0 for STM32L0 Series. User manual. Introduction

X-NUCLEO-53L0A1 ranging and gesture detection sensor expansion board based on VL53L0X for STM32 Nucleo

UM2192. Getting started with MotionMC magnetometer calibration library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

Dynamic Electro-Thermal simulator for VIPower products. Description

Description. July 2016 DocID Rev 2 1/6

ST25DV-DISCOVERY. Discovery kit for the ST25DV04K dynamic NFC/RFID tag. Features

Getting started with the ultra-low-power STM32 and LoRa Nucleo pack

Sub-1 GHz RF expansion board based on the SPSGRF-868 module for STM32 Nucleo. Description

UM2495. High performance HF reader / NFC initiator IC software expansion for NUCLEO-8S208RB. User manual. Introduction

RN0084 Release note. ST-LINK/V2 firmware upgrade. About this release note

This manual provides information for the final user application developer on how to use SPC57S-Discovery microcontroller evaluation board.

Description. January 2019 DB2381 Rev 3 1/5

Getting started with the high power stepper motor driver expansion board based on powerstep01 for STM32 Nucleo

AN4515 Application note

Kinetis SDK v Release Notes for KV5x Derivatives

UM2343 Application note

UM2092 User manual. Basic metrology firmware for the STM32F103RD and the STPM32 devices. Introduction

Quick Start Guide. Bipolar stepper motor driver expansion board based on L6208 for STM32 Nucleo (X-NUCLEO-IHM05A1) Version 1.1.

AN4782 Application note

Getting started with software and firmware environments for the

AN4311 Application note

STM3220G-SK/KEI. Keil starter kit for STM32F2 series microcontrollers (STM32F207IG MCU) Features. Description

L9958 Evaluation board for high current (8.6A) DC and Stepper Motors. Description

Quick Start Guide. High power stepper motor driver expansion board based on powerstep01 for STM32 Nucleo (X-NUCLEO-IHM03A1)

Motor control power board based on the SLLIMM-nano 2 nd series

Transcription:

User manual STM32CubeF1 Nucleo demonstration firmware Introduction STMCube initiative was originated by STMicroelectronics to ease developers life by reducing development efforts, time and cost. STM32Cube covers STM32 portfolio. STM32Cube Version 1.x includes: The STM32CubeMX, a graphical software configuration tool that allows to generate C initialization code using graphical wizards. A comprehensive embedded software platform, delivered per series (such as STM32CubeF1 for STM32F1 series) The STM32CubeF1 HAL, an STM32 abstraction layer embedded software, ensuring maximized portability across STM32 portfolio A consistent set of middleware components such as RTOS, USB, TCP/IP, FatFS and Graphics All embedded software utilities coming with a full set of examples. The STM32CubeF1 Nucleo Demonstration platform is built around the STM32Cube HAL, BSP and FatFs middleware component and uses almost the whole STM32 capability to load and display full color bitmaps from a microsd card. February 2015 DocID027336 Rev 1 1/19 www.st.com

Contents UM1853 Contents 1 STM32CubeF1 main features.................................. 5 2 Getting started with the demonstration......................... 6 2.1 Hardware requirements....................................... 6 2.1.1 STM32F103 Nucleo board.................................... 6 2.1.2 Adafruit TFT shield......................................... 7 2.2 Hardware configuration....................................... 8 2.2.1 STM32 Nucleo board configuration............................. 8 2.2.2 Assembling the Adafruit shield................................ 9 3 Demonstration firmware package............................. 10 3.1 Demonstration repository..................................... 10 3.2 Nucleo board BSP...........................................11 3.2.1 Joystick................................................. 11 3.2.2 LCD.................................................... 12 3.2.3 MicroSD................................................. 12 4 Demo functional description................................. 13 4.1 Programming firmware application.............................. 16 5 FAQs..................................................... 17 6 Revision history........................................... 18 2/19 DocID027336 Rev 1

List of tables List of tables Table 1. Bitmap image properties................................................... 13 Table 2. Document revision history................................................. 18 DocID027336 Rev 1 3/19 3

List of figures UM1853 List of figures Figure 1. STM32Cube block diagram................................................. 5 Figure 2. STM32F103 Nucleo board.................................................. 7 Figure 3. Adafruit 1.8 TFT shield.................................................... 8 Figure 4. Assembling the Adafruit 1.8 TFT shield........................................ 9 Figure 5. Folder structure.......................................................... 10 Figure 6. Nucleo BSP architecture................................................... 11 Figure 7. Demonstration application menu............................................ 13 Figure 8. Reading the Adafruit shield Joystick.......................................... 14 Figure 9. Demonstration application error messages.................................... 15 Figure 10. Demonstration running.................................................... 15 4/19 DocID027336 Rev 1

STM32CubeF1 main features 1 STM32CubeF1 main features STM32CubeF1 gathers, in a single package, all the generic embedded software components required to develop an application on STM32F1 microcontrollers. In line with the STMCube initiative, this set of components is highly portable, not only within STM32F1 series but also to other STM32 series. STM32CubeF1 is fully compatible with STM32CubeMX code generator that allows to generate initialization code. The package includes a low-level hardware abstraction layer (HAL) that covers the microcontroller hardware, together with an extensive set of examples running on STMicroelectronics boards. The HAL is available in open-source BSD license for user convenience. STM32CubeF1 package also contains a set of middleware components with the corresponding examples. They come in free user-friendly license terms: Full USB Host and Device stack supporting many classes. Host Classes: HID, MSC, CDC, Audio, MTP Device Classes: HID, MSC, CDC, Audio, DFU. STemWin, a professional graphical stack solution available in binary format and based on STMicroelectronics partner solution SEGGER emwin CMSIS-RTOS implementation with FreeRTOS open source solution FAT File system based on open source FatFS solution TCP/IP stack based on open source LwIP solution. Several applications and demonstrations implementing all these middleware components are also provided in the STM32CubeF1 package. The block diagram of STM32Cube is shown in Figure 1: STM32Cube block diagram. Figure 1. STM32Cube block diagram DocID027336 Rev 1 5/19 18

Getting started with the demonstration UM1853 2 Getting started with the demonstration 2.1 Hardware requirements The hardware requirements to start the demonstration application are as follows: STM32F103 Nucleo board Adafruit 1.8" TFT shield with Joystick and microsd (reference ID: 802) one 'USB type A to Mini-B' cable to power up the STM32 Nucleo board from the USB ST-LINK (USB connector CN1) a Standard Capacity SD card (SDSC) with a capacity up to 4GBytes. 2.1.1 STM32F103 Nucleo board The STM32 Nucleo board is a low-cost and easy-to-use development kit, to quickly evaluate and start some development with ARM 32-bit Cortex -M microcontrollers of the STM32 series. Before installing and using the product, accept the Evaluation Product License Agreement available at www.st.com/epla. For more information on the STM32 Nucleo board visit www.st.com/stm32nucleo. 6/19 DocID027336 Rev 1

Getting started with the demonstration Figure 2. STM32F103 Nucleo board 2.1.2 Adafruit TFT shield The STM32 Nucleo board supports Arduino connectivity. This Adafruit 1.8" TFT shield may be found on the Adafruit website (reference ID 802) with the following features: DocID027336 Rev 1 7/19 18

Getting started with the demonstration UM1853 one 1.8 TFT display with 128x160 color pixels one microsd card interface slot one 5-way joystick navigation switch (left, right, up, down, select). Figure 3. Adafruit 1.8 TFT shield Note: This shield is just an example of Arduino shield usage; more details are available on Adafruit website. 2.2 Hardware configuration In addition to gathering the hardware, follow the recommendations below, to start using the Adafruit 1.8 TFT shield with the STM32 Nucleo board. 2.2.1 STM32 Nucleo board configuration Check jumpers positions on the STM32 Nucleo board as follows: JP1 OFF JP5 (PWR) on U5V side ON JP6 (I DD ) ON. 8/19 DocID027336 Rev 1

Getting started with the demonstration 2.2.2 Assembling the Adafruit shield The Adafruit TFT shield comes with all surface mount parts pre-soldered. User can install the headers following the next steps: Cut the breakaway header strip into sections, to fit the holes on the edge of the shield: two sections of 6 pins and two other sections of 8 pins are needed. To align the header strips for soldering, insert them (long pins down) into the headers of the STM32 Nucleo board using the connectors CN5, CN6, CN8 and CN9. Place the shield over the header strips so that the short pins stick up through the holes. Solder on each pin of the header onto the shield PCB to ensure good electrical contact. The sequence is shown in Figure 4: Assembling the Adafruit 1.8 TFT shield. Figure 4. Assembling the Adafruit 1.8 TFT shield DocID027336 Rev 1 9/19 18

Demonstration firmware package UM1853 3 Demonstration firmware package 3.1 Demonstration repository The Nucleo demonstration is provided within the STM32CubeF1 firmware package, as shown in Figure 5: Folder structure. Figure 5. Folder structure The demonstration sources are located in the projects folder of the STM32Cube package for the STM32F103RB Nucleo boards.the sources are divided into five groups described as follows: 1. Binary: demonstration binary file in Hex format 2. Inc: contains the demonstration header files 3. Src: contains the demonstration source files 4. Project settings: a folder per toolchain containing the project settings and the linker files. 10/19 DocID027336 Rev 1

Demonstration firmware package 3.2 Nucleo board BSP For each board, a set of Button, LED and Joystick drivers is available within the stm32f1xx_nucleo.c/.h files, implementing the board capabilities and the bus link mechanism. Figure 6. Nucleo BSP architecture 3.2.1 Joystick 3.2.2 LCD The 5-way joystick on the shield is based on a resistor trick to permit all the switches to share one analog pin. Each movement of the joystick control connects a different resistor and results in a different voltage reading. The ADC peripheral is configured within the stm32f1xx_nucleo.c/.h driver in order to get analog voltage values through the analog I/O pin 3. The BSP_JOY_GetState() function reads the analog pin and compares the result with 5 different ranges to determine in which direction (if any) the stick has been moved (left, right, up, down, select). The LCD available on the Adafruit 1.8" TFT shield uses 4-wire SPI to communicate with the STM32F1 chip (Digital I/O pins 13, 11, 10 and 8) and has its own pixel-addressable frame buffer to display text, shapes, lines, pixels, etc. DocID027336 Rev 1 11/19 18

Demonstration firmware package UM1853 3.2.3 MicroSD The SPI peripheral is configured within the stm32f1xx_nucleo.c/.h driver which contains also the SPI bus link mechanism and IO operations. The LCD is controlled by a dedicated BSP LCD driver stm32_adafruit_lcd.c/.h which uses the st7735 component that exports in a generic way the LCD IO operations needed for its process. The microsd slot available on the Adafruit 1.8" TFT shield uses 4-wire SPI to communicate with the STM32F1 chip (Digital I/O pins 13, 12, 11 and 4). The SPI peripheral is configured within the stm32f1xx_nucleo.c/.h driver which contains also the SPI bus link mechanism and IO operations. The microsd is controlled by a dedicated BSP SD driver stm32_adafruit_sd.c/.h which exports in a generic way the SD IO operations needed for its process. 12/19 DocID027336 Rev 1

Demo functional description 4 Demo functional description In this demonstration application, we will show how to use the STM32CubeF1 firmware package with the NUCLEO-F103RB board and the Adafruit 1.8 TFT shield to display a 128x160 pixel full color bitmap from a microsd card using the FatFS file system. To start with this demonstration application, user has to copy the provided 128x160 pixel bitmap pictures, available within the FW package under \Media folder, to the root directory of a FAT formatted microsd card and insert the microsd card into the Adafruit shield microsd holder. Note that the microsd card can have a storage capacity up to 4GBytes (SDSC) and that the bitmap images must have the properties detailed in Table 1: Bitmap image properties. Table 1. Bitmap image properties Dimensions 128 x 160 Width Height Bit depth 16 Item type Name 128 pixels 160 pixels BMP file Must not exceed 11 characters (including bmp extension). Once started, the application checks the availability of Adafruit 1.8" TFT shield on top of STM32 Nucleo board. This is done by reading the state of IO PB.00 pin (mapped to Joystick available on the shield). If the state of PB.00 is high then the shield is available. If the Adafruit 1.8" TFT shield is not available, the LED2 is toggling with a frequency equal to ~1Hz. A second press on the User button lets LED2 toggling with a second frequency equal to ~5Hz. The third press, changes LED2 toggling frequency to ~10Hz. The described process is done in an infinite loop. If the Adafruit 1.8" TFT shield is available, LED2 is turned ON, because it's sharing the same pin with the SPI CLK signal used to communicate with the LCD and microsd available on the shield. A menu is displayed on Adafruit 1.8" TFT describing the demonstration application, as shown in Figure 7: Demonstration application menu. Figure 7. Demonstration application menu DocID027336 Rev 1 13/19 18

Demo functional description UM1853 User has to follow the instructions below: Press the Joystick DOWN to continue menu display (see Figure 8: Reading the Adafruit shield Joystick) Choose one of the available display modes (manual and automatic) using the Joystick button: Automatic mode: by pressing Joystick DOWN The bitmap images available on the microsd card are displayed sequentially in a forever loop. Manual mode: by pressing Joystick UP The bitmap images available on the microsd card are displayed by pressing Joystick RIGHT to display next images, or Joystick LEFT to display previous one. Pressing long (~1s) the Joystick SEL, switches the display mode from manual to automatic. Figure 8. Reading the Adafruit shield Joystick Note that the application manages some errors (refer to Figure 9: Demonstration application error messages), that can occur during the access to microsd card to load the bitmap images: If the microsd card is not FAT formatted, a message will be displayed on TFT. In this case, format the microsd card and put into its root directory the bmp files available within the FW package under \Media folder. If the content of the microsd card is other than a bitmap file, a message will be displayed on TFT mentioning that it is not supported. User has to ensure that the files, available under the microsd card root directory, are respecting the above described bitmap properties. 14/19 DocID027336 Rev 1

Demo functional description Figure 9. Demonstration application error messages Figure 10. Demonstration running DocID027336 Rev 1 15/19 18

Demo functional description UM1853 4.1 Programming firmware application To program the STM32 Nucleo board with the demonstration application, proceed as follows: 1. Install the preferred Integrated Development Environment (IDE) 2. Install the ST-LINK/V2.1 driver available on ST website. There are two ways of programming the STM32 Nucleo board: Method 1: Upload the STM32CubeF1_Demo_Nucleo.hex from the firmware package available under: Projects\STM32F103RB-Nucleo\Demonstrations\Binary using the user s preferred in-system programming tool. Method 2: Choose one of two supported tool chains (IAR / Keil /Atollic ) and follow the steps below: Open the application folder: Projects\STM32F103RB-Nucleo\Demonstrations\ Chose the desired IDE project (EWARM for IAR, MDK-ARM for Keil and TrueSTUDIO for Atollic) Double click on the project file (for example Project.eww for EWARM) Rebuild all files: Go to Project and select Rebuild all Load the project image: Go to Project and select Debug Run the program: Go to Debug and select Go. The demonstration software as well as other software examples that allow user to discover the STM32 microcontroller features, are available on ST website at www.st.com/stm32nucleo. 16/19 DocID027336 Rev 1

FAQs 5 FAQs How can I use this application to display my own images? Use any image editing tool and crop your image to no larger than 160 pixels high and 128 pixels wide. Save it as a 16-bit color BMP format file. Can I display more bitmap files? Yes. You can display more pictures, by copying them under the microsd root directory. Just modify the define value of MAX_BMP_FILES constant to the desired number of files. In this case, you must fine tune the _FS_LOCK value, defining the number of files that can be opened simultaneously, under ffconf.h the FatFs configuration file. What about putting the bitmap files not under the root directory of the microsd? Once put under another folder different from the root directory, the bitmap files cannot be accessed by the demonstration application. The File type not supported error message is displayed on the LCD. To make it work you have to add the new directory path within f_open() and f_opendir() FatFs APIs calls under the fatfs_storage.c file. DocID027336 Rev 1 17/19 18

Revision history UM1853 6 Revision history Table 2. Document revision history Date Revision Changes 06-Feb-2015 1 Initial release. 18/19 DocID027336 Rev 1

IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. 2015 STMicroelectronics All rights reserved DocID027336 Rev 1 19/19 19