Skip to content

In this repository I will upload a few demo examples of how to code STM32 MCU without using HAL. We will use only the peripheral driver provided by STMicroelectronics but in the first example we have showed how to write one by yourself using technical documentation.

Notifications You must be signed in to change notification settings

KrIsKa7a/STM32-MCU-BareMetalDemoCode

Repository files navigation

STM32-MCU-Bare Metal Demo Code

In this repository I will upload a few demo examples of how to code STM32 MCU without using HAL. We will use only the peripheral driver provided by STMicroelectronics but in the first example we have showed how to write one by yourself using technical documentation.

Used MCU's 📟

  1. STM32F103C8T6 - ARM®Cortex®-M3 32-bit RISC core based MCU. Used only in the first demo of writing peripheral drivers.
  2. STM32F722ZET6 - ARM® Cortex®-M7 32-bit RISC core based MCU. Used in all demos apart from the frist one. We will use it in NUCLEO-DEVELOPMENT Board.

Project Resolution 🚀

This repository was created only for educational purposes. At the end of the course I will consider doing a real-life example of Embedded Device and uploading it's code here. Our goal is to write Bare Metal Code using C and the technical documentation provided by STMicroelectronics. We will not use the provided HAL but we will use the provided peripheral driver for registers of the device.

Demo Projects 💡

  1. LED Toggle - Writing own Peripheral Driver - In this project we have written a code for toggling built-in LED. We created structs that represents GPIO and RCC registers structure.
  2. GPIO Output - In this project we are setting GPIO ports and pins as output pins using the provided GPIO struct from STM32CubeF7 Development package.
  3. GPIO Input and Output - In this project we are using GPIO ports and pins as input and output. We are doing a simple toggle LED with a button.
  4. USART-RX-TX - In this project we are configuring USART-RX-TX data transmission. Our device will work as a receiver and transmitter and will send data to a terminal inside our computer using Serial/TCP Terminal. We will also toggle the built-in LED using commands from the computer terminal.
  5. ADC - In this project we are configuring ADC Module. This allows us to read analog values from sensors measuring surrounding world parameters - Temperature, Pressure, Humidity, etc. We are configuring single channel in Single Conversion and Continious Conversion Mode. You can also add Multiple Channels easily to the written code.
  6. SysTick Timer - In this project we are using the Cortex-Mx built-in System Tick Timer. We are showing how to create a simple but very useful delay function.
  7. Timers - In this project we are developing driver for using Timer module in different modes - General-Purpose Mode, Input Capture Mode and Output Compare Mode. We show their usage for measuring time and creating interrupts, for toggling output and for measuring the frequency of input signal.
  8. Interrupts - In this project we are enabling interrupt programming model for different peripheral drivers we have already written. We are enabling EXTI handlers for GPIOs, UART, ADC, SysTick and TIM interrupts.
  9. DMA - In this project we are enabling DMA data transfer from the internal memory to the USART3 peripheral. We are using USART-TX in order to send data using our USB connection but this time we have enabled DMA for the transfer in order to speed-up the process.
  10. I2C - In this project we are developing driver for I2C module. We are configuring the connection to a slave and writing methods for burst read and burst write, according to the reference manual.
  11. SPI - In this project we are developing driver for SPI module. We are configuring the SPI module for full-duplex connection with hardware slave management. We are implementing methods for transmitting and receiving n bits of data.

Technical Documentation Used 🗎

  1. STM32F7x2 Datasheet
  2. STM32F7x2 Reference Manual
  3. NUCLEO DEVELOPMENT Board Datasheet
  4. ARM Cortex-M7 User Guide

About

In this repository I will upload a few demo examples of how to code STM32 MCU without using HAL. We will use only the peripheral driver provided by STMicroelectronics but in the first example we have showed how to write one by yourself using technical documentation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published