Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to stm32-part2

21,031 views

Published on

Published in: Design

Introduction to stm32-part2

  1. 1. Introduction to STM32
  2. 2. Course Objective <ul><li>After completing this course, you will answer: </li></ul><ul><ul><li>What is ARM Cortex Processor? </li></ul></ul><ul><ul><li>What is the STM32 SoC? </li></ul></ul><ul><ul><li>What are STM32 building blocks? </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  3. 3. Course Notes <ul><li>Set your cell phone to vibrate. </li></ul><ul><li>I assume you know computer architecture. </li></ul><ul><li>Ask any time. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  4. 4. Course References <ul><li>The Definitive Guide to the ARM Cortex-M3, 2 nd Edition </li></ul><ul><li>www.arm.com </li></ul><ul><li>www.st.com/stm32 </li></ul><ul><li>www.doulos.com </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  5. 5. Course Outline <ul><li>Introduction </li></ul><ul><li>Cortex Overview </li></ul><ul><li>CMSIS </li></ul><ul><li>STM32 System Architecture </li></ul><ul><li>Peripherals </li></ul><ul><li>Low Power Operation </li></ul><ul><li>Safety Features </li></ul><ul><li>The Flash Module </li></ul><ul><li>Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  6. 6. Course Outline <ul><li>Introduction </li></ul><ul><li>Cortex Overview </li></ul><ul><li>CMSIS </li></ul><ul><li>STM32 System Architecture </li></ul><ul><li>Peripherals </li></ul><ul><li>Low Power Operation </li></ul><ul><li>Safety Features </li></ul><ul><li>The Flash Module </li></ul><ul><li>Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  7. 7. A Glance at STM32 Amr Ali Abdel-Naby@2011 Introduction to STM32
  8. 8. Performance and Access Lines Amr Ali Abdel-Naby@2011 Introduction to STM32
  9. 9. System Architecture <ul><li>Multiple bus access </li></ul><ul><li>Efficient DMA and rapid data flow </li></ul><ul><li>Increased peripheral speed for better performance </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  10. 10. Memory Mapping and Boot Modes Amr Ali Abdel-Naby@2011 Introduction to STM32
  11. 11. Clock Schemes <ul><li>2 external oscillators </li></ul><ul><li>2 internal oscillators </li></ul><ul><li>1 PLL </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  12. 12. Clocking Configurations Amr Ali Abdel-Naby@2011 Introduction to STM32
  13. 13. Direct Memory Access <ul><li>7 independent configurable channels </li></ul><ul><ul><li>HW or SW requests on each channels </li></ul></ul><ul><li>Memory-to-memory, memory-to-peripheral, peripheral-to-memory transfers </li></ul><ul><li>SW programmable priorities </li></ul><ul><ul><li>HW priority in case of equality </li></ul></ul><ul><li>Programmable and independent transfer </li></ul><ul><ul><li>Byte, ½ word, word </li></ul></ul><ul><ul><li>source-destination independent </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  14. 14. DMA Mapping <ul><li>Each DMA channel is controlled by: </li></ul><ul><ul><li>4 registers </li></ul></ul><ul><ul><li>3 interrupts </li></ul></ul><ul><ul><ul><li>Transferee complete </li></ul></ul></ul><ul><ul><ul><li>Half transfer </li></ul></ul></ul><ul><ul><ul><li>Error </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  15. 15. Course Outline <ul><li>Introduction </li></ul><ul><li>Cortex Overview </li></ul><ul><li>CMSIS </li></ul><ul><li>STM32 System Architecture </li></ul><ul><li>Peripherals </li></ul><ul><li>Low Power Operation </li></ul><ul><li>Safety Features </li></ul><ul><li>The Flash Module </li></ul><ul><li>Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  16. 16. General Purpose Input Output <ul><li>80 multifunction bi-directional IO </li></ul><ul><ul><li>5 x 16-pin ports </li></ul></ul><ul><ul><ul><li>GPIOA … GPIOE </li></ul></ul></ul><ul><li>Each pin can work as: </li></ul><ul><ul><li>GPIO </li></ul></ul><ul><ul><li>Alternate function </li></ul></ul><ul><ul><li>External interrupt </li></ul></ul><ul><li>In addition, drive c/cs can be configured. </li></ul><ul><li>Bit manipulation is allowed. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  17. 17. GPIO Configuration Modes Amr Ali Abdel-Naby@2011 Introduction to STM32
  18. 18. Alternate Functions/Event Control <ul><li>AF remaps GPIO pin to a peripheral function. </li></ul><ul><ul><li>USART, SPI… </li></ul></ul><ul><li>A remap register controls: </li></ul><ul><ul><li>JTAG configuring </li></ul></ul><ul><ul><li>Mapping pins to alternate functions </li></ul></ul><ul><li>Event control can generate events. </li></ul><ul><ul><li>Events can wakeup another CPU. </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  19. 19. External Interrupts <ul><li>19 EXTIs </li></ul><ul><ul><li>16 connected to the GPIOs </li></ul></ul><ul><ul><li>Remaining 3 are connected to: </li></ul></ul><ul><ul><ul><li>RTC </li></ul></ul></ul><ul><ul><ul><li>USB Wake </li></ul></ul></ul><ul><ul><ul><li>Power voltage detection </li></ul></ul></ul><ul><li>Each of the 16 EXTIs can: </li></ul><ul><ul><li>Connect to any of the GPIO pins </li></ul></ul><ul><ul><li>Generate an event on interrupt </li></ul></ul><ul><ul><ul><li>Use by WFI or WFE </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  20. 20. EXTI Configuration Amr Ali Abdel-Naby@2011 Introduction to STM32
  21. 21. Analog to Digital Converter Amr Ali Abdel-Naby@2011 Introduction to STM32
  22. 22. Modes of Operation Amr Ali Abdel-Naby@2011 Introduction to STM32
  23. 23. Dual Conversion Modes Amr Ali Abdel-Naby@2011 Introduction to STM32
  24. 24. Simultaneous Modes Amr Ali Abdel-Naby@2011 Introduction to STM32
  25. 25. Combined Mode Amr Ali Abdel-Naby@2011 Introduction to STM32
  26. 26. Interleaved Modes Amr Ali Abdel-Naby@2011 Introduction to STM32
  27. 27. Alternate Trigger Mode Amr Ali Abdel-Naby@2011 Introduction to STM32
  28. 28. Combined Regular Simultaneous/Alternate Trigger Mode Amr Ali Abdel-Naby@2011 Introduction to STM32
  29. 29. Combined Injected Simultaneous/Alternate Trigger Mode Amr Ali Abdel-Naby@2011 Introduction to STM32
  30. 30. Timers <ul><li>1 x advanced timer for motor control + 3 x general purpose timers </li></ul><ul><li>16-bit counters with 16-bit prescalars and autoreload </li></ul><ul><li>Count up, count down, and centered counting </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  31. 31. Capture Compare Unit <ul><li>Capture mode: </li></ul><ul><ul><li>Can capture an external event twice to: </li></ul></ul><ul><ul><ul><li>Halt or reset the CPU </li></ul></ul></ul><ul><ul><ul><li>Generate an interrupt </li></ul></ul></ul><ul><ul><li>Can measure the period and the duty cycle of an external PWM </li></ul></ul><ul><ul><li>Can interface to a linear or a rotary encoder </li></ul></ul><ul><ul><ul><li>Determines speed, direction, and position of a device </li></ul></ul></ul><ul><li>Compare mode: </li></ul><ul><ul><li>Can compare a captured value to current timer value </li></ul></ul><ul><ul><ul><li>Generate an interrupt if detected </li></ul></ul></ul><ul><ul><ul><li>Change compare o/p </li></ul></ul></ul><ul><ul><li>Can generate PWM with period stored in timer and duty stored in capture unit </li></ul></ul><ul><ul><ul><li>One shot or periodic </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  32. 32. Advanced Features <ul><li>Break function (Advanced timer only) </li></ul><ul><ul><li>Based on a break input or CSS event the PWM can be put into a safe state </li></ul></ul><ul><li>Hall sensor interface </li></ul><ul><ul><li>Measure angular speed of a motor </li></ul></ul><ul><li>Timers synchronization </li></ul><ul><ul><li>Different timers can be synchronized together to form complex timer arrays. </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  33. 33. RTC and Backup Registers <ul><li>In backup power mode, we have: </li></ul><ul><ul><li>RTC </li></ul></ul><ul><ul><li>Independent WDT </li></ul></ul><ul><ul><li>10 x 16-bit registers to store critical values </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  34. 34. Serial Peripheral Interface <ul><li>2 x SPI peripherals </li></ul><ul><ul><li>1 on the high speed bus </li></ul></ul><ul><ul><li>1 on the low speed bus </li></ul></ul><ul><ul><li>Each can be a master/slave </li></ul></ul><ul><li>2 x DMA channels </li></ul><ul><li>2 x CRC units </li></ul><ul><ul><li>CRC8 or CRC16 </li></ul></ul><ul><ul><li>1 for transmit </li></ul></ul><ul><ul><li>1 for receive </li></ul></ul><ul><li>5 x interrupt sources </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  35. 35. Inter Integrated Circuit <ul><li>2 x I2C peripherals </li></ul><ul><ul><li>Each can be a master/slave </li></ul></ul><ul><li>2 x DMA channels </li></ul><ul><li>1 x PEC (Packet Error Check) </li></ul><ul><ul><li>Supports CRC8 </li></ul></ul><ul><li>14 x interrupt requests </li></ul><ul><li>Can support SMB (System Management Bus) and PMB (Power Management Bus) </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  36. 36. USART <ul><li>3 x USARTs </li></ul><ul><ul><li>1 on the high speed bus </li></ul></ul><ul><ul><li>2 on the low speed bus </li></ul></ul><ul><li>2 x DMA channels </li></ul><ul><li>10 x interrupt sources </li></ul><ul><li>IrDA, LIN, Modem, smart card support </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  37. 37. USART Example Usages Amr Ali Abdel-Naby@2011 Introduction to STM32
  38. 38. CAN Controller <ul><li>CAN2.0A and CAN2.0B support </li></ul><ul><li>Time-Triggered CAN (TTCAN) support </li></ul><ul><ul><li>Automatic messaging </li></ul></ul><ul><li>3 x transmit mailboxes </li></ul><ul><li>2 x receive mailboxes </li></ul><ul><li>Receive message filtering </li></ul><ul><ul><li>To avoid broadcasting over processing </li></ul></ul><ul><li>Silent mode and loopback modes </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  39. 39. Universal Serial Bus <ul><li>8 x end points </li></ul><ul><li>Control, interrupt, bulk, and isochronous modes of transfer </li></ul><ul><ul><li>Double buffering for isochronous mode </li></ul></ul><ul><li>Shares RAM with CAN </li></ul><ul><li>A powerful USB stack is available from ST </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  40. 40. Course Outline <ul><li>Introduction </li></ul><ul><li>Cortex Overview </li></ul><ul><li>CMSIS </li></ul><ul><li>STM32 System Architecture </li></ul><ul><li>Peripherals </li></ul><ul><li>Low Power Operation </li></ul><ul><li>Safety Features </li></ul><ul><li>The Flash Module </li></ul><ul><li>Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  41. 41. RUN Mode <ul><li>Highest level of power consumption </li></ul><ul><li>You can reduce power consumption by: </li></ul><ul><ul><li>Gating clocks of any unused peripherals </li></ul></ul><ul><ul><li>Switching of unneeded clock sources </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  42. 42. SLEEP Mode <ul><li>Entered by WFI or WFE </li></ul><ul><li>Only CPU halts </li></ul><ul><li>Left by an interrupt/event </li></ul><ul><li>You can reduce power consumption by disabling unneeded peripherals except those who will cause the wakeup. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  43. 43. STOP Mode <ul><li>Entered by WFI or WFE with SLEEPDEEP set and Power Down Deep Sleep bit cleared </li></ul><ul><li>All devices halt except memories and EXTI. </li></ul><ul><li>Wakes up by EXTI or RTC </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  44. 44. Standby Mode <ul><li>Entered by WFI or WFE with SLEEPDEEP set and Power Down Deep Sleep bit set </li></ul><ul><li>STM32 is really off </li></ul><ul><ul><li>Wakeup is like a reset </li></ul></ul><ul><li>Wakes up by: </li></ul><ul><ul><li>RTC </li></ul></ul><ul><ul><li>Reset or WDT reset </li></ul></ul><ul><ul><li>Rising edge on GPIOA0 </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  45. 45. Extra Features <ul><li>A backup region will be kept always alive contains: </li></ul><ul><ul><li>A battery backed RAM </li></ul></ul><ul><ul><li>RTC </li></ul></ul><ul><li>It is possible to configure the CoreSight debug to work on low power modes. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  46. 46. Course Outline <ul><li>Introduction </li></ul><ul><li>Cortex Overview </li></ul><ul><li>CMSIS </li></ul><ul><li>STM32 System Architecture </li></ul><ul><li>Peripherals </li></ul><ul><li>Low Power Operation </li></ul><ul><li>Safety Features </li></ul><ul><li>The Flash Module </li></ul><ul><li>Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  47. 47. Multiple Reset Sources Amr Ali Abdel-Naby@2011 Introduction to STM32
  48. 48. Power Voltage Detect Amr Ali Abdel-Naby@2011 Introduction to STM32
  49. 49. Clock Security System Amr Ali Abdel-Naby@2011 Introduction to STM32
  50. 50. Watchdog Timers Amr Ali Abdel-Naby@2011 Introduction to STM32
  51. 51. Peripherals Security <ul><li>GPIO locking </li></ul><ul><li>Analog watchdog input </li></ul><ul><li>Break input </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  52. 52. Course Outline <ul><li>Introduction </li></ul><ul><li>Cortex Overview </li></ul><ul><li>CMSIS </li></ul><ul><li>STM32 System Architecture </li></ul><ul><li>Peripherals </li></ul><ul><li>Low Power Operation </li></ul><ul><li>Safety Features </li></ul><ul><li>The Flash Module </li></ul><ul><li>Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  53. 53. Embedded Flash <ul><li>Byte loader </li></ul><ul><li>Prefetch buffer </li></ul><ul><li>3 regions: </li></ul><ul><ul><li>Main program memory </li></ul></ul><ul><ul><ul><li>4K pages write operations </li></ul></ul></ul><ul><ul><ul><li>1000 cycles write endurance </li></ul></ul></ul><ul><ul><ul><li>30 years data retention at 85C </li></ul></ul></ul><ul><ul><li>Big information block </li></ul></ul><ul><ul><ul><li>2 KB </li></ul></ul></ul><ul><ul><ul><li>Holds factory programmed bootloader </li></ul></ul></ul><ul><ul><li>Small information block </li></ul></ul><ul><ul><ul><li>8 configuration bytes </li></ul></ul></ul><ul><ul><ul><li>Defines reset properties and memory protection </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  54. 54. Course Outline <ul><li>Introduction </li></ul><ul><li>Cortex Overview </li></ul><ul><li>CMSIS </li></ul><ul><li>STM32 System Architecture </li></ul><ul><li>Peripherals </li></ul><ul><li>Low Power Operation </li></ul><ul><li>Safety Features </li></ul><ul><li>The Flash Module </li></ul><ul><li>Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32
  55. 55. Development Tools <ul><li>Compilers </li></ul><ul><ul><li>gcc, Keil, IAR… </li></ul></ul><ul><li>Evaluation boards </li></ul><ul><li>Debuggers </li></ul><ul><li>RTOS, libraries, protocol stacks </li></ul>Amr Ali Abdel-Naby@2011 Introduction to STM32

×