FAQ: STM32MP1 How to bring up STM32MP1
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Report Inappropriate Content
on
2020-05-29
10:43 AM
- edited on
2023-06-27
11:40 PM
by
Laurids_PETERSE
The new design board is received and you wonders how to get started.
Design is composed of STMP32MP1x, DDR RAM , STPMIC1 for power supply, a boot flash device.
How to configure the boot loaders to your application ?
What to check if the boot chains fails to start or return errors ?
What tool to download the software in Flash?
- Procedure
Describes what has to be configured to load for the first time :
- the TF-A FSBL in SYSRAM
- the Uboot SSBL in DRAM.
TF-A and Uboot firmwares can be loaded from serial link boot device (USB or UART) or from a boot flash device like Sdcard, eMMC, SLC NAND, Serial NAND, Serial NOR.
Additional resources:
- How to validate STM32MP1-DRAM connection on PCB
- We recommend strongly to read the Troubleshooting for classical issues
FAQ https://community.st.com/s/article/FAQ-STM32MP1-bring-up-troubleshooting-guide
or
https://wiki.st.com/stm32mpu/wiki/Bring-up_troubleshooting_grid
- Lab for TF-A& Uboot device tree creation for STM32MP1 part number adapted to your design with STM32CubeMx
- STM32MPU forum and other FAQs
in particular :
https://community.st.com/s/article/FAQ-STM32MP15-Tips-for-schematics-review
1 Adapt the TF-A configuration to your PCB application
- if your PCB is exactly the same as ST reference boards for the HSE/UART/IC24 for PMIC/DRAM/SDMMC sub-systems you can reuse the TF-A binary provide in the starter package.
- if your PCB is different from ST reference board -other STM32MP15x, DRAM, Flash, GPIOs-, the method is to create TF-A , OP-TEE, U-boot and Kernel device tree files from empty files and add the ‘nodes’ of the ST32MP1 peripherals used by your application.
The device tree files generated by STM32CubeMX are incomplete, it cannot be used as it.
Be careful, the default parameters presented in the wiki page may not be adapted to your design.
- This article below is a guideline to get an initial TF-A device tree from STM32CubeMx and ST reference device tree files. https://wiki.st.com/stm32mpu/wiki/How_to_create_your_board_device_tree#In_STM32STM32CubeMX
The purpose of this lab to create minimal device tree for TF-A and also for U-Boot that boots correctly.
Starting a 'bring up' device tree from STM32CubeMx MCU selector with the DK2 STM32MP157 part number (DK13 STM32MP135F) (project almost empty) it shows which nodes from a DK2 (DK13) STM32CubeMX project device tree to add in the ‘bring up’ device tree.
The slide set shows how to configure the clock tree (RCC), the STMPIC, the DDR controller, the UART for the console, USB for DFU. Further info in
https://community.st.com/s/article/FAQ-STM32MP1-How-to-create-a-device-tree-adapted-to-your-design-with-STM32CubeMx
This lab can be used as getting started to create your device tree files suitable for your STM32MP1 part number and your design. The nodes given as examples in the lab remains to be adapted to your design.
- Find further information about device tree HSE pin configuration depending on the choice of Crystal/resonator or Oscillator clock source https://wiki.st.com/stm32mpu/wiki/Clock_device_tree_configuration_-_Bootloader_specific#DT_configuration_for_HSE
- Please find further information about I2Cx configuration for PMIC I2Cx when you design does not use the default I2C4 in https://wiki.st.com/stm32mpu/wiki/How_to_create_your_board_device_tree#PMIC_configuration_via_I2C
2 Load & launch TF-A (without DDR initialization)
For example in FlashLayout_SD-Card_stm32mp157c-dk2-trusted.tsv file, keep the first line (Id 0x1) remove the others or tick on this line if STM32CubeProgrammer GUI is used .
STM32CubeProgrammer and ROM Code will load TF-A in internal SYSRAM and start it execution.
You should see the TF-A traces on the UART4 for traces enabled by default of TF-A.
More info about how to use STM32CubeProgrammer
https://wiki.st.com/stm32mpu/wiki/STM32MP15_Discovery_kits_-_Starter_Package#Downloading_the_image_and_flashing_it_on_the_board
Since Uboot SSBL is not loaded by STM32CubeProgrammer you should see the TF-A error complaining the SSBL is not not found.
3 Configuration of the DDR by T-FA
To build these files, there are 2 possibilities:
-your PCB contains a DDR3L@533Mhz you can re-use directly the ST reference boards (select the stm32mp15-ddr3-2x4Gb-1066-binG.dtsi or stm32mp15-ddr3-1x4Gb-1066-binG.dtsi according to your configuration). The timings can be applied for any DDR3L with the DDR Speed/bin Grade 1066-G .
-your PCB uses another DRAM (LPDDR2 for example), STM32CubeMX will help you to compute the DRAM timing configuration and will generate the TF-A device tree file relative to STM32MP1 DDR controller settings.
To get TF-A binary with DRAM timings save DRAM parameters to generate the dtsi DRAM file with the new parameters. Copy the files from CubeMx project in TF-A fdts folder, recompile TF-A.
More info in : https://wiki.st.com/stm32mpu/wiki/DDRCTRL_and_DDRPHYC_device_tree_configuration
Reload the TF-A with STM32CubeProgrammer and the ROMcode
and should see the TF-A trace (dk2 example on ecosystem V1.0.0) :
INFO: Memory size = 0x20000000 (512 MB) ……
SP_MIN: Preparing exit to normal world "
More info to compile in Developper Package the TF-A (and Uboot) device tree https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Developer_Package#Updating_BOOT_firmwares
3/DDR test
Two possibilities:
-
DRAM works, no strange behavior with Uboot at this stage, skip the Cube MX DDR tool suite step.
If your layout regarding DRAM-STM32MP1 chipset is picked-up from ST layout examples or from ST boards, Signal integrity tests have been passed on the DRAM-STM32MP1 connecxion.
-
DRAM does not work fine
1 Check the pin muxing of the DRAM signals against PCB schematics
2 Measure the voltages VDD-DDR, VREF_DDR, VDD-VTT (if present) on the PCB. Double check the voltage values in device tree STPMIC node of Uboot-SPL
3 Check DRAM timings (for DDR3 Speed bin / grade) against data sheet of DRAM
4 Run the all the DDR tests with STM32CubeMX DDR tool.
How to run DRAM tests with the STM32CubeMX DDR suite ?
The DRAM test suite is Uboot-SPL FSBL in Uboot source files. Uboot-SPL binary is compiled in the developer package. Uboot-SPL for eval board or DK boards can be used directly if the PCB is similar (DDR3L, STPMIC, UART4, HSE digital by pass, USB-OTG)
If the PCB is different from ST board adjust to PCB the device tree files of Uboot-SPL.
HSE, Uart trace, I2Cx STPMIC pin : should have the same as TF-A nodes for these peripherals. Recompile Uboot-SPL in Uboot folder (device tree files are shared between Uboot and Uboot-SPL).
Behind STM32CubeMX DDR suite, STM32CubeProgrammer and ROM Code in DFU mode the loads & launches in SYSRAM the Uboot-SPL firmware. The STM32CubeMX DDR suite on PC controls DRAM tests executed by Uboot-SPL on target over UART4.
Boot pin are set on serial boot device. In STM32CubeMX DDR tool suite "Connect" via UART4 (or VCP with ST-link) to STM32MP1. In the tool GUI, read the info bubbles to get the precise instructions.
If DRAM tests are failing or application has strange behaviors
-double check DRAM connections in the schematics or in the layout
-is there supply noise on VDDQ_DDR, DDR_VREF pin ?
-does the DDR signal tracks length comply with the AN5122 constraints ?
-24MHz Oscillator on HSE pin must be used if design includes LTCD // outputs, see errata sheet.
-There is additional DDR controller settings in CubeMX DDR parameters are described in AN5168, Impedance on DQ/DQS byte line can be modified as per AN5168 § 5 or relax timings AN5168 §6.
4 Check Uboot configuration
Adapt form STM32CubeMx <project name >-u-boot.dtsi and dts files according to your board with the same TF-A method as above (illustration of the explained above in lab Lab-BringUpFromPartNumber).
Uboot needs USB OTG node for Uboot flashloading with STM32 CubeProgrammer.
Especially OTG_VBUS and OTG_ID pin need different uboot device tree configuration whether the pin are connected to USB connector or not.
See https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#USB_OTG_node
Note that the .dts file of Uboot is the same as the .dts file of the kernel. The <project name>_uboot.dtsi is an overlay if the .dts file of Uboot which overloads the values is the nodes.
5 Load Uboot in DRAM
6 Kernel bring-up
Same T-FA method above, start from a dts file where all the peripheral nodes are disabled.
For each of them you have the device tree a first description in the wiki to add the adapted properties according to your PCB in the peripheral nodes.
Entry for the device tree description : https://wiki.st.com/stm32mpu/wiki/Category:Device_tree_configuration
Also rely on the ST reference boards device tree files and relative schematics as example.
Note that when your flash boot device is not available or tested, It is also possible to boot the kernel with initramfs. In this case STM32CubeProgrammer load in DRAM the root filesystem (rootfs).
7 Check your device trees with hardware design
Check your device trees compared to your hardware design
AN2606 chapter 4.3 Hardware connection requirements Available here: https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf
8 Boot from a flash device
At this point TF-A and Uboot are configured to your PCB and can be loaded from serial boot device with ST32MPCubeProgrammer.
Now these partitions containing TF-A, Uboot can be flashed then loaded to boot the kernel.
Prior to boot the kernel from flash, partitions has to be written TF-A raw patition, FIP partition (Uboot and SecureMonitor),bootfs (Kernel), rootfs (Kernel modules and Uerland libraries), userfs, ...
See https://wiki.st.com/stm32mpu/wiki/STM32MP15_Flash_mapping
STM32CubeProgrammer and Uboot flashing service allow to write the partitions into the flash device.
you have to create the corresponding .tsv input file according to your flash device partition
.stv file from Starter Package can be a starting point.
Further information in https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout#Typical_FlashLayout_file_without_FIP.
When boot device is a SLC NAND some Uboot configuration is needed to get a correct memory flashing.
https://wiki.st.com/stm32mpu/wiki/FMC_device_tree_configuration#DT_configuration_of_the_NAND_Flash_controller_-28board_level-29
if you have difficulties to boot from flash, see troubleshooting items to go further in details.
Back ground knowledge
Further information in RefMan 0436rv4:
Keywords : STM32MP1 , bring up
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Inappropriate Content
is it possible to use this methods on dk2 board?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Inappropriate Content
Almost none of the links in this document still work.