boards/st/b_u585i_iot02a/doc/index.rst
.. zephyr:board:: b_u585i_iot02a
Overview
The B_U585I_IOT02A Discovery kit features an ARM Cortex-M33 based STM32U585AI MCU with a wide range of connectivity support and configurations. Here are some highlights of the B_U585I_IOT02A Discovery kit:
STM32U585AII6Q microcontroller featuring 2 Mbyte of Flash memory, 786 Kbytes of RAM in UFBGA169 package
512-Mbit octal-SPI Flash memory, 64-Mbit octal-SPI PSRAM, 256-Kbit I2C EEPROM
USB FS, Sink and Source power, 2.5 W power capability
802.11 b/g/n compliant Wi-Fi® module from MXCHIP
Bluetooth® Low Energy from STMicroelectronics
MEMS sensors from STMicroelectronics
2 push-buttons (user and reset)
2 user LEDs
Flexible power supply options
More information about the board can be found at the B U585I IOT02A Discovery kit website_.
Hardware
The STM32U585xx devices are an ultra-low-power microcontrollers family (STM32U5 Series) based on the high-performance Arm® Cortex®-M33 32-bit RISC core. They operate at a frequency of up to 160 MHz.
Ultra-low-power with FlexPowerControl (down to 300 nA Standby mode and 19.5 uA/MHz run mode)
Core: ARM® 32-bit Cortex®-M33 CPU with TrustZone® and FPU.
Performance benchmark:
Security and cryptography
Clock management:
Power management
RTC with HW calendar and calibration
Up to 136 fast I/Os, most 5 V-tolerant, up to 14 I/Os with independent supply down to 1.08 V
Up to 24 capacitive sensing channels: support touchkey, linear and rotary touch sensors
Up to 17 timers and 2 watchdogs
ART accelerator
Memories
Rich analog peripherals (independent supply)
Up to 22 communication interfaces
CRC calculation unit
Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell™
True Random Number Generator (RNG)
Graphic features
Mathematical co-processor
CORDIC for trigonometric functions acceleration
FMAC (filter mathematical accelerator)
More information about STM32U585AI can be found here:
STM32U585 on www.st.com_STM32U585 reference manual_.. zephyr:board-supported-hw::
The STM32U585i is an SoC with Cortex-M33 architecture. Zephyr provides support for building for both Secure and Non-Secure firmware.
The BOARD options are summarized below:
+-------------------------------+-------------------------------------------+ | BOARD | Description | +===============================+===========================================+ | b_u585i_iot02a | For building Trust Zone Disabled firmware | +-------------------------------+-------------------------------------------+ | b_u585i_iot02a/stm32u585xx/ns | For building Non-Secure firmware | +-------------------------------+-------------------------------------------+
Here are the instructions to build Zephyr with a non-secure configuration,
using :zephyr:code-sample:tfm_ipc sample:
.. code-block:: bash
$ west build -b b_u585i_iot02a/stm32u585xx/ns samples/tfm_integration/tfm_ipc/
Once done, before flashing, you need to first run a generated script that will set platform option bytes config and erase platform (among others, option bit TZEN will be set).
.. code-block:: bash
$ ./build/tfm/api_ns/regression.sh
$ west flash
Please note that, after having run a TFM sample on the board, you will need to
run ./build/tfm/api_ns/regression.sh once more to clean up the board from secure
options and get back the platform back to a "normal" state and be able to run
usual, non-TFM, binaries.
Also note that, even then, TZEN will remain set, and you will need to use
STM32CubeProgrammer_ to disable it fully, if required.
B_U585I_IOT02A Discovery kit has 9 GPIO controllers (from A to I). These controllers are responsible for pin muxing, input/output, pull-up, etc.
For more details please refer to B U585I IOT02A board User Manual_.
B_U585I_IOT02A Discovery System Clock could be driven by an internal or external oscillator, as well as the main PLL clock. By default the System clock is driven by the PLL clock at 80MHz, driven by 16MHz high speed internal oscillator.
B_U585I_IOT02A Discovery kit has 4 U(S)ARTs. The Zephyr console output is assigned to UART1. Default settings are 115200 8N1.
In order to test backup SRAM you may want to disconnect VBAT from VDD. You can
do it by removing SB6 jumper on the back side of the board.
Programming and Debugging
.. zephyr:board-supported-runners::
B_U585I_IOT02A Discovery kit includes an ST-LINK/V3 embedded debug tool interface. This probe allows to flash the board using various tools.
The board is configured to be flashed using west STM32CubeProgrammer_ runner,
so its :ref:installation <stm32cubeprog-flash-host-tools> is required.
Alternatively, OpenOCD or JLink can also be used to flash the board using
the --runner (or -r) option:
.. code-block:: console
$ west flash --runner openocd $ west flash --runner jlink
Connect the B_U585I_IOT02A Discovery kit to your host computer using the USB port, then run a serial host program to connect with your Discovery board. For example:
.. code-block:: console
$ minicom -D /dev/ttyACM0
Then, build and flash in the usual way. Here is an example for the
:zephyr:code-sample:hello_world application.
.. zephyr-app-commands:: :zephyr-app: samples/hello_world :board: b_u585i_iot02a :goals: build flash
You should see the following message on the console:
.. code-block:: console
Hello World! arm
Default flasher for this board is OpenOCD. It could be used in the usual way.
Here is an example for the :zephyr:code-sample:blinky application.
.. zephyr-app-commands:: :zephyr-app: samples/basic/blinky :board: b_u585i_iot02a :goals: debug
If you have flashed a sample to the board that enables TrustZone, you will need to disable it before you can flash and run a new non-TrustZone sample on the board.
To disable TrustZone, it's necessary to change AT THE SAME TIME the TZEN
and RDP bits. TZEN needs to get set from 1 to 0 and RDP,
needs to be set from DC to AA (step 3 below).
This is documented in the AN5347, in section 9_, "TrustZone deactivation".
However, it's possible that the RDP bit is not yet set to DC, so you
first need to set it to DC (step 2).
Finally you need to set the "Write Protection 1 & 2" bytes properly, otherwise some memory regions won't be erasable and mass erase will fail (step 4).
The following command sequence will fully deactivate TZ:
Step 1:
Ensure U23 BOOT0 switch is set to 1 (switch is on the left, assuming you read "BOOT0" silkscreen label from left to right). You need to press "Reset" (B2 RST switch) after changing the switch to make the change effective.
Step 2:
.. code-block:: console
$ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob rdp=0xDC
Step 3:
.. code-block:: console
$ STM32_Programmer_CLI -c port=/dev/ttyACM0 -tzenreg
Step 4:
.. code-block:: console
$ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp1a_pstrt=0x7f $ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp1a_pend=0x0 $ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp1b_pstrt=0x7f $ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp1b_pend=0x0 $ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp2a_pstrt=0x7f $ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp2a_pend=0x0 $ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp2b_pstrt=0x7f $ STM32_Programmer_CLI -c port=/dev/ttyACM0 -ob wrp2b_pend=0x0
.. _B U585I IOT02A Discovery kit website: https://www.st.com/en/evaluation-tools/b-u585i-iot02a.html
.. _B U585I IOT02A board User Manual: https://www.st.com/resource/en/user_manual/um2839-discovery-kit-for-iot-node-with-stm32u5-series-stmicroelectronics.pdf
.. _STM32U585 on www.st.com: https://www.st.com/en/microcontrollers-microprocessors/stm32u575-585.html
.. _STM32U585 reference manual: https://www.st.com/resource/en/reference_manual/rm0456-stm32u575585-armbased-32bit-mcus-stmicroelectronics.pdf
.. _STM32CubeProgrammer: https://www.st.com/en/development-tools/stm32cubeprog.html
.. _STMicroelectronics customized version of OpenOCD: https://github.com/STMicroelectronics/OpenOCD
.. _AN5347, in section 9: https://www.st.com/resource/en/application_note/dm00625692-stm32l5-series-trustzone-features-stmicroelectronics.pdf