Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 -...

13
Lab 1 Department of Computer Science and Information Engineering National Taiwan University Computer System Laboratory Lab1 - Sensor 2014/9/23 / 13 1

Transcript of Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 -...

Page 1: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 131

Computer System Laboratory

Lab1 - Sensor

2014/9/23

Page 2: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 132

Experimental Goal

Learn how to write programs on the PTK development board (STM32F207).

2014/9/23

Temperature Sensor

LCD

LED lampsLight Sensor Key buttons

7 segment LED

Joystick

Page 3: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 133

Environment

Host System Windows XP

Build System IAR Embedded Workbench

Target System PTK development board (STM32F207)

Software PTK Examples Jlink Driver Putty

You can find all software on RSWiki CSL Course Software.

2014/9/23

Page 4: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 134

Hardware Checklist (STM32F207)

2014/9/23

STM32F207 DC power supply Jlink RS232 null cable

Ethernet cable PTK-RFID-EWTJ680 Hart Rate Monitor modules

Page 5: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 135

Hardware Connection (STM32F207)

2014/9/23

RS-232 (COM Port)

Jlink Debugger

DC Power

Page 6: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 136

Introduction to PTK Development Board

STM32F207 is a SoC consisting of a Cortex-M3 Core, built-in flash storage, and many other peripherals. The core can run up to 120MHz. The on-chip memory includes a flash of 256KB and a SRAM of 128KB.

Cortex-M3 processors are a family of 32-bit ARM-based processors for highly deterministic real-time applications. It implements the ARMv7-M architecture.

Nested Vectored Interrupt Controller (NVIC), Memory Protection Unit (MPU), … It has 3-stage pipeline supporting Thumb/Thumb-2 ISA.

2014/9/23

Page 7: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 137

Memory Mapping

The address space of STM32F207 is split into eight 512MB blocks. Block 0 maps the flash memory. Block 1 maps the main memory. Block 2 maps MMIO for peripherals. Block 3/4 maps external devices

using static memory interface. Block 5 maps control registers of

the flexible static memory controller(FSMC).

Block 7 maps internal registers ofthe processor core.

2014/9/23

Page 8: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 138

IAR Embedded Workbench

It is a commercial IDE for ARM-based SoCs.

Please use IAR Embedded Workbench for ARM 6.60, instead of 6.40.

2014/9/23

Page 9: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 139

Install Putty

Step 1: download putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html or course website (putty).

Step 2: putty can be executed without installation.

2014/9/23

Page 10: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 1310

Building and Running (1/2)

Step 1: download and extract the examples PTK_Examples.zip on Windows XP.

Step 2: open the serial console, i.e., putty. Please set the speed (baud rate) to 115200bps.

Step 3: open the following workspace in IAR Embedded Workbench IDE. PTK_Examples\ePBB\Applications\Projects\PTK-STM32F207\EWARM-V6\OS_None\base_uart\demo.eww

Tips: If the system cannot link to STM32F207, please download the Jlink driver, and

install it. You can use other workspaces in OS_None examples, such as base_7seg, base_button, base_buzzer, base_light, base_tempature, etc.

2014/9/23

Page 11: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 1311

Building and Running (2/2)

Step 4: compile the project by clicking the button “Make”.

Step 5: download the program to the target by clicking the button “Download and Debug”.

Step 6: click the button “Go” or press the key “F5” to continue the execution. You will see the message “Hello World!!!” on the serial console.

2014/9/23

Page 12: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 1312

Add Libraries

You can add library sources by right-clicking on the workspace and clicking “Add Files…”.

2014/9/23

Page 13: Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.

Lab 1 Department of Computer Science and Information EngineeringNational Taiwan University / 1313

Lab Requirement

Show the current temperature and luminous flux on the UART console. See …\OS_None\base_temperature\demo.eww and …\OS_None\base_light\demo.eww as a reference.

The documentation of these examples can be found at PTK_Examples/ePBB/Documentations/.

Please hand in your lab report to the FTP. Server: 140.112.90.174 Username: csl2014 Password: csl2014HomeWork Directory: lab1 Please use pdf format with specific filename: “G# Ver#.pdf”, where G# is your

group id and Ver# is revision version number. E.g., G1 Ver1.pdf

2014/9/23