+ All Categories
Home > Documents > Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not...

Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not...

Date post: 21-Dec-2015
Category:
Upload: ralf-crawford
View: 215 times
Download: 0 times
Share this document with a friend
Popular Tags:
24
Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please get the attention of an NXP representative.
Transcript
Page 1: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Getting Started with a Cortex-M3 Board

Steven Guan and Joe Hale,NXP Semiconductors

If you have not already downloaded the class prerequisites, please get the

attention of an NXP representative.

Page 2: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Class Agenda• Introduction to the ARM Cortex-M series• Getting started with the NXP LPC1549 Cortex-

M3 board• Introduction to Integrated Development

Environments• Programming techniques for embedded

systems• Modern debugging tools on a Cortex-M3 core• Common Pitfalls

2

Page 3: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Class Prerequisites• You should have already downloaded and

installed (if applicable):– Keil MDK (download and install)– Keil MDK Cortex-M Legacy (download and install)– Segger J-Link Software (download and install)– LPC1549 LPCOpen Software Platform (download)

• If you have not downloaded the software, Please get the attention of an NXP representative!

3

Page 4: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Introduction to the ARM Cortex-M Family

Page 5: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

ARM Cortex Family

5

Page 6: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

What is a Cortex-M series core?• 32-bit memory architecture• ARM Thumb-2 ISA• Optimized for low power• Trades processing power for lower cost and

smaller size

6

Page 7: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

ARM Cortex-M series

7

Page 8: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Example Cortex-M0/M0+ MCU

8

Page 9: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Getting started with the NXP LPCXpresso1549 Cortex-M3

Development Board

Page 10: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

NXP LPC1549 Series Specifications

10

SYSTEM INTERFACES

ANALOG

ADCs (2) 12 ch, 12-b, 2 Msps

ADCs (2) 12 ch, 12-b, 2 Msps

DACDAC

MEMORY

Mul

tilay

er B

us M

atrix

EEPROM 4 kBEEPROM 4 kB

Flash 256 kBFlash

256 kB

RAM 36 kBRAM 36 kB

ROMROM

ARM Cortex-M3Up to 72 MHz

ARM Cortex-M3Up to 72 MHz

UART (3)UART (3)

JTAGJTAG

CAN (& PHY)CAN (& PHY)

SWDSWD

USB (FS Dev) USB (FS Dev)Power Management UnitPMU, power modes, BOD,

single VDD power supply, POR

Power Management UnitPMU, power modes, BOD,

single VDD power supply, POR

Clock Generation Unit12 MHz, 1% IRC OSC, 1-24 MHz System OSC, System (CPU) PLL

Clock Generation Unit12 MHz, 1% IRC OSC, 1-24 MHz System OSC, System (CPU) PLL

USB PLLUSB PLL

TIMERS

SCTimer/PWM (4)SCTimer/PWM (4)

WWDTWWDT

RTCBattery pin

RTCBattery pin SystickSystick

Comparators (4)Comparators (4)

sDMA (18 ch)sDMA (18 ch)

CRC EngineCRC Engine

GPIO (30-78)GPIO (30-78)

Pin Switch MatrixPin Switch Matrix

QEIQEI

Temp SensorTemp Sensor

SPI (2)SPI (2) I2C (Fm+)I2C (Fm+)

Page 11: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

LPCXpresso1549 Board from NXP

11

Page 12: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

LPC Link-2 Debugger• Debugger acts as middleman

between MCU and PC• Integrated onto LPC1549

Cortex-M3 board• LPC Link-2 can be flashed to

emulate third party debuggers– J-Link pre-installed on the

boards given away today

• Can also be used as a standalone probe

12

Page 13: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Introduction to Integrated Development Environments (IDEs)

Page 14: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

What is an IDE?• Software application used to facilitate

software development– Source code editor– Code compiler, including automated building tools– Software debugger

• Examples include Keil MDK, IAR Embedded Workbench, NXP LPCXpresso IDE, etc.

14

Page 15: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

How does an IDE work?• Individual source files

make up a Project• Projects are organized into

a Workspace• A Project may be compiled

into a library or application code

15

Page 16: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

How does an IDE work?

16

Development PC

Code Compilation

Application BinaryApplication Binary

MCU DebuggerMCU Debugger MicrocontrollerMicrocontrollerUSB Cable

Page 17: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Hands On: Intro to Keil MDK• Complete the worksheet that we are passing

out in order to:– Familiarize yourself with the Keil MDK GUI– Get comfortable working with projects in a

workspace– Use the LPCOpen software platform to

successfully compile and download your first application onto the LPC1549!

• If you run into issues, contact the closest NXP representative for assistance

17

Page 18: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Debug Session• IDE will use the MCU debugger to

communicate with MCU through Serial Wire Debug (SWD) pins– IDE will gain access to system memory,

peripherals, and debug registers– Enables plethora of debug features to help aid

software development

18

Page 19: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Programming Techniques for an Embedded System

• Grand Loop Design– All system events addressed inside a while(1) loop

that never exits

• Polling method– Service event by constantly checking

• Interrupt method– Service event when system is told to service

19

Page 20: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Demo: Polling vs. Interrupts and their effect on power

• Aim to minimize power consumption to maximize battery life

• Measure power to direct optimization

20

Page 21: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Modern Debugging Tools on a Cortex-M Core

• Code stepping• Breakpoints• Variable Viewer• SWO Tracing

21

Page 22: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Demo: SWO Tracing• Non-intrusive debugging• Uses one extra SWD pin as data input/output• PC sampling• Interrupt entries and exits• Instrumentation with ITM• Data watch

22

Page 23: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Common Pitfalls• Compiler code optimization

– Reorders instructions to speed up code execution, making code stepping hard to follow

– Use the volatile keyword to prevent variables from being “optimized out”

• Use breakpoints to step through interrupt handler code

• Don’t use printf() or its deviations

23

Page 24: Getting Started with a Cortex-M3 Board Steven Guan and Joe Hale, NXP Semiconductors If you have not already downloaded the class prerequisites, please.

Questions?

Thank you for attending this Embedded TechCon class!


Recommended