Skip to content

Simple example of using SPI on the STM32 Nucleo-F411RE board

Notifications You must be signed in to change notification settings

ideak/zephyr-stm32-spi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stm32-spi

Overview

A simple example of using an STM32 Nucleo-F411RE board to transfer data over the SPI bus.

Building and Running

First set up Zephyr according to its Getting Started Guide using its West tool.

For this project I haven't used the Zephyr SDK, rather (on Ubuntu/cosmic) just followed the Building on Linux without the Zephyr SDK by installing gcc-arm-none-eabi and setting CROSS_COMPILE and ZEPHYR_TOOLCHAIN_VARIANT accordingly (done by configure.sh below, for details see the Zephyr documentation).

Based on the above after installing Zephyr and gcc-arm-none-eabi, you can just run inside the checked out dir of this repo:

$ configure.sh

to create the build dir and the build scripts within. Then - either initially or whenever you change the source:

$ cd build
$ ninja
$ ninja flash

to build and flash the image to your board.

Going further you may also want to customize the Zephyr core configuration - and then rebuild the image as you did above - with:

$ ninja menuconfig

for instance to enable debugging, choose another SPI module instead of SPI1 the app uses by default, or just to get furhter ideas of all the cool stuff you can do with Zephyr. Or just to have a Déjà vu experience ;)

See the comment in src/main.c for details about the board specific SPI pin config and MCU specific low-level bus programming (both taken care for us by the Zephyr core).

You may also find it useful to read about the Nucleo-F411RE board's pinout layout, schematic, user manual and the STM32-F411RE MCU's datasheet and reference manual.

Sample Output

$ cu -l /dev/ttyACM0
Connected.
***** Booting Zephyr OS zephyr-v1.14.0-719-gbba534299244 *****
Starting stm32-spi on nucleo_f411re

scope.png

About

Simple example of using SPI on the STM32 Nucleo-F411RE board

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published