Skip to content

Peripheral access API for STM32H7 series microcontrollers

License

Notifications You must be signed in to change notification settings

TomDeRybel/stm32h7xx-hal

 
 

Repository files navigation

stm32h7xx-hal

docs.rs Bors enabled CI Crates.io Minimum rustc version

stm32h7xx-hal contains a hardware abstraction layer on top of the peripheral access API for the STMicro STM32H7xx family of microcontrollers. The idea behind this crate is to gloss over the slight differences in the various peripherals available on those MCUs so a HAL can be written for all chips in that same family without having to cut and paste crates for every single model.

This crate relies on Adam Greig's fantastic stm32h7 crate to provide appropriate register definitions, and implements a partial set of the embedded-hal traits. Much of the implementation was adapted from other HAL crates in the stm32-rs organisation.

Collaboration on this crate is highly welcome, as are pull requests!

Supported Configurations

  • stm32h743v (Revision V: stm32h742, stm32h743, stm32h750)
  • stm32h753v (Revision V: stm32h753
  • stm32h747cm7 (stm32h745, stm32h747, stm32h755, stm32h757)
  • stm32h7a3
  • stm32h7b0
  • stm32h7b3
  • stm32h735 (stm32h723, stm32h725, stm32h730, stm32h733, stm32h735)

Old revision STM32H742/743/750/753 parts

In 2019 ST released hardware Revision V of the stm32h742, stm32h743, stm32h750 and stm32h753 (eevblog). This hardware revision makes breaking hardware changes, documented in AN5312. If you have a device purchased before mid-2019, check the revision code on your device. Parts from the previous revision (Revision Y) are supported by feature gates without the 'v' suffix. (stm32h743, stm32h753)

Dual core parts (Cortex M7 + Cortex M4)

On dual core parts, currently only the Cortex M7 core is supported.

Family-specific memory.x

Each H7 device family has a somewhat different memory layout. To make starting a project easier, a specific example memory.x file is included for each family. You can use these to replace the memory.x included in this crate for the examples.

The memory layout for each device family is specified in their respective reference manual (RM). The table below relates the various parts to their applicable memory.x and reference manual.

RM memory.x Applicable devices
RM0399 memory_745_747_755_757.x stm32h745, stm32h747, stm32h755, stm32h757
RM0433 memory_742.x stm32h742
RM0433 memory_743_750_753.x stm32h743, stm32h750, stm32h753
RM0455 memory_7A3_7B0_7B3.x stm32h7a3, stm32h7b0, stm32h7b3
RM0468 memory_723_725_730_733_735.x stm32h723, stm32h725, stm32h730, stm32h733, stm32h735

To use these files, substitute memory.x by the applicable one and update the flash memory size as indicated below.

⚠️: If you use flip-link for stack overflow protection, there is one more change to make. Flip-link does not (yet) support the use of region aliases and expects an entry called RAM in the MEMORY block. The work-around is to comment-out the "REGION_ALIAS(RAM, DTCM)" line and manually substitute the RAM label in the respective MEMORY entry. Eg: replace DTCM by RAM.

Flash memory size

By default this crate assumes a 2Mbyte flash size. To set a smaller limit for linker errors, uncomment the correct FLASH section definition in memory.x

Getting Started

The examples folder contains several example programs. To compile them, specify the target device in a cargo feature:

$ cargo build --features=stm32h743v,rt

See the Examples README for more details.

To use stm32h7xx-hal as a dependency in a standalone project the target device feature must be specified in the Cargo.toml file:

[dependencies]
cortex-m = "0.7.1"
cortex-m-rt = "0.6.12"
stm32h7xx-hal = {version = "0.10.0", features = ["stm32h743v","rt"]}

If you are unfamiliar with embedded development using Rust, there are a number of fantastic resources available to help.

Hardware

Below is a short list of publicly available and documented STM32H7 development boards. Note that including them on this list does not mean they have been successfully tested with this crate. Some boards have a Board Support Crate (BSP) offering pin mappings and additional functionality.

Board Manufacturer BSP / Examples?
NUCLEO-H743ZI ST Examples
NUCLEO-H745ZI-Q ST BSP
STM32H743I-EVAL ST
STM32H747I-EVAL ST
STM32H747I-DISCO ST
Daisy Seed Electrosmith BSP
Portenta H7 ⚠️ Arduino
OpenH743I-C Waveshare
Toasty Webtronics

⚠️: Programming this board via its USB connector requires interacting with an unknown proprietary(?) bootloader. This bootloader may make it difficult or impossible for you to load binaries not approved by Arduino. Alternative programming interfaces are only available on the high density connectors.

Minimum supported Rust version

The Minimum Supported Rust Version (MSRV) at the moment is 1.52.0. Older versions may compile, especially when some features are not used in your application.

Changelog

See CHANGELOG.md.

License

0-Clause BSD License, see LICENSE-0BSD.txt for more details.

About

Peripheral access API for STM32H7 series microcontrollers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%