2023-10-19 02:52 AM
This article will take MYIR’s MYD-YF13X and STM32MP135F-DK as examples, and continue to explain how to use STM32CubeMX combined with the developer package to implement the booting of the minimal system.
https://www.myirtech.com/news_list.asp?id=879
Following "Bring up the STM32MP135x - ST Training Course based on MYD-YF13X (I)"
4. USB Boot
USB boot is used for burning im4.1.3 PWR
Power age to external flash, e.g. NAND, SD card, etc. The burning image from PC to external flash is completed by U-Boot combined with STM32Cube Programmer. Configuring and compiling U-Boot is a precondition for burning.
According to the STM32 MPU boot sequence:
TF-A->OP-TEE->U-BOOT->Linux Kernel
Loading U-Boot into the DDR depends on TF-A and OP-TEE, sothe configuration and compilation of TF-A, OP-TEE and U-Boot need to be completed in the USB boot phase.
4.1 USB Boot: TFA Configuration and Compilation
During the USB booting stage, the TFA needs to be configured with the following peripherals: Debug serial port UART, Clock RCC, Power Supply and DDR.
4.1.1 Debugging Serial Port UART
1. Review the schematic and find the debug serial port:
2. Enable UART4, configure the pins and the clock:
Note: The clock for USART4 is using HSI, one reason is to refer to the clock tree configuration of STM32MP135F-DK, and the other reason is to consider the application of serial port wake-up in low-power working mode. Excluding these two points, other clock sources can also be used.
3. Click "Generate code", and add the user code for the serial port configuration of the TFA stage.
Open the generated STM32CubeMX project, open the TF-A device tree (stm32mp135d-myir_bring_up-mx.dts), and add the nodes "choosen" and "aliases" at the "USER CODE BEGIN root".
/* USER CODE BEGIN root */
aliases {
serial0 = &uart4;
};
chosen {
stdout-path = "serial0:115200n8";
};
/* USER CODE END root */
4. (Optional) Compile the TFA USB image and deploy to the board.
Compile:
PC $> cd
PC $> source
PC $> make -f ../Makefile.sdk TF_A_CONFIG=usb TF_A_DEVICETREE=stm32mp135d-myir_bring_up-mx stm32
Deploy (please make sure the board is powered up, the serial cable and the USB cable are correctly connected before deploying):
PC $> STM32_Programmer_CLI -c port=usb1 -d ../deploy/tf-a-stm32mp135d-myir_bring_up-mx-usb.stm32 0x1 -s 0x1
Serial port printing:
NOTICE: CPU: STM32MP135F Rev.?
NOTICE: Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23
ERROR: nvmem node board_id not found
WARNING: VDD unknown
INFO: Reset reason (0x35):
INFO: Power-on Reset (rst_por)
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe0000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using USB
INFO: Instance 2
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.6-stm32mp1-r2.0(debug):v2.6-stm32mp-r2-4-g2dedc1cf0-dirty(2dedc1cf)
NOTICE: BL2: Built : 02:45:42, Jun 6 2023
INFO: BL2: Doing platform setup
ERROR: Invalid DDR init: error -22
PANIC at PC : 0x2ffe7739
Exception mode=0x00000016 at: 0x2ffe7739
5. Troubleshooting
If the serial port prints as follows in the previous step or does not print anything:
PANIC at PC : 0x2ffe7739
Exception mode=0x00000016 at: 0x2ffe7739
Then please confirm:
4.1.2 DDR
The following points need to be noted for the DDR configuration:
1. Check the schematic diagram of the DDR design section, confirm the size and frequency and other parameters, and complete the design of the DDR part.
Below are some examples of different DDR designs and their corresponding configurations:
Example 1: STM32MP157C-EV1, two pieces of SDRAM, 32bits, 1GBytes
The DDR frequency can be configured in the Configuration interface.
Example 2: STM32MP135F-DK, one piece of SDRAM, 16bits, 512Mbytes.
Now let’s take a look at the DDR design part of MYIR’s MYD-YF13X board:
One piece of SDRAM, 16bits, 256Mbytes, STM32CubeMX configured as follows: