Programming with STM32: Getting Started with the Nucleo Board and C/C++

Book description

Create your own STM32 programs with ease!

Get up and running programming the STM32 line of microcontrollers from STMicroelectronics using the hands-on information contained in this easy-to-follow guide. Written by an experienced electronics hobbyist and author, Programming with STM32: Getting Started with the Nucleo Board and C/C++ features start-to-finish projects that clearly demonstrate each technique. Discover how to set up a stable development toolchain, write custom programs, download your programs to the development board, and execute them. You will even learn how to work with external servos and LED displays!

•Explore the features of STM32 microcontrollers from STMicroelectonics
•Configure your Nucleo-64 Microcontroller development board
•Establish a toolchain and start developing interesting applications
•Add specialized code and create cool custom functions
•Automatically generate C code using the STM32CubeMX application
•Work with the ARM Cortex Microcontroller Software Interface Standard and the STM hardware abstraction layer (HAL).
•Control servos, LEDs, and other hardware using PWM
•Transfer data to and from peripheral devices using DMA
•Generate waveforms and pulses through your microcontroller’s DAC


Table of contents

  1. Cover
  2. Title Page
  3. Copyright Page
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. Preface
  8. 1 Introduction to the STMicroelectronics Line of Microcontrollers
    1. Microcomputer vs Microcontroller
    2. STM Nucleo Boards
      1. Principal MCU Components
      2. Bit Serial Ports
      3. Nucleo-64 Board Options
    3. Summary
  9. 2 STM MCU Software
    1. Open-Source versus Commercial Proprietary Software
    2. Bare Metal Development
      1. Brief History of MCU
    3. The MCU Toolchain
      1. Configuring a STM32 Toolchain
    4. Summary
  10. 3 STM32CubeMX Application
    1. Pinout Tab
      1. MCU Alternative Functions
      2. Integrated Peripheral (IP) Tree Pane
    2. Creating an Example Project using CubeMX
      1. The main.c Code Listing
    3. ARM Cortex Microcontroller Software Interface Standard (CMSIS)
      1. CubeMX-Generated C Code
      2. Compiling and Downloading the Project
      3. Downloading the Hex Code
    4. Summary
  11. 4 STM Project Development
    1. Hello World Project
      1. Creating the Hello Nucleo Project
      2. Adding Functionality to the Program
      3. Compiling and Executing the Modified Program
      4. Simple Modification for the main.c Function
      5. Complex Modification for the main.c File
    2. Summary
  12. 5 General-Purpose Input Output (GPIO) and the STM Hardware Abstraction Layer (HAL)
    1. Memory-Mapped Peripherals
    2. Core Memory Addresses
    3. Peripheral Memory Addresses
    4. HAL_GPIO Module
      1. GPIO Pin Hardware
      2. LED Test Demonstration
      3. Enabling Multiple Outputs
      4. Push-Button Test Demonstration
    5. Clock Speed Demonstration
      1. Setting the Pin Clock Speeds
    6. Summary
  13. 6 Interrupts
    1. Interrupts
      1. NVIC Specifications
    2. Interrupt Process
      1. External Interrupts
      2. Interrupt Demonstration
    3. Summary
  14. 7 Timers
    1. STM Timer Peripherals
    2. STM Timer Configuration
      1. Update Event Calculation
    3. Polled or Non-interrupt Blink LED Timer Demonstration
      1. Test Run
    4. Interrupt-Driven Blink LED Timer Demonstration
      1. Test Run
    5. Multi-rate Interrupt-Driven Blink LED Timer Demonstration
      1. Test Run
    6. Modification to the Multi-rate Program
      1. Test Run
    7. Summary
  15. 8 Bit Serial Communications
    1. UARTs and USARTs
      1. USART Configuration
      2. Windows Terminal Program
      3. Enabling USART2
    2. USART Transmit Demonstration Program
      1. Test Run
    3. USART Receive Demonstration Program
      1. Test Run
    4. Summary
  16. 9 Analog-to-Digital Conversion
    1. ADC Functions
      1. ADC Module with HAL
      2. ADC Conversion Modes
      3. Channels, Groups, and Ranks
      4. ADC Demonstration
      5. ADC Demonstration Software
    2. Summary
  17. 10 Pulse Width Modulation (PWM)
    1. General-Purpose Timer PWM Signal Generation
    2. Timer Hardware Architecture
    3. PWM Signals with HAL
      1. Enabling the PWM Function
    4. PWM Demonstration Software
      1. Demonstration One
      2. Demonstration Two
      3. Demonstration Three
      4. Demonstration Four
      5. Adding Functional Test Code
      6. Test Results
    5. Summary
  18. 11 Direct Memory Access (DMA) and the Digital-to-Analog Converter (DAC)
    1. DMA
      1. Basic Data Transfer Concepts
      2. DMA Controller Details
      3. Using HAL with DMA
      4. Demonstration One
    2. DAC Peripheral
      1. DAC Principles
      2. HAL Software for the DAC
      3. Demonstration Two
      4. Demonstration Three
    3. Summary
  19. Index

Product information

  • Title: Programming with STM32: Getting Started with the Nucleo Board and C/C++
  • Author(s): Donald Norris
  • Release date: March 2018
  • Publisher(s): McGraw-Hill Education TAB
  • ISBN: 9781260031324