Department of Electrical Engineering

Download Report

Transcript Department of Electrical Engineering

Cortex-M0 MCU Interface and
Driver Design - Course Overview
Department of Electrical Engineering,
National Taiwan Ocean University
2/21/2013
Richard Kuo
Assistant Professor
www.ee.ntou.edu.tw
Why Learning Microcontroller ?
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
Microcontrollers Are Everywhere !
MCU Interfacing & Programming
Department of Electrical Engineering,
National Taiwan Ocean University
Interfacing
Programming
MCU
Peripheral Devices
www.ee.ntou.edu.tw
ICE
(Nu-Link)
PC
IDE
MCU Block Diagram - Simplified
Department of Electrical Engineering,
National Taiwan Ocean University
Memory
CPU
www.ee.ntou.edu.tw
I/O
GPIO
Flash ROM
Cortex-M0
50MHz
SRAM
Interfaces
UART
I2C
SPI
PWM
ADC
MCU Block Diagram - Detail
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
CONFIG
Info
10K OSC
Cortex-M0
50 MHz
DATAFLASH
Option
CLK_CTL
ISP 4KB
P
L
L
AHB
Flash Control
64KB(M0516)
32KB(M058)
16KB(M054)
8KB(M052)
AHB
arbiter
AHB
arbiter
SRAM
4KB
APBBridge
Watch Dog Timer
nWR
mclk
ALE
ADC
SPI 0/1
AD[15:0]
nCS
nRD
GPIO
P0~P4
Timer 0/1
EBI
Timer 2/3
UART 0/1
PWM 0~7
I2C
22M OSC
EXT. 12M
XTAL
LDO
2.5 ~ 5.5V
ADC
8ch/12bit
SARADC
600K SPS
PAD Control
POR
Brown-Out
LVR
Course Outline
Department of Electrical Engineering,
National Taiwan Ocean University
►
www.ee.ntou.edu.tw
Lesson 0. NuMicro MCU Overview & Introduction
► Lesson 1. NuMicro Learning Board & SDK
► Lesson 2. Basic Electronics
► Lesson 3. C Programming
► Lesson 4. GPIO (General Purpose I/O)
► Lesson 5. LCD (on-board LCD)
► Lesson 6. Timer/Watch-Dog Timer/Real-Time-Clock
► Lesson 7. ADC (Analog-to-Digital)
Course Outline
Department of Electrical Engineering,
National Taiwan Ocean University
►
www.ee.ntou.edu.tw
Lesson 8. PWM (Pulse Width Modulation)
► Lesson 9. Motor Control
► Lesson 10. UART (Universal Asynchronous Receiver/
Transmitter)
► Lesson 11. I2C (Inter-Integrated Circuit) bus
► Lesson 12. SPI (Serial Peripheral Interface)
► Lesson 13. USB (Universal Serial Bus) & SDcard
► Lesson 14. CAN (Controller Area Network)
Lesson 0. NuMicro MCU Course Overview
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
►
Course Introduction
0._NuMicro_MCU_Course_Overview.ppt
►
ARM Cortex-M0 Introduction
0.ARM_CortexM0_Intro.ppt
►
NuMicro NUC140 Technical Reference Manual
0. NuMicro_NUC140_Technical_Reference_Manual.pdf
►
NuMicro CMSIS Introduction
0.NuMicro_CMSIS_Intro.ppt
Lesson 1. NuMicro Learning Board & SDK
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
►
NuMicro Learning Board User Guide (including Schematics)
1.Nu-LB-NUC140_User_s_Guide_v2.0.pdf
►
NuMicro Learning Board Usage Introduction
1.NuMicro_MCU_Learning_Board_Introduction.ppt
►
NuMicro Learning Board SDK Installation
1.NuMicro_MCU_Learning_Board_SDK_Installation.ppt
►
Exercise : Smpl_Start_Kit
C:\Nuvoton\BSP Library\NUC100SeriesBSP_v1.05.001\NUC100SeriesBSP\NuvotonPlatform_Keil\Sample\NUC1xxLB_002\Smpl_Start_Kit
Lesson 2. Basic Electronics
Department of Electrical Engineering,
National Taiwan Ocean University
2.Basic_Electronics.ppt
►
Electronic Fundamental Laws
►
Electronic Tool/Equipment
►
Basic Components Introduction






