Git Product home page Git Product logo

start-bluepill-zephyr's Introduction

Getting started with Zephyr RTOS on BluePill board

Project Initialization

Create a new project using PlatformIO with the following settings:

  • Board: BluePill F103C8 (Generic)
  • Framework: Zephyr RTOS

Upload

Using ST-LINK

There are several ways to upload the firmware to this board but the default way is to use the ST-Link debugger.

In linux, you can use the following commands to install the ST-Link drivers:

sudo apt -y install stlink-tools
sudo systemctl restart udev

Modify platformio.ini file to set stlink as default upload method:

upload_protocol = stlink

Now you can Upload the firmware to the board using PlaformIO.

You can also use st-flash tool for programming using ST-Link in linux:

st-flash write firmware.bin 0x8000000

Using UART and Embedded Bootloader

All the STM32 microcontrollers come with built-in bootloaders that burned in during production.

memory-mapping

A couple of special MCU pins has to be set-up to proper logical values to enter the bootloader. The pins are named BOOT0 and BOOT1 on the STM32 microcontroller. Boot pins can select several modes of bootloader operation:

BOOT1 BOOT0 Boot Mode Aliasing
X 0 Main Flash Memory Main flash memory is selected as boot space
0 1 System Memory System memory is selected as boot space
1 1 Embedded SRAM Embedded SRAM is selected as boot space

boot-mode

As you can see, there are three cases:

  • The first case is when the BOOT0 pin is tied to the ground, and BOOT1 is open or at a logical state of 0 after the reset program is executed from Main Flash Memory. Grounded BOOT pins are a standard configuration when executing programs in the field.
  • The second case (BOOT1=0; BOOT0=1) means that after reset execution starts at System memory were built into bootloader resides. This is the case when we need to upload binaries via USART1.
  • The third case means that program execution is performed in SRAM.

Read this article to understand how you can use UART1 for programming this board:

Supported Features in Zephyr

The stm32_min_dev board configuration supports the following hardware features:

Interface Controller Driver/Component
NVIC on-chip nested vectored interrupt controller
SYSTICK on-chip system clock
UART on-chip serial port
GPIO on-chip gpio
I2C on-chip i2c
PWM on-chip pwm
SPI on-chip spi
USB on-chip USB device
ADC on-chip adc

Other hardware features are not supported by the Zephyr kernel.

Connections and IOs

Default Zephyr Peripheral Mapping:

  • UART_1 TX/RX: PA9/PA10
  • UART_2 TX/RX: PA2/PA3
  • UART_3 TX/RX: PB10/PB11
  • I2C_1 SCL/SDA : PB6/PB7
  • I2C_2 SCL/SDA : PB10/PB11
  • PWM_1_CH1: PA8
  • SPI_1 NSS_OE/SCK/MISO/MOSI: PA4/PA5/PA6/PA7
  • SPI_2 NSS_OE/SCK/MISO/MOSI: PB12/PB13/PB14/PB15
  • USB_DC DM/DP: PA11/PA12
  • ADC_1: PA0

System Clock

The on-board 8Mhz crystal is used to produce a 72Mhz system clock with PLL.

Serial Port

STM32 Minimum Development Board has 3 U(S)ARTs. The Zephyr console output is assigned to UART_1. Default settings are 115200 8N1.

On-Board LEDs

The board has one on-board LED that is connected to PC13.

Pinout

bluepill-pinout

Schematics

bluepill-schematic

USB to Serial Cable

pl2303hxd-cable

USB to Serial (UART) cable is used to connect the board to a PC.

Blue Pill USB to Serial
A9 (TX1) RXD
A10 (RX1) TXD
G GND

Access to Serial Port in Linux

In order to upload the compiled program to your board you should have access to serial ports. This is done by adding your user to dialout and tty groups:

sudo usermod -a -G dialout $USER
sudo usermod -a -G tty $USER

You can verify if your user is added to dialout and tty groups using this command:

groups $USER

Note: You should log out and log in or reboot your computer to apply the changes.

Resources

start-bluepill-zephyr's People

Contributors

m3y54m avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.