STM32 Ecosystem workshop. T.O.M.A.S Team

Similar documents
STM32 Ecosystem Workshop. T.O.M.A.S Team

STM32 Ecosystem workshop. T.O.M.A.S Team

STM32 Ecosystem workshop. T.O.M.A.S Team

UART and new board introduction

Hands-On with STM32 MCU Francesco Conti

STM32SnippetsL0. STM32L0xx Snippets firmware package. Features. Description

Debugging in AVR32 Studio

LABORATORIO DI ARCHITETTURE E PROGRAMMAZIONE DEI SISTEMI ELETTRONICI INDUSTRIALI

DAVE 3 Hands on / Quick Start Tutorial. Presentation Tutorial Start 1 v1.1: Creating a simple Project using PWM and Count Apps

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

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

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

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

Codewarrior for ColdFire (Eclipse) 10.0 Setup

M16C/62P QSK QSK62P Plus Tutorial 1. Software Development Process using HEW4

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

The board contains the connector for SWD bus to implement SWD method of programming. Fig. K190 VDD 2 GND 4

XNUCLEO-F030R8, Improved STM32 NUCLEO Board

Section 2: Getting Started with a FPU Demo Project using EK-LM4F232

IAR EWARM Quick Start for. Holtek s HT32 Series Microcontrollers

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

Resource 2 Embedded computer and development environment

STM32F4 Labs. T.O.M.A.S Technically Oriented Microcontroller Application Services V1.07

SKP16C26 Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, May 2018

Create and Debug a CCSv5.5 Project for DSK6713- or DUETT-Board1

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

BASICS OF THE RENESAS SYNERGY TM

A Tutorial for ECE 175

6L00IA - Introduction to Synergy Software Package Short Version (SSP v1.2.0) Renesas Synergy Family - S7 Series

Tools Basics. Getting Started with Renesas Development Tools R8C/3LX Family

STM32F3 Hands-On Workshop

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

Start a New Project with Keil MDK-ARM Version 5 and ST Micro Nucleo-F446RE

Keil TM MDK-ARM Quick Start for. Holtek s HT32 Series Microcontrollers

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

ATOLLIC TRUESTUDIO FOR STM32 QUICK START GUIDE

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

Migrating from CubeSuite+ to Eclipse RL78 Family

Tools Overview. Evaluation Boards Free IDEs. Ecosystem. AC6 CoIDE Keil (M0/M0+) mbed

Note that FLIP is an Atmel program supplied by Crossware with Atmel s permission.

BASICS OF THE RENESAS SYNERGY TM

Exercise: PWM Generation using the N2HET

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Figure 1. Simplicity Studio

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

Quick Start Guide TWR-S08PT60. 5-Volt S08P Family of 8-bit MCUs for Industrial and Appliance Applications TOWER SYSTEM

Red Suite 4 Getting Started. Applies to Red Suite 4.22 or greater

Eclipse CDT Tutorial. Eclipse CDT Homepage: Tutorial written by: James D Aniello

AndeSight. User Manual. Working with AndESLive. Version 1.0

You have a PC with a USB interface, running Microsoft Windows XP (SP2 or greater) or Vista You have the Workshop Installation Software Flash Drive

Section Objective: Acquaint with specifications of Launchpad Acquaint with location of switches, LEDs, power-on switch, powering the board.

Installation and Quick Start of isystem s winidea Open in DAVE. Tutorial Version 1.0, May, 2014

MEM MEM Control Applications of DSP. Lab 2. Project Creating & GPIO DSP28355 & CCSv5

Floating-Point Unit. Introduction. Agenda

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005

Parallel Debugging. ª Objective. ª Contents. ª Learn the basics of debugging parallel programs

Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015.

Welcome to this presentation of the STM32 direct memory access controller (DMA). It covers the main features of this module, which is widely used to

Project Debugging with MDK-ARM

ECE 5655/4655 Laboratory Problems

BASICS OF THE RENESAS SYNERGY PLATFORM

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench

Engineer-to-Engineer Note

AD5669R - Microcontroller No-OS Driver

BASICS OF THE RENESAS SYNERGY PLATFORM

C Programming in Atmel Studio 7 Step by Step Tutorial

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

ECE QNX Real-time Lab

Programming in the MAXQ environment

TWR-KV10Z32 Sample Code Guide for IAR Board configuration, software, and development tools

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

Using Code Composer Studio IDE with MSP432

Code::Blocks Student Manual

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

LDC1000 SENT Bridge MSP-EXP430F5529LP based Getting Started

Installing and using CW 10.6 for TPMS applications. Revision 4

Processor Expert Software RAppID Suite Overview

Nios II Studio Help System

NUCLEO-L433RC-P NUCLEO-L452RE-P

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Hibernation Module. Introduction. Agenda

Changing the Embedded World TM. Module 3: Getting Started Debugging

Using Virtual EEPROM and Flash API for Renesas MCUs RX600 Series

AURIX family and AUDO Future, AUDO MAX

User Manual. LPC-StickView V3.0. for LPC-Stick (LPC2468) LPC2478-Stick LPC3250-Stick. Contents

