Cortex-M0 MCU Clocks & Pins

Slides:



Advertisements
Similar presentations
Jordan Barry Victor Brzeski
Advertisements

UBI >> Contents Chapter 7 Timers Laboratories MSP430 Teaching Materials Texas Instruments Incorporated University of Beira Interior (PT) Pedro Dinis Gaspar,
More fun with Timer/Counters
ARM development environment Modified Content Philips LPC2106 ARM chip ARM target board PSPad customised development environment Troubleshooting.
Slide 1 Freescale Semiconductor. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are.
Introduction of Holtek HT-46 series MCU
PWM ON SAMSUNG's S3C2410X. Building Embedded LINUX SYSTEM Outline SAMSUNG's S3C2410X components CLOCK & POWER MANAGEMENT PWM TIMER I/O PORTS Finally Project.
HT46 A/D Type MCU Series Data Memory (Byte) Program Memory HT46R22 (OTP) HT46C22 (Mask) 2Kx Kx16 4Kx HT46R23 (OTP) HT46C23 (Mask) HT46R24.
Getting Started with a Cortex-M3 Board
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Introduction to the Orbit Edu Board Ahmad Rahmati Teaching Assistant, ELEC424 Rice Efficient Computing Group Sep 12, 2007.
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
Department of Electrical Engineering, National Taiwan Ocean University NuMicro Learning Board Introduction 1/29/2015 Richard Kuo Assistant.
Pulse Width Modulation
2/26/2015 Richard Kuo Assistant Professor
ARM Timers.
EE 446 Project Assignment Top Design Sensor Components Pin Assignment and Configuration Completed Physical Setup Project Tasks.
Department of Electrical Engineering, National Taiwan Ocean University Pulse Width Modulation 4/25/2013 Richard Kuo Assistant Professor.
Typical Microcontroller Purposes
RS232 #use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7
UART: Universal Asynchronous RX/TX
Department of Electrical Engineering, National Taiwan Ocean University Appendix – NUC140 pin assignment 9/29/2012 Richard Kuo Assistant.
Cortex-M0 MCU Interface and Driver Design - Course Overview
ECS642U Embedded Systems Digital I/O William Marsh.
Siemens Microelectronics, Inc. December 98 Slide 1 HOT50x-5 Version 1.0 HOT50x-5 An Add-On to the HOT50x_1 Hands-On Training Materials for the 8bit Family.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Introduction to PIC-C. Installing PIC-C Goto Username/pass = guest/cpecmu Download and install:  IDEUTIL  PCWHD.
3/23/2015 Richard Kuo Assistant Professor
Microcontroller Programming
Smart Vehicle Tracker Installation Guide AVT-2000A V2.10.
ChibiOS/RT Demo A free embedded RTOS
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an introduction to the peripheral functions.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
Team 9 OmniGlove Jacob Wiles. Hardware Design Major Parts: 32-Bit Microcontroller - PIC32MX664F128H – 64 Pin TQFP – 12x12x1 9-Axis Accelerometer - MPU-9150.
Microcontrollers JULES CALELLA. Microcontrollers vs Microprocessors  Microprocessors – do not contain RAM, ROM, I/O  Microcontrollers – The whole package.
CEng3361/18 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2007 Recitation 01.
THE MOST SUCCESSFUL C2000 MCU
Application Case Study Christmas Lights Controller
Lizard Labs Peripheral Reflex System
3/6/2017 Richard Kuo Assistant Professor
Voice Controlled Robot by Cell Phone with Android App
Chip Config & Drivers – Required Drivers:
Cypress Roadmap: Platform PSoC®
Outline Introduction to NuMaker TRIO Programming environment setup
Introduction In this lab, we will learn
UART: Universal Asynchronous RX/TX
Serial Peripheral Interface
Outline Analog to digital conversion (ADC) of NuMaker TRIO
Microcontrollers, Basics Fundamentals of Designing with Microcontrollers 16 January 2012 Jonathan A. Titus.
Cortex-M0 MCU Course Overview
PROPELLER DISPLAY OF MESSAGE BY VIRTUAL LEDS
Pulse Width Modulation
Code review: GPIO, timer, and ISR
Chapter A - The Raspberry Pi Computer
Microcontrollers & GPIO
Analog-to-Digital Converter (ADC)
Cypress Roadmap: CapSense® Controllers
NuMicro MCU New Project Express Creation
CS4101 Introduction to Embedded Systems Lab 9: NuMaker ADC and LCD
ARM Cortex-M4 Combines DSP and microcontroller features
Timer/Counter Modified from Dr. Lam Phung’s Slides.
Future Designs, Inc. Your Development Partner
MCU Software Development- A Step by Step Guide (Using a Real Eval Board) Class 2: An Introduction to the Atmel AVR XMEGA and Explained Eval Board 9/23/2014.
Designing with ARM Cortex-M4 (and a Real Dev Board)
Cypress Roadmap: CapSense® Controllers
嵌入式微控制器编程 Embedded Microcontroller Programming
Wireless Embedded Systems
Hardware Graduation Project (2) Seminar
ECE 3567 Microcontrollers Lab
Presentation transcript:

Cortex-M0 MCU Clocks & Pins 1/26/2016 Richard Kuo Assistant Professor

Outline Introduction of main.c Introduction of SYS_init.c Intorduction of MCU_init.h NuTool – PinView

main.c Comment for EVB, MCU & connections pin connections // // proj_SmartHome : receive command from Android phone/tablet // EVB : NuTiny-EVB-Nano102 // MCU : Nano102SC2AN (LQFP64) // Features : // printf to display message on Debugger's UART#1 view // UART1 to HC05 : transmit/receive data through Bluetooth // baudrate=9600, databit=8, stopbit=1, paritybit=0, flowcontrol=None // TIMER0 interrupt every 0.1 sec, then the command from Android phone/tablet // GPIO to input device : read button or sensor // GPIO to output device: control LED on/off // ADC4 to photoresistor : read luminance // I2C1 to 3-axis Accelerometer & Gyroscope, OLED display // RTC to report time #include <stdio.h> #include <math.h> #include <string.h> #include "Nano1X2Series.h“ #include “MCU_init.h” #include “SYS_init.h” Comment for EVB, MCU & connections pin connections include header files

main.c Global Variables Interrupt Service Routine uint8_t Text[24]; uint8_t Text_RTC[32]; volatile char RX_buffer[RXBUFSIZE]; volatile uint8_t command; volatile uint32_t u32ADCvalue; volatile uint32_t g_u32TICK = 0; volatile uint8_t Flag_report =0; void UART1_IRQHandler(void) { uint32_t u32IntSts= UART1->ISR; if(u32IntSts & UART_IS_RX_READY(UART1)) { UART_Read(UART1, RX_buffer, RXBUFSIZE); command=RX_buffer[0]; Flag_report=1; //printf("%c\n", command); } Global Variables Interrupt Service Routine

Host Clock Selection

SYS_init.c – System Initialization void SYS_Init(void) { SYS_UnlockReg(); // Unlock protected registers // select Chip clock source & set clock source CLK_EnableXtalRC(MCU_CLOCK_SOURCE_MASK); // Enable HXT external 12MHz crystal CLK_WaitClockReady(MCU_CLOCK_STABLE_MASK); CLK_SetCoreClock(MCU_CLOCK_FREQUENCY); // Set HCLK clock to 32MHz // Select IP clock source & enable module #ifdef MCU_INTERFACE_RTC CLK_EnableModuleClock(RTC_MODULE); CLK_SetModuleClock(RTC_MODULE, CLK_CLKSEL2_RTC_SEL_10K_LXT, 0); #endif Set HCLK Set IP clock

SYS_init.c – IP Clock Cetting #ifdef MCU_INTERFACE_WDT CLK_EnableModuleClock(WDT_MODULE); #ifdef WDT_CLOCK_SOURCE_LIRC CLK_SetModuleClock(WDT_MODULE, CLK_CLKSEL1_WDT_S_LIRC, 0); #endif #ifdef CLK_CLKSEL1_WDT_S_HCLK_DIV2048 CLK_SetModuleClock(WDT_MODULE, CLK_CLKSEL1_WDT_S_HCLK_DIV2048, 0); #ifdef WDT_CLOCK_SOURCE_LXT CLK_SetModuleClock(WDT_MODULE, CLK_CLKSEL1_WDT_S_LXT, 0); #ifdef MCU_INTERFACE_WWDT CLK_EnableModuleClock(WWDT_MODULE); #ifdef WWDT_CLOCK_SOURCE_HCLK_DIV2048 CLK_SetModuleClock(WWDT_MODULE, CLK_CLKSEL2_WWDT_S_HCLK_DIV2048, 0); #ifdef WWDT_CLOCK_SOURCE_LIRC CLK_SetModuleClock(WWDT_MODULE, CLK_CLKSEL2_WWDT_S_LIRC, 0); WDT clock setting WWDT clock setting

SYS_init.c – Set MultiFunction Pins // Init I/O Multi-function // Set multi-function pins for ACMP #ifdef PIN_ACMP0_P_PC6 SYS->GPC_MFP = (SYS->GPC_MFP & ~SYS_GPC_MFP_PC6_Msk) | SYS_GPC_MFP_PC6_ACMP0_P; SYS->ALT_MFP1= (SYS->ALT_MFP1& ~SYS_ALT_MFP_PC6_Msk) | SYS_ALT_MFP1_PC6_ACMP0_P; GPIO_DISABLE_DIGITAL_PATH(PC, BIT6); #endif #ifdef PIN_ACMP0_N_PC7 SYS->GPC_MFP = (SYS->GPC_MFP & ~SYS_GPC_MFP_PC7_Msk) | SYS_GPC_MFP_PC7_ACMP0_N; SYS->ALT_MFP1= (SYS->ALT_MFP1& ~SYS_ALT_MFP_PC7_Msk) | SYS_ALT_MFP1_PC7_ACMP0_N; GPIO_DISABLE_DIGITAL_PATH(PC, BIT7); #ifdef PIN_ACMP1_P_PC14 SYS->GPC_MFP = (SYS->GPC_MFP & ~SYS_GPC_MFP_PC14_Msk) | SYS_GPC_MFP_PC14_ACMP1_P; SYS->ALT_MFP1= (SYS->ALT_MFP1& ~SYS_ALT_MFP_PC14_Msk) | SYS_ALT_MFP1_PC14_ACMP1_P; GPIO_DISABLE_DIGITAL_PATH(PC, BIT14);

MCU_init.h //Define Clock source #define MCU_CLOCK_SOURCE #define MCU_CLOCK_SOURCE_HXT // HXT, LXT, HIRC, LIRC #define MCU_CLOCK_SOURCE_LXT #define MCU_CLOCK_FREQUENCY 50000000 //Hz //Define MCU Interfaces

MCU_init.h with ADC #define MCU_INTERFACE_ADC #define ADC_CLOCK_SOURCE_HXT // HXT, LXT, PLL, HIRC, HCLK #define ADC_CLOCK_DIVIDER 1 #define PIN_ADC_0 #define PIN_ADC_1 #define PIN_ADC_2 #define PIN_ADC_3 #define ADC_CHANNEL_MASK ADC_CH_0_MASK | ADC_CH_1_MASK | ADC_CH_2_MASK | ADC_CH_3_MASK #define ADC_INPUT_MODE ADC_INPUT_MODE_SINGLE_END // SINGLE_END, DIFFERENTIAL #define ADC_OPERATION_MODE ADC_OPERATION_MODE_CONTINUOUS // SINGLE, SINGLE_CYCLE, CONTINUOUS

MCU_init.h with Timer #define MCU_INTERFACE_TMR0 #define TMR0_CLOCK_SOURCE_HIRC // HXT, LXT, HCLK, EXT, LIRC, HIRC #define TMR0_CLOCK_DIVIDER 1 #define TMR0_OPERATING_MODE TIMER_ONESHOT_MODE // ONESHOT, PERIODIC, TOGGLE, CONTINUOUS #define TMR0_OPERATING_FREQ 1 //Hz

MCU_init.h with Timer Capture #define MCU_INTERFACE_TMR2 #define TMR2_CLOCK_SOURCE_HXT // HXT, LXT, HCLK, EXT, LIRC, HIRC #define TMR2_CLOCK_DIVIDER 12 #define TMR2_OPERATING_MODE TIMER_CONTINUOUS_MODE // ONESHOT, PERIODIC, TOGGLE, CONTINUOUS #define TMR2_OPERATING_FREQ 1000000 //Hz #define TMR2_EVENT_DETECTION TIMER_COUNTER_FALLING_EDGE // FALLING, RISING #define TMR2_CAPTURE_MODE TIMER_CAPTURE_FREE_COUNTING_MODE // FREE_COUNTING, COUNTER_RESET #define TMR2_CAPTURE_EDGE TIMER_CAPTURE_FALLING_AND_RISING_EDGE // FALLING, RISING, FALLING_AND_RISING #define PIN_TC2_PB2 // TC0_PB15, TC1_PE5, TC2_PB2, TC3_PB3

MCU_init.h with WDT #define MCU_INTERFACE_WDT #define WDT_CLOCK_SOURCE_LXT // LIRC, HCLK_DIV2048, LXT

MCU_init.h with RTC #define MCU_INTERFACE_RTC

MCU_init.h with ADC #define MCU_INTERFACE_ADC #define ADC_CLOCK_SOURCE_HXT // HXT, LXT, PLL, HIRC, HCLK #define ADC_CLOCK_DIVIDER 1 #define PIN_ADC_0 #define PIN_ADC_1 #define PIN_ADC_2 #define PIN_ADC_3 #define ADC_CHANNEL_MASK ADC_CH_0_MASK | ADC_CH_1_MASK | ADC_CH_2_MASK | ADC_CH_3_MASK #define ADC_INPUT_MODE ADC_INPUT_MODE_SINGLE_END // SINGLE_END, DIFFERENTIAL #define ADC_OPERATION_MODE ADC_OPERATION_MODE_CONTINUOUS // SINGLE, SINGLE_CYCLE, CONTINUOUS

MCU_init.h with PWM //Define MCU Interfaces #define MCU_INTERFACE_PWM0 #define PWM0_CH01_CLOCK_SOURCE_HCLK // HXT, LXT, HCLK, HIRC #define PIN_PWM0_CH0_PA12 #define PIN_PWM0_CH1_PA13 #define PIN_PWM0_CH2_PA14 #define PIN_PWM0_CH3_PA15 different MCU seriers may use a different pin out of the interface

MCU_init.h with PWM #define MCU_INTERFACE_PWM0 #define PWM0_CH01_CLOCK_SOURCE_HCLK // HXT, LXT, HCLK, HIRC #define PIN_PWM0_CH0_PA12 #define PIN_PWM0_CH1_PA13 #define PIN_PWM0_CH2_PA14 #define PIN_PWM0_CH3_PA15 different MCU seriers may use a different pin out of the interface

MCU_init.h with SPI #define MCU_INTERFACE_SPI3 #define SPI_CLOCK_SOURCE_HCLK #define PIN_SPI3_SCLK_PD9 #define PIN_SPI3_MISO0_PD10 #define PIN_SPI3_MOSI0_PD11 //#define PIN_SPI3_MISO1_PD12 //#define PIN_SPI3_MOSI1_PD13 different MCU seriers may use a different pin out of the interface

MCU_init.h with I2C #define MCU_INTERFACE_I2C1 #define I2C1_CLOCK_FREQUENCY 400000 //Hz #define PIN_I2C1_SCL_PA11 #define PIN_I2C1_SDA_PA10 different MCU seriers may use a different pin out of the interface

MCU_init.h with UART #define MCU_INTERFACE_UART1 #define UART_CLOCK_SOURCE_HIRC // HXT, LXT, PLL, HIRC #define UART_CLOCK_DIVIDER 3 #define PIN_UART1_RX_PB4 #define PIN_UART1_TX_PB5 different MCU seriers may use a different pin out of the interface

MCU_init.h with USB #define MCU_INTERFACE_USB #define USB_CLOCK_DIVIDER 1

NuTool Download Download NuTool - PinView 1.28.6378.zip

NuTool – Pinview installation Unzip & run .exe to install

NuTool – PinView (Nu-LB-NUC140)

NuTool – PinView (NuTiny-EVB-Nano102)

NUC140 LQFP-100

Nano102 LQFP-64

M051 QFN-33

M051 LQFP48

Mini51 LQFP48

Mini51/54 TSSOP

Mini58 TSSOP20

Important Notice ! This educational material are neither intended nor warranted for usage in systems or equipment, any malfunction or failure of which may cause loss of human life, bodily injury or severe property damage. Such applications are deemed, “Insecure Usage”. Insecure usage includes, but is not limited to: equipment for surgical implementation, atomic energy control instruments, airplane or spaceship instruments, the control or operation of dynamic, brake or safety systems designed for vehicular use, traffic signal instruments, all types of safety devices, and other applications intended to support or sustain life. All Insecure Usage shall be made at user’s own risk, and in the event that third parties lay claims to the author as a result of customer’s Insecure Usage, the user shall indemnify the damages and liabilities thus incurred by using this material. Please note that all lecture and sample codes are subject to change without notice. All the trademarks of products and companies mentioned in this material belong to their respective owners.