Practice 1

9
Practice 1 Asst. Prof. Dr. Alper ŞİŞMAN

description

Practice 1. Asst. Prof. Dr. Alper ŞİŞMAN. What is STM32F Discovery board. STM32F407VGt6 MCU with 32-bit ARM Cortex-MF4 core, 1 MB Flash and 192 KB RAM ST-Link debugger External or USB power options (5V). 8-LED indicators - PowerPoint PPT Presentation

Transcript of Practice 1

Page 1: Practice 1

Practice 1

Asst. Prof. Dr. Alper ŞİŞMAN

Page 2: Practice 1

What is STM32F Discovery board

• STM32F407VGt6 MCU with 32-bit ARM Cortex-MF4 core, 1 MB Flash and 192 KB RAM

• ST-Link debugger• External or USB power options (5V).• 8-LED indicators– red/green LED Indicating the communication with the

computer (debugging, programming etc.)– Red power on indicator LED– 4 general purpose LEDs (orange, green, red and blue)– 2 USB LEDs (green,red) indicating USB port of MCU

active.

Page 3: Practice 1

• A reset and a general purpose button• Micro USB connector for USB applications• 3-dimension digital accelerometer (LIS302DL)• Omni-directional MEMS microphone

(MP45DT02)• DAC with integrated Class-D speaker driver

(CS43L22)• 100-pin header to reach all pins of the MCU

Page 4: Practice 1

What is STM32F407VG MCU– Core: ARM 32-bit Cortex™-M4F CPU with FPU,

Adaptive real-time accelerator (ART Accelerator™) allowing 0-wait state execution from Flash memory, frequency up to 168 MHz, and DSP instructions–Memories• Up to 1 Mbyte of Flash memory• Up to 192+4 Kbytes of SRAM including 64-Kbyte of CCM

(core coupled memory) data RAM• Flexible static memory controller supporting Compact

Flash, SRAM, PSRAM, NOR and NAND memories

–LCD parallel interface, 8080/6800 modes

Page 5: Practice 1

• 3×12-bit, 2.4 MSPS A/D converters: up to 24 channels and 7.2 MSPS in triple interleaved mode

• 2×12-bit D/A converter• Up to 140 I/O ports with interrupt capability– Up to 15 communication interfaces– Up to 3 × I2C interfaces (SMBus/PMBus)– Up to 4 USARTs/2 UARTs (10.5 Mbit/s, ISO 7816 interface,

LIN, IrDA, modem control)– Up to 3 SPIs (37.5 Mbits/s), 2 with muxed full-duplex I2S to

achieve audio class accuracy via internal audio PLL or external clock

– 2 × CAN interfaces (2.0B Active)– SDIO interface

Page 6: Practice 1

• Advanced connectivity– USB 2.0 full-speed device/host/OTG controller– 10/100 Ethernet MAC with dedicated DMA: supports IEEE

1588v2 hardware, MII/RMII– 8- to 14-bit parallel camera interface up to 54 Mbytes/s

• Up to 17 timers: up to twelve 16-bit and two 32-bit timers up to 168 MHz, each with up to 4 IC/OC/PWM or pulse counter and quadrature (incremental) encoder input

• Debug mode– Serial wire debug (SWD) & JTAG interfaces

• Analog random number generator• CRC calculation unit, 96-bit unique ID• RTC: subsecond accuracy, hardware calendar

Page 7: Practice 1

Compiler

• Keil STM32 C compiler can be used. (32K free version)• Create a new project using project tab• Choose the MCU type (STM32F407ZG)• Add new item to source group1: C file, the name: main• Include the processor header file: STM32F4xx.h• Each code file must have SystemInit() and main()

functions• Compile it.

Page 8: Practice 1

Debugger• Set simulation mode• Activate HW floating point block in system init

function: (*((int*)0xE000ED88))|=0x0F00000;• Write the main code as follows:– int sayi1;– int sayi2=5000, sonuc;– sayi1 = sayi2 % 3;– sonuc=sayi1+sayi2;

• Hit the debug button, add watch windows and see how the number are changing as the program executing step by step

Page 9: Practice 1

HW Debugging• Download USB drivers from ST’s internet site. They

must be installed before.• Change the debug mode of your project to ST-link

debugger (Use options menu)– Change simulation modedebugger mode (Debug menu)– Select Flash programmer as ST-debugger(Flash utilities

menu)– Choose the driver for flashing (from settings button of

the flash utilities menu)• Connect the discovery kit via mini USB connector• Upload the compiled the code• Execute the code step by step