Rebuild all target files] No errors, no warnings is what we like to see Generated files are found in the Flash folder of the project directory:"> Rebuild all target files] No errors, no warnings is what we like to see Generated files are found in the Flash folder of the project directory:">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

MS_uC / dnd / V07 2- 1 Programming and GPIO Programming Microcontroller IDE usage, debugger GPIO – General Purpose Input/Output Week 2 - autumn term 2007.

Similar presentations


Presentation on theme: "MS_uC / dnd / V07 2- 1 Programming and GPIO Programming Microcontroller IDE usage, debugger GPIO – General Purpose Input/Output Week 2 - autumn term 2007."— Presentation transcript:

1 MS_uC / dnd / V07 2- 1 Programming and GPIO Programming Microcontroller IDE usage, debugger GPIO – General Purpose Input/Output Week 2 - autumn term 2007 32K Byte Burst Flash 64K or 96K Byte SRAM 256K or 512K Byte Burst Flash OTP Mem UARTI2CSPI TIMRTC EXT. Bus GPIO USB 2.0FS CAN 2.0B Enet MAC PFQ BC DMA INTR Cntl ARM966 E CORE w/DSP 96 MHz CLK Cntl ADC LVD BOD PLL JTAGETM9

2 MS_uC / dnd / V07 2- 2 Programming and GPIO Please copy examples to a directory of your choice Blinky MyFolder programme\keil\arm\boards\keil\mcbstr9\ copy uVision: [Project -> Open Project...] Select a.uv2 file which is a project file Check processor type:

3 MS_uC / dnd / V07 2- 3 Programming and GPIO compiling Blinky.c... compiling LCD.c... compiling UserFont.c... linking... Program Size: Code=2264 RO-data=96 RW-data=4 ZI-data=1292 ".\Flash\Blinky.axf" - 0 Error(s), 0 Warning(s). [Project -> Rebuild all target files] No errors, no warnings is what we like to see Generated files are found in the Flash folder of the project directory:

4 MS_uC / dnd / V07 2- 4 Programming and GPIO Debug commands Debugging the application: Breakpoint: Execution stopped. Line 055 will be executed next

5 MS_uC / dnd / V07 2- 5 Programming and GPIO Processor insight Only accessible if target is not running

6 MS_uC / dnd / V07 2- 6 Programming and GPIO System and Clock settings

7 MS_uC / dnd / V07 2- 7 Programming and GPIO Peripheral Bridge 1 configuration "slow" peripherals PCG1: Peripheral Clocking Gate Register 1: 0 PRR1: Peripheral Reset Register 1: 0 GPIO7 enabled (LED) After Reset: ports disabled

8 MS_uC / dnd / V07 2- 8 Programming and GPIO Definition zA GPIO is a digital binary signal zIts switching level depends on the technology used zA GPIO normally is programmable as unconnected, input, output zA GPIO might have built-in elements like pull-up, pull- down or ESD devices zA GP Output signal is able to sink (or source) a defined amount of current zA GP Input has a defined Impedance which might be taken into account if a passive sensor is linked to it zA GP Input has a defined hysteresis to avoid "flippering" of the signal "Schmitt Trigger input"

9 MS_uC / dnd / V07 2- 9 Programming and GPIO GPIO debug support in IDE peripherals [Peripherals-I/O Ports] P3 as input P3.6 active SCU_GPIOIN3: all bits connected to input GPIO_DIR7: all bits as output SCU_GPIOOUT7: all bits output Altern1 SCU_GPIOIN7: no copy to input pins SCU_GPIOTYPE7: push-pull output

10 MS_uC / dnd / V07 2- 10 Programming and GPIO General Purpose I/O Variable Pin attribution:

11 MS_uC / dnd / V07 2- 11 Programming and GPIO Pin assignment for peripherals Peripheral# No of Unit Port Assignment IO ModePeriphera l # No of Unit Port Assignment IO Mode ADC8 chann- els P4Always Connected Motor Control 1P6Alt Out CAN1P1, P3, P5Alt In Alt out SSP2P2, P5Alt In Alt Out ETM1P0,P2,P4,P5,P 6, P7 Alt In Alt Out Timers4P0, P4, P6, P7Alt In Alt Out Ethernet MAC 1P0, P1, P5Always Connected UART3P1, P2, P3, P5, P6, P7 Alt In Alt Out EMIMuxP8, P9, P7P7 – Alt Out USB1D+/D- Ext clk – P3 Dedicated pins Non- mux P8, P9, P7P7 – Alt Out External Interrupt 30P3, P5, P6, P7Always Connected Chip Select 4P0, P5, P7Alt OutExternal DMA Req 2P3Always Connected I2C2P0, P1, P2Alt In Alt Out

12 MS_uC / dnd / V07 2- 12 Programming and GPIO GPIO Configuration Registers zSCU_GPIOOUT – select alternative output for a peripheral zSCU_GPIOIN- specify input to a peripheral zSCU_GPIOTYPE- Open Collector or Push-pull zGPIO_DIR – specify direction for standard I/O pin zGPIO_Data – Data register for standard I/O pin ®

13 MS_uC / dnd / V07 2- 13 Programming and GPIO GPIO signal flow

14 MS_uC / dnd / V07 2- 14 Programming and GPIO GPIO registers SCU_GPIOOUTn SCU_GPIOINn SCU_GPIOTYPEm Push-pull Open collector n : [9:2] Port number and alternate function GPIO_DATA GPIO_DIR 00h..3FCh [7..0] GPIO_SEL 400h 420h APB0_Base + Ex: GPIO7 direction register non-buffered:0x5800 D400 SCU_PCGR1_Val SCU_PRR1_Val In File STR91x.s: Peripheral Clock Gating Register Peripheral Reset Register

15 MS_uC / dnd / V07 2- 15 Programming and GPIO ARM Peripheral Bus 0 access (APB0)

16 MS_uC / dnd / V07 2- 16 Programming and GPIO GPIO Access through Memory

17 MS_uC / dnd / V07 2- 17 Programming and GPIO Library source Library examples

18 MS_uC / dnd / V07 2- 18 Programming and GPIO Add library files with new path if necessary:

19 MS_uC / dnd / V07 2- 19 Programming and GPIO Debugging system variables: SCU : System Control Unit 1.) Add a static pointer variable to SCU: int main() { static SCU_TypeDef *sb = SCU; ….. 2.) In Debug mode, add this variable to the watch window ( put cursor onto "sb", then right click) 3.) The structured variable is now visible at address 0x5C00 2000 Changes in variables will be highlighted when stepping trough the program  There is no live debug symbol or memory updates when the processor is running 0x5C002060 will show GPIO_OUT7


Download ppt "MS_uC / dnd / V07 2- 1 Programming and GPIO Programming Microcontroller IDE usage, debugger GPIO – General Purpose Input/Output Week 2 - autumn term 2007."

Similar presentations


Ads by Google