Freescale Semiconductor Inc. Vybrid DS-5 Getting Started Guide Rev 1.0

Installing and using CW 10.x for TPMS applications. Revision 5

Code Composer Studio. MSP Project Setup

TriCore Free Entry Tool Chain. AURIX family and AUDO Future, AUDO MAX

CodeWarrior Development Studio for etpu v10.x Quick Start SYSTEM REQUIREMENTS

Getting Started in C Programming with Keil MDK-ARM Version 5

ATOLLIC TRUESTUDIO FOR ARM QUICK START GUIDE

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

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

L2 - C language for Embedded MCUs

QNX Software Development Platform 6.6. Quickstart Guide

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

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

The NetBeans Debugger: A Brief Tutorial

Transcription:

STM32 Ecosystem workshop T.O.M.A.S Team

2 Now, to complete our task, we have to Switch to SW4STM32 for some software modification Compile the code with added new features Run the code on NUCLEO-L476RG board using SW4STM32

Our goals for this session 3 How to migrate the project between two different microcontrollers: Importing STM32CubeMX project Running automatic migration to new platform (STM32L476RGT6 MCU) Tuning project in STM32CubeMX: Updating clocks Re-configuring peripherals Generating project for new MCU Tuning project in SW4STM32: Importing modified project to the same workspace Apply necessary modifications to generated sources Compile and run project on the new platform

Concept of the system migration to NUCLEO-L476RG 4 HSI 8MHz 5Hz, 50% duty cycle TIM2 HSI*PLL 80MHz 5Hz, 50% duty cycle TIM2 Buffers in FLASH, SRAM dacbuf 32 DMA1 Channel 2 DAC CH1 Tim2 trigger (TRGO, Update) jumper connection PA4 Buffers in FLASH, SRAM dacbuf 32 DMA1 Channel 3 DAC1 CH1 Tim2 trigger (TRGO, Update) jumper connection PA4 adcbuf 32 DMA2 Channel 1 ADC1 CH1 PA1 adcbuf 32 DMA1 Channel 1 ADC1 CH6 PA1 Tim2 trigger (OC4) Tim2 trigger (OC2) STM32L053R8T6 TIM2 STM32L476RGT6 TIM2 Hardware overview Hardware overview

Importing L4_DAC_ADC example 5 Import newly generated L4_DAC_ADC project into a SW4STM32 workspace (a new one or any of previously used). Hint. In case of multiproject workspace selecting active project is done by click on it (right button on mouse)

Import the project into the workspace 1/3 SW4STM32 Follow the below steps to import L4_DAC_ADC project into empty workspace: 6 IMPORT project into workspace It is possible to import multiple projects into a single workspace

Import the project into the workspace 2/3 SW4STM32 Select L4_DAC_ADC project (previously generated by STM32CubeMX) 7 Select project location (as configured in STM32CubeMX)

Import the project into the workspace 3/3 SW4STM32 8 Once project is included into the workspace, its folder structure becomes visible in Project Explorer and project is build automatically Places dedicated for user code are marked by /* USER CODE BEGIN*/ and /* USER CODE END*/ comment lines. These places are protected from being overwritten during code re-generation by STM32CubeMX (if configured so). This is possible to define another user code places in.c source files but not possible in.h header files. Warnings and errors after build the project

Let s add some code to our generated template to make it working 9

Make the L4_DAC_ADC project running adding some code

Modifying the code adding own variables - task 11 Tasks (in main.c file): 1. Add data buffer to be used by DAC to generate signal (sine wave example on the right available within sine.h file) 2. Declare data buffer for ADC to store measured data

Modifying the code adding own variables - solution 12 Tasks: 1. Add data buffer to be used by DAC to generate signal (sine wave example on the right available within sine.h file) 2. Declare data buffer for ADC to store measured data /* USER CODE BEGIN PV */ /* Private variables ---------------------------------------------------------*/ #define ADCBUFSIZE 32 #define DACBUFSIZE 32 const uint16_t dacbuf[dacbufsize] = { 2047, 2447, 2831, 3185, 3498, 3750, 3939, 4056, 4095, 4056, 3939, 3750, 3495, 3185, 2831, 2447, 2047, 1647, 1263, 909, 599, 344, 155, 38, 0, 38, 155, 344, 599, 909, 1263, 1647}; uint16_t adcbuf[adcbufsize]; /* USER CODE END PV */

Modifying the code start the peripherals configured within STM32CubeMX - task 13 Tasks (in main.c file): 1. Start ADC calibration 2. Start ADC to work with DMA on declared ADC buffer 3. Start DAC to work with DMA on declared DAC buffer 4. Start Channel4 of Timer2 to work in Output Compare without output mode (trigger of ADC on Capture Compare event on channel 2 and for DAC on update) To simplify coding process you can use code assistant by pressing Ctrl+SPACE