Resistor
Light Emitting Diode (LED)
Oscillator
Transistor
Operational Amplifier (OP Amp)
Ultrasound Sensor Circuit
www.ee.ntou.edu.tw
Lesson 3. C Programming
Department of Electrical Engineering,
National Taiwan Ocean University
►
C Programming
3. C_programming.ppt
–
–
–
–
►
►
►
►
►
www.ee.ntou.edu.tw
Computer Architecture
Introduction and Basic C Features
Data Type and Operators
Functions and Macro
Exercise : GPIO to control on-board LEDs (Smpl_GPIO_LED)
Exercise : GPIO using macro (Smpl_GPIO_LED1_macro)
Exercise : GPIO to control RGB LED (Smpl_GPIO_RGBled)
Exercise : GPIO to control Buzzer on/off (Smpl_GPIO_Buzzer)
Exercise : GPIO to control 7-segment display (Smpl_7seg)
Lesson 4. General Purpose Input/Output
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
►
Cortex-M0 MCU General Purpose Input/Output
4.NuMicro_GPIO.PPT
►
Exercise : GPIO to scan 3x3 keypad (Smpl_7seg_Keypad)
Exercise : GPIO controlled by 3x3 keypad (Smple_GPIO_Keypad)
Exercise : GPIO to read Body Infrared Sensor
(Smpl_GPIO_BodyInfrared)
Exercise : GPIO connecting to LCM16x2 (Smpl_GPIO_LCM16x2)
Exercise : GPIO interface to 16x16 LED Matrix
(Smpl_GPIO_LED16x16)
►
►
►
►
Lesson 5. LCD display
Department of Electrical Engineering,
National Taiwan Ocean University
►
NuMicro MCU Learning Board’s LCD display
5.NuMicro_LCD.ppt
►
Exercise: LCD display - Text mode (Smpl_LCD_Text)
www.ee.ntou.edu.tw
– Print text on LCD 128x64
►
Exercise: LCD display – Text mode (Smpl_LCD_Keypad)
– Keypad input to display text on LCD
►
Exercise: LCD display – Graphic mode (Smpl_LCD_Bmp)
– Display bitmap on LCD 128x64
►
Exercise: LCD display – Graphic mode (Smpl_LCD_Graphics)
– Draw Line/Circle on LCD 128x64
►
To design a LCD Driver (Driver_LCD.c)
Lesson 6.Timer/Watch-Dog Timer/RTC
Department of Electrical Engineering,
National Taiwan Ocean University
►
►
www.ee.ntou.edu.tw
NuMicro MCU Timer/Watch-Dog Timer/RTC
6.NuMicro_Timer_WatchDog_RTC.ppt
Exercise: Timer – one-shot、periodic、continuous (Smpl_Timer)
–set Timer 0,1,2,3 at different counting frequency and display on LCD
►
Exercise: Watch-Dog Timer (Smpl_WDT)
–Set Watch-Dog Timer at 10KHz
►
Exercise: Real-Time Clock (Smpl_RTC)
–set RTC alarm & display RTC time
►
Exercise: using Timer + WatchDog Timer + RTC alarm
(Smpl_Timer_WDT_RTC)
–Use Timer & WatchDogt Timer & RTC all in one program
►
To design a Timer Driver (Driver_Timer.c)
Lesson 7. Analog-to-Digital Conversion
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
►
Analog-to-Digital Conversion Introduction
– 7.NuMicro_ADC.ppt
►
Exercise:using ADC to read variable resistor (Smpl_ADC_VR1)
►
Exercise:using ADC to read thermistor (Smpl_ADC_Thermistor)
►
Exercise : using ADC to read resistive touch panel (Smpl_ADC_Touch)
►
To design a ADC Driver (Driver_ADC.c)
Lesson 8. Pulse Width Modulation
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
►
PWM Introduction
– 8.NuMicro_PWM.ppt
►
Exercise:using PWM to generate tone (Smpl_PWM_Tone)
– To use oscilloscope to observe the output waveform
►
Exercise:using PWM to output to speaker (Smpl_PWM_stereo)
– Add a transistor to driver external speaker
►
Exercise : using PWM with Keypad to select different tone to output to
speaker (Smpl_PWM_Tone_Keypad)
– Use ScanKey driver to get input from 3x3 keypad
– Use PWM to generate tone
►
To design a PWM driver (Driver_PWM.c)
Lesson 9. Motor Control
Department of Electrical Engineering,
National Taiwan Ocean University
►
►
Motor Control Introduction
– 9.NuMicro_Motor_Control.ppt
Exercise:Stepping Motor control using GPIO
(Smpl_GPIO_StepMotor)
►
Exercise : DC servo control using PWM
(Smpl_PWM_DCServo)
►
Exercise:DC motor control using GPIO
(Smpl_GPIO_DCmotor)
www.ee.ntou.edu.tw
Lesson 10. UART (Universal Asynchronous
Receiver / Transmitter)
Department of Electrical Engineering,
National Taiwan Ocean University
►
►
www.ee.ntou.edu.tw
UART Introduction
– 10.NuMicro_UART.ppt
Exercise:Interfacing with Ultrasound sensor module
(Smpl_UART0_SRF04)
►
Exercise:Interfacing with Bluetooth module
(Smpl_UART0_HC05)
►
Exercise:Reading Ultrasound sensor and transmit data to
Bluetooth (Smpl_UART_BT_US100)
►
To design an UART Driver (Driver_UART.c)
Lesson 11. I2C bus
Department of Electrical Engineering,
National Taiwan Ocean University
►
►
►
►
►
►
►
I2C Bus Introduction
– 11.NuMicro_I2C.ppt
Exercise: I2C interface with Temperature Sensor IC
(Smpl_I2C_TMP100)
Exercise: I2C interface with 3-axis accelerometer
(Smpl_I2C_MMA7445)
Exercise: I2C interface with 3-axis Gyroscope
(Smpl_I2C_L3G4200)
Exercise: I2C interface with 3-axis Accelero + Gyro
(Smpl_I2C_MPU6050)
To design an I2C driver (Driver_I2C.c)
To design device driver for above sensors
www.ee.ntou.edu.tw
Lesson 12. SPI (Serial Peripheral Interface)
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
►
SPI Bus Introduction
– 12.NuMicor_SPI.ppt
►
Exercise : use SPI interface to LCD 128x64 (Smpl_SPI_QC12864B)
►
Exercise: use SPI read/write SPI Flash (Smpl_SPI_Flash)
►
Exercise: use SPI & PDMA access SPI Flash (Smpl_SPI2_Flash)
►
Exercise : use SPI interface with RF2.4GHz (Smpl_SPI_RF24L01)
►
To design a SPI driver (Driver_SPI.c)
To design device drivers for LCD128x64, SPI Flash, RF2.4G
►
Lesson 13. USB & SDcard
Department of Electrical Engineering,
National Taiwan Ocean University
►
www.ee.ntou.edu.tw
USB Introduciton
– 13.NuMicro_USB_SDcard.ppt
►
Exercise : USB Virtual Com. Port (Smpl_VCOM)
– Using UART0 to USB
►
Exercise : USB HID (Smpl_HID)
– Emulating USB Human Interface Device (keyboad, mouse, digitizer)
►
Exercise : Audio player with SDcard (Smpl_SDcard_ADPCM)
– MCU decode .wav file read from SDcard
►
Exercise : signal recording with SDcard (Smpl_SDcard_ADC7)
– MCU record signal input of pin ADC7 and store 12-bit data into SDcard
►
To design a SDcard driver (Driver_SDcard.c) using FAT File
System
Lesson 14. CAN (Controller Area Network)
Department of Electrical Engineering,
National Taiwan Ocean University
►
CAN Bus Introduction
– 14.NuMicro_CAN.ppt
►
Exercise: CAN Basic Transmission (Smpl_CAN)
www.ee.ntou.edu.tw
– TX for standard ID & RX for LCD display message
►
►
►
►
►
Exercise : CAN networking with ScanKey (Smpl_CAN_Keypad)
Exercise : CAN networking with ADC (Smpl_CAN_ADC7)
Exercise : CAN networking with Timer0 (Smpl_CAN_Timer0)
Exercise : CAN master/slave to control GPIOs
To use CAN to network and control an external control board (with
MOSFETs/Relys) for driving DC Motor /Step Motor /Actuator
General Disclaimer
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
The Lecture is strictly used for educational purpose.
MAKES NO GUARANTEE OF VALIDITY
►The
lecture cannot guarantee the validity of the information found here. The lecture may recently have been
changed, vandalized or altered by someone whose opinion does not correspond with the state of knowledge in the relevant
fields. Note that most other encyclopedias and reference works also have similar disclaimers.
No formal peer review
►The
lecture is not uniformly peer reviewed; while readers may correct errors or engage in casual peer review, they have
no legal duty to do so and thus all information read here is without any implied warranty of fitness for any purpose or use
whatsoever. Even articles that have been vetted by informal peer review or featured article processes may later have been
edited inappropriately, just before you view them.
No contract; limited license
►Please
make sure that you understand that the information provided here is being provided freely, and that no kind of
agreement or contract is created between you and the owners or users of this site, the owners of the servers upon which it
is housed, the individual Wikipedia contributors, any project administrators, sysops or anyone else who is in any way
connected with this project or sister projects subject to your claims against them directly. You are being granted a limited
license to copy anything from this site; it does not create or imply any contractual or extracontractual liability on the part
of Wikipedia or any of its agents, members, organizers or other users.
►There is no agreement or understanding between you and the content provider regarding your use or modification
of this information beyond the Creative Commons Attribution-Sharealike 3.0 Unported License (CC-BY-SA) and the
GNU Free Documentation License (GFDL);
General Disclaimer
Department of Electrical Engineering,
National Taiwan Ocean University
www.ee.ntou.edu.tw
Trademarks
►Any
of the trademarks, service marks, collective marks, design rights or similar rights that are mentioned, used or cited
in the lectures are the property of their respective owners. Their use here does not imply that you may use them for any
purpose other than for the same or a similar informational use as contemplated by the original authors under the CC-BYSA and GFDL licensing schemes. Unless otherwise stated , we are neither endorsed by nor affiliated with any of the
holders of any such rights and as such we cannot grant any rights to use any otherwise protected materials. Your use of any
such or similar incorporeal property is at your own risk.
Personality rights
►The
lecture may portray an identifiable person who is alive or deceased recently. The use of images of living or recently
deceased individuals is, in some jurisdictions, restricted by laws pertaining to personality rights, independent from their
copyright status. Before using these types of content, please ensure that you have the right to use it under the laws which
apply in the circumstances of your intended use. You are solely responsible for ensuring that you do not infringe someone
else's personality rights.