Modifying the code start the peripherals configured within STM32CubeMX - solution 14 Tasks: 1. Start ADC calibration (necessary delay is implemented in dedicated HAL function) 2. Start ADC to work with DMA on declared ADC buffer 3. Start DAC to work with DMA on declared DAC buffer 4. Start Channel4 of Timer2 to work in Output Compare without output mode (trigger of ADC on Capture Compare event on channel 2 and for DAC on update) /* USER CODE BEGIN 2 */ HAL_ADCEx_Calibration_Start(&hadc1,ADC_SINGLE_ENDED); HAL_ADC_Start_DMA(&hadc1,(uint32_t *)adcbuf, ADCBUFSIZE); HAL_DAC_Start_DMA(&hdac1,DAC_CHANNEL_1,(uint32_t *)dacbuf,dacbufsize,dac_align_12b_r ); HAL_TIM_OC_Start(&htim2, TIM_CHANNEL_2); /* USER CODE END 2 */

15 Let s check whether the application is working correctly Configure the toolchain if necessary (parallel build, C99 dialect) Compile the code Start debug session

Project->Properties Useful project settings in SW4STM32 C dialect and parallel build C/C++ Build->Settings->Tools Settings tab->mcu GCC Compiler->Dialect 1. Configure C standard to C99 to avoid possible compilation errors 16 1 C/C++ Build->Behavior tab 2. Enable parallel build to make use of your machine potential and to shorten compilation time 2

Build the project in SW4STM32 17 To build the project either press Ctrl+B or click Make All icon In case of multiple compilation errors, re-run Indexing of the project After proper build there are information about code/data space usage in Console window displayed

Configure the debug session in SW4STM32 for single project in the workspace 18 Before running debug session this is necessary to configure it for current project In case, there is a single project in the workspace, this is enough to click the bug icon and: 1. Select Ac6 STM32 C/C++ Application line and click OK 2. In case the project was generated on existing/defined board (like NUCLEO- L476RG in our example) debug will run automatically 3. Otherwise it is necessary to configure debug device (STLinkV2-1 in our case) and debug interface (SWD in our case) and click OK Next step would be to run the debug session (see the next slide) 1 3

Configure the debug session in SW4STM32 for multiple projects in the workspace 1/2 19 Before debugging current project for the first time, this is necessary to configure its debug session Select Debug Configuration option 1 3 All project parameters should be filled-in automatically 2 Double click (or use right mouse button to select) to create a new debug configuration for the current project

Run the debug session in SW4STM32 for multiple projects in the workspace 2/2 20 Connect Nucleo board with miniusb cable (ST-Link) In case of the projects generated for ST board, there should be selected board configuration script which specifies debug device and its interface (you can check it in Debugger tab) Debug perspective will be run (please select Yes in the information window) This is enough just to click a bug icon to enter debug session next time. 1 2 4 3

Run the debug session in SW4STM32 for multiple projects in the workspace, but no board specification 21 Connect Nucleo board with miniusb cable (ST-Link) Under Debugger tab select debug device (ST LinkV2-1 for Nucleo ones) and debug interface (SWD) Click Apply and then Debug Debug perspective will be run (please select Yes in the information window) This is enough just to click a bug icon to enter debug session next time. 1 3 2 4

Debug session perspective watching the variables 22 This is possible to monitor CPU registers, peripherals registers and variables during debug session when we pause the code execution (no live view is possible for the time being). To add variable to be monitored select it, press right mouse button and select Add Watch Expression. It will appear in Expressions tab. Values which have changed since previous project pause will be presented on yellow background Watched variables Values changed since previous application pause

Debug session perspective watching the registers content 23 This is possible to monitor CPU registers, peripherals registers and variables during debug session when we pause the code execution (no live view is possible for the time being). To add peripheral register to watch select it, press right mouse button and select Activate. Peripheral icon and its registers names will be highlighted in green and will contain caught values on next debug pause. Values which have changed since previous project pause will be highlighted in red. Core registers Peripherals registers Non-watched peripheral Watched peripheral Value changed since previous application pause

1 2 3 4 5 6 7 8 Handling the debug session SW4STM32 24 1. Skip all breakpoints 2. Run/resume 3. Suspend 4. Terminate debug session 5. Disconnect from the target 6. Step into 7. Step Over 8. Step Return windows configuration in debug perspective

25 Let s run the debug session and see some effects Add adcbuf[] as a new item to be monitored After a while (at least 6.4 seconds to fill whole adcbuf[] buffer) pause the debug session and analyze the adcbuf[] content

Results in debug session monitoring adcbuf[] buffer 26 To add new variable to be monitored in debug session it is needed to: 1. Right click on the variable name 1 4 3 2. Select Add Watch Expression 3. New position in Expressions tab will appear. 5 4. This is not live debug, therefore to check the values it is necessary to pause the session 5. Updated positions are highlighted in yellow 2

What have we learnt? 27 How to migrate the project between two different microcontrollers: Importing STM32CubeMX project Running automatic migration to new platform (STM32L476RGT6 MCU) Tuning project in STM32CubeMX: Updating clocks Re-configuring peripherals Generating project for new MCU Tuning project in SW4STM32: Importing modified project to the same workspace Apply necessary modifications to generated sources Compile and run project on the new platform

Enjoy! /STM32 @ST_World st.com/e2e www.st.com/mcu