2021-10-25 06:29 AM
Hello, my main seriale console should be USART2 instead of UART4. I modified the kernel dts as follows:
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
ethernet0 = ðernet0;
mmc0 = &sdmmc1;
mmc1 = &sdmmc2;
serial0 = &usart2;
};
and it configures correctly the kernel console.
If I try the same modification in tf-a and u-boot dts, at boot i see the log starting on uart4, but it blocks at this point
Preparing exit to normal world
No serial driver found
Should I modify some boot env too?
Solved! Go to Solution.
2021-10-28 02:05 AM
Hi, I have this log on uart4 (even if it should be disabled)
NOTICE: CPU: STM32MP157CAA Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157C eval daughter on eval mother
INFO: Reset reason (0x14):
INFO: Pad Reset from NRST
INFO: PMIC version = 0x21
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe3000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using USB
INFO: Instance 2
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.4-r1.0(debug):4d81224-dirty
NOTICE: BL2: Built : 13:23:30, Jun 15 2021
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-DDR3L 32bits 533000Khz
WARNING: Couldn't find property st,phy-cal in dtb
INFO: Memory size = 0x40000000 (1024 MB)
INFO: DFU USB START...
INFO: phase ID :0, Manifestation 0 at c0000244
INFO: phase ID :3, Manifestation 3 at c8101006
INFO: Send detach request
INFO: Receive DFU Detach
INFO: DFU USB STOP...
INFO: BL2: Loading image id 31
INFO: Loading image id=31 at address 0x2ffff000
INFO: Image id=31 loaded: 0x2ffff000 - 0x2ffff226
INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0x2ffff000
INFO: FCONF: Reading firmware configuration information for: dyn_cfg
INFO: FCONF: Reading firmware configuration information for: stm32mp1_firewall
INFO: BL2: Loading image id 4
INFO: Loading image id=4 at address 0x2ffc5000
INFO: Image id=4 loaded: 0x2ffc5000 - 0x2ffd847c
WARNING: Not a known TEE, use default loading options.
INFO: BL2: Skip loading image id 21
INFO: BL2: Skip loading image id 22
INFO: BL2: Loading image id 23
INFO: Loading image id=23 at address 0xc0500000
INFO: Image id=23 loaded: 0xc0500000 - 0xc051e86c
INFO: BL2: Loading image id 26
INFO: Loading image id=26 at address 0x2ffc0000
INFO: Image id=26 loaded: 0x2ffc0000 - 0x2ffc47f8
INFO: BL2: Loading image id 5
INFO: Loading image id=5 at address 0xc0100000
INFO: Image id=5 loaded: 0xc0100000 - 0xc01ca800
NOTICE: BL2: Booting BL32
INFO: Entry point address = 0x2ffc5000
INFO: SPSR = 0x1d3
this is the log of the programmer cli:
-------------------------------------------------------------------
STM32CubeProgrammer v2.7.0
-------------------------------------------------------------------
USB speed : High Speed (480MBit/s)
Manuf. ID : STMicroelectronics
Product ID : DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
SN : 003400463030510139393639
FW version : 0x0110
Device ID : 0x0500
Device name : STM32MP1
Device type : MPU
Device CPU : Cortex-A7
Start Embedded Flashing service
Memory Programming ...
Opening and parsing file: debug-tf-a-stm32mp157c-ev1-usb.stm32
File : debug-tf-a-stm32mp157c-ev1-usb.stm32
Size : 225656 Bytes
Partition ID : 0x01
Download in Progress:
██████████████████████████████████████████████████ 100%
File download complete
Time elapsed during download operation: 00:00:00.486
RUNNING Program ...
PartID: :0x01
Start operation done successfully at partition 0x01
Flashlayout Programming ...
██████████████████████████████████████████████████ 100%
Running Flashlayout Partition ...
Flashlayout partition started successfully
Memory Programming ...
Opening and parsing file: stm32mp157c_eutron_mtb_fip.bin
File : stm32mp157c_eutron_mtb_fip.bin
Size : 1052678 Bytes
Partition ID : 0x03
Download in Progress:
██████████████████████████████████████████████████ 100%
File download complete
Time elapsed during download operation: 00:00:01.395
RUNNING Program ...
PartID: :0x03
Reconnecting the device ...
Error:
Unable to reconnect the target device: time out expired
Error: Start operation failed at partition 0x03
Error: TSV flashing service failed
2021-10-28 06:09 AM
Hello,
Can I have your .tsv file please?
And did you replace the tf-a used inside your tsv, by the new one generated with the developer package?
Because the name of the tf-a downloaded: debug-tf-a-stm32mp157c-ev1-usb.stm32 looks like the default binary delivered by the starter package.
Just a reminder to how to use the tsv file: https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout#Updating_partitions
Did you have some traces on USART2, too?
Regards,
Kevin
2021-11-10 01:22 AM
Hello @Lmoio.1 ,
Did you fix your problem with CubeProgrammer?
Regards,
Kevin
2021-11-10 03:30 AM
Usually I generate a new fip binary and update that one in the .tsv, I leave stm32 as default.
Anyway, now it seems to work with the new uart after adding new address in CONFIG_DEBUG_UART_BASE.
Thank you
2021-11-12 04:04 AM
Hello,
I have the same issue in my new board with STM32MP151aaaa SoC.
We decided to use the USART1 as DEBUG console, so the device-tree generated by STMCubeMX (with slightly adaption [i.e. some includes and a specific chosen=... node and u-boot,dm-pre-reloc]) and write over an SD Card to boot up from it.
Enabling the USART1 in the SPL mode:
#ifdef CONFIG_DEBUG_UART_BOARD_INIT
void board_debug_uart_init(void)
{
#if (CONFIG_DEBUG_UART_BASE == STM32_USART1_BASE)
/* On EUREK EK440 Board we are using USART1_TX and USART1_RX with PINS
* Uart1 TX = Z7
* Uart1 RX = Z6
*/
#define RCC_MP_APB5ENSETR (STM32_RCC_BASE + 0x0208)
#define RCC_MP_AHB5ENSETR (STM32_RCC_BASE + 0x0210)
/* UART1 clock enable */
setbits_le32(RCC_MP_APB5ENSETR, BIT(4));
#define GPIOZ_BASE 0x54004000
/* GPIOZ clock enable */
writel(BIT(0), RCC_MP_AHB5ENSETR);
/* GPIO configuration for EUREK EK440 boards: Uart1 TX = Z7, RX = Z6 */
/* GPIOx_MODER Z6 and Z7 = 31..0
* 1111 1111 1111 1111
* 1010 1111 1111 1111 --> MODER7 & MODER6 (Z7 and Z6)
*/
writel(0xffffafff, GPIOZ_BASE + 0x00);
/* GPIOZ GPIOx_AFRL AFR7 for PIN 7 & PIN 6
* 0111 0111 0000 0000 ---> AFR7 and AFR6
* 0000 0000 0000 0000
*/
writel(0x77000000, GPIOZ_BASE + 0x20);
#else
#error("CONFIG_DEBUG_UART_BASE: not supported value")
#endif
}
#endif
and adding the correct setup in .dts file as:
aliases {
u-boot,dm-pre-reloc;
ethernet0 = ðernet0;
serial0 = &XX_DEBUG_UART_XX;
serial1 = &usart2;
serial2 = &XX_NORMAL_UART_XX;
serial3 = &uart4;
};
chosen {
u-boot,dm-pre-reloc;
stdout-path = "serial0:115200n8";
};
Where XX_DEBUG_UART_XX is usart1 and XX_NORMAL_UART_XX is usart3
On serial debug (i.e. over a usart1 adapter over an FTDI 232RL Chip) I am able to see the SPL running on boot as I can see:
pinctrl_stm32 pin-controller@50002000: periph->name = serial@5c000000
serial_stm32 serial@5c000000: prop pinctrl-0 index 0 invalid phandle
clk id 148 not found
serial_stm32 serial@5c000000: failed to enable clock
And after that, I can see the following (I suppose it is u-boot SSBL or something different from above, because last two lines)
pinctrl_stm32 pin-controller@50002000: periph->name = serial@5c000000
serial_stm32 serial@5c000000: prop pinctrl-0 index 0 invalid phandle
clk id 148 not found
serial_stm32 serial@5c000000: failed to enable clock
No serial driver found
resetting ...
And it loops forever.
I have already checked the rcc node is under the u-boot,dm-pre-reloc because I am suspecting the phandle of pinctrl-0 clk 148 is not in the device-tree node somewhere...
Can you explain that?
Regards,
Gianluca
2021-11-12 04:52 AM
Hi,
For the uboot project , I added CONFIG_DEBUG_UART_BASE=0x4000E000 (usart2 base address) in the defconfig, I added
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
ethernet0 = ðernet0;
mmc0 = &sdmmc1;
mmc1 = &sdmmc2;
serial0 = &usart2;
serial1 = &uart4;
};
&pinctrl {
usart2_pins_d: usart2-2 {
pins1 {
pinmux = <STM32_PINMUX('D', 5, AF7)>; /* USART2_TX */
bias-disable;
drive-push-pull;
slew-rate = <3>;
};
pins2 {
pinmux = <STM32_PINMUX('D', 6, AF7)>; /* USART2_RX */
bias-disable;
bias-pull-up;
};
};
usart2_idle_pins_d: usart2-idle-2 {
pins1 {
pinmux = <STM32_PINMUX('D', 5, ANALOG)>; /* USART2_TX */
};
pins2 {
pinmux = <STM32_PINMUX('D', 6, AF7)>; /* USART2_RX */
bias-disable;
};
};
usart2_sleep_pins_d: usart2-sleep-2 {
pins {
pinmux = <STM32_PINMUX('D', 5, ANALOG)>, /* USART2_TX */
<STM32_PINMUX('D', 6, ANALOG)>; /* USART2_RX */
};
};
};
&usart2 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart2_pins_d>;
pinctrl-1 = <&usart2_sleep_pins_d>;
pinctrl-2 = <&usart2_idle_pins_d>;
status = "okay";
};
in the .dts.
I added this part also in the dts of the tf-a project.
Then i generated the fip bianary file. When flashing, I see cubeprogrammer Logs on usart2.
2021-11-12 08:57 AM
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
2021-11-14 11:55 PM
@Lmoio.1 I did not write that, but my dts has the same descriptions/settings for the usart1 pins:
&usart1{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&usart1_pins_z_mx>;
pinctrl-1 = <&usart1_sleep_pins_z_mx>;
status = "okay";
};
and for the pinmux section:
&pinctrl_z {
u-boot,dm-pre-reloc;
usart1_pins_z_mx: usart1_mx-0 {
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('Z', 6, AF7)>; /* USART1_RX */
bias-disable;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('Z', 7, AF7)>; /* USART1_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
usart1_sleep_pins_z_mx: usart1_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
pinmux = <STM32_PINMUX('Z', 6, ANALOG)>, /* USART1_RX */
<STM32_PINMUX('Z', 7, ANALOG)>; /* USART1_TX */
};
};
};
Actually, STM32CubeMX does not include any _idle sections as yours, but I think it's not an issue. Using the following config for build u-boot:
CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_BASE=0x5C000000
CONFIG_LOG=y
CONFIG_LOG_CONSOLE=y
CONFIG_SPL_LOG=y
CONFIG_SPL_LOG_CONSOLE=y
and modifying accordingly the spl.c file to be adapted for usart1, I can clearly see the output in my serial terminal, so I suppose it's not a serial issue, but something else. Clocks? Initialization? During relocation?
Any ideas?
Regards,
Gianluca
2021-11-15 12:31 AM
Hi,
have you added in the tf-a dts the following:
DECPROT(STM32MP1_ETZPC_USART1_ID, DECPROT_NS_RW, DECPROT_UNLOCK).
Maybe it could be a problem related to GPIOZ pins assigned to the secure context? Can you post your log?
Lidia
2021-11-15 05:50 AM
I am not using TF-A, just normal SPL & u-boot load fsbl1 & fsbl2 and ssbl.
Is there any chance on JTAG debugging without having boot from SD Card? Just to know if there is a quick way to check whats happening.
I tried with openocd and gdb, and having break points in _start and _main it hangs on a cpu.c where security_init manage some busy loop tests. If I commented out the security_init, it crashes with undefined instruction in the update_bootmode() function.
I am very close to have a running custom board with it, but it is hard to find out what's going on. Anyway the low level serial output *IS ON THE RIGHT USART1* as I am seeing it crashing and resetting. So I suppose something about the relocation of the device-tree or not so well initialized device-tree structure in static RAM.
If I compile the u-boot & spl for STM32MP157C-DK2 (the EVK I own) it runs very good. And the differences are very little:
The devicetree from my point-of-view is automatically generated by STMCubeMX (latest version as today's) and the u-boot,dm-pre-reloc are in every node I need to use in the SPL.
Here is the configuration I am using in u-boot 2021-01-rc1:
CONFIG_ARM=y
CONFIG_ARCH_STM32MP=y
CONFIG_SYS_MALLOC_F_LEN=0x3000
CONFIG_SYS_MEMTEST_START=0xc0000000
CONFIG_SYS_MEMTEST_END=0xc4000000
CONFIG_ENV_OFFSET=0x280000
CONFIG_ENV_SECT_SIZE=0x40000
CONFIG_SPL_DM_SPI=y
CONFIG_DEFAULT_DEVICE_TREE="stm32mp151a-ek440-mx"
CONFIG_SPL_TEXT_BASE=0x2FFC2500
CONFIG_SPL_MMC=y
CONFIG_SPL=y
CONFIG_TARGET_ST_STM32MP15x=y
CONFIG_CMD_STM32KEY=y
CONFIG_CMD_STM32PROG=y
CONFIG_ENV_OFFSET_REDUND=0x2C0000
CONFIG_TYPEC_STUSB160X=y
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI=y
# CONFIG_ARMV7_VIRT is not set
CONFIG_DISTRO_DEFAULTS=y
CONFIG_SYS_LOAD_ADDR=0xc2000000
CONFIG_FIT=y
CONFIG_BOOTDELAY=1
CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
CONFIG_SPL_LOG=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
CONFIG_SPL_ENV_SUPPORT=y
CONFIG_SPL_I2C=y
CONFIG_SPL_MTD_SUPPORT=y
CONFIG_SPL_DM_SPI_FLASH=y
CONFIG_SPL_POWER=y
CONFIG_SPL_SPI_FLASH_MTD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
CONFIG_SYS_PROMPT="STM32MP> "
CONFIG_CMD_ADTIMG=y
CONFIG_CMD_ERASEENV=y
CONFIG_CMD_NVEDIT_EFI=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_UNZIP=y
CONFIG_CMD_ADC=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DFU=y
CONFIG_CMD_FUSE=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_CMD_BMP=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_EFIDEBUG=y
CONFIG_CMD_TIME=y
CONFIG_CMD_RNG=y
CONFIG_CMD_TIMER=y
CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_LOG=y
CONFIG_CMD_UBI=y
# CONFIG_SPL_DOS_PARTITION is not set
CONFIG_OF_LIVE=y
CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks"
CONFIG_ENV_IS_NOWHERE=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_IS_IN_UBI=y
CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
CONFIG_ENV_UBI_PART="UBI"
CONFIG_ENV_UBI_VOLUME="uboot_config"
CONFIG_ENV_UBI_VOLUME_REDUND="uboot_config_r"
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_SYS_MMC_ENV_DEV=-1
# CONFIG_SPL_ENV_IS_NOWHERE is not set
# CONFIG_SPL_ENV_IS_IN_SPI_FLASH is not set
CONFIG_STM32_ADC=y
CONFIG_SET_DFU_ALT_INFO=y
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
CONFIG_FASTBOOT_BUF_SIZE=0x02000000
CONFIG_FASTBOOT_USB_DEV=1
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y
CONFIG_FASTBOOT_MMC_BOOT1_NAME="mmc1boot0"
CONFIG_FASTBOOT_MMC_BOOT2_NAME="mmc1boot1"
CONFIG_FASTBOOT_MMC_USER_SUPPORT=y
CONFIG_FASTBOOT_MMC_USER_NAME="mmc1"
CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
CONFIG_FASTBOOT_CMD_OEM_PARTCONF=y
CONFIG_FASTBOOT_CMD_OEM_BOOTBUS=y
CONFIG_GPIO_HOG=y
CONFIG_DM_HWSPINLOCK=y
CONFIG_HWSPINLOCK_STM32=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_STM32F7=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_DM_MAILBOX=y
CONFIG_STM32_IPCC=y
CONFIG_STM32_FMC2_EBI=y
CONFIG_SUPPORT_EMMC_BOOT=y
CONFIG_STM32_SDMMC2=y
CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_SYS_MTDPARTS_RUNTIME=y
CONFIG_MTD_RAW_NAND=y
CONFIG_NAND_STM32_FMC2=y
CONFIG_SYS_NAND_ONFI_DETECTION=y
CONFIG_MTD_SPI_NAND=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
CONFIG_SPI_FLASH_MTD=y
CONFIG_PHY_REALTEK=y
CONFIG_DM_ETH=y
CONFIG_DWC_ETH_QOS=y
CONFIG_PHY=y
CONFIG_PHY_STM32_USBPHYC=y
CONFIG_PINCONF=y
# CONFIG_SPL_PINCTRL_FULL is not set
CONFIG_PINCTRL_STMFX=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_PMIC_CHILDREN is not set
CONFIG_PMIC_STPMIC1=y
CONFIG_DM_REGULATOR=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_DM_REGULATOR_STM32_VREFBUF=y
CONFIG_DM_REGULATOR_STPMIC1=y
CONFIG_REMOTEPROC_STM32_COPRO=y
CONFIG_DM_RNG=y
CONFIG_RNG_STM32MP1=y
CONFIG_DM_RTC=y
CONFIG_RTC_STM32=y
CONFIG_SERIAL_RX_BUFFER=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_STM32_QSPI=y
CONFIG_STM32_SPI=y
CONFIG_USB=y
CONFIG_DM_USB_GADGET=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
CONFIG_USB_GADGET_VENDOR_NUM=0x0483
CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
CONFIG_USB_GADGET_DWC2_OTG=y
CONFIG_DM_VIDEO=y
CONFIG_BACKLIGHT_GPIO=y
CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
CONFIG_VIDEO_STM32=y
CONFIG_VIDEO_STM32_DSI=y
CONFIG_VIDEO_STM32_MAX_XRES=1280
CONFIG_VIDEO_STM32_MAX_YRES=800
CONFIG_VIDEO_BMP_RLE8=y
CONFIG_BMP_16BPP=y
CONFIG_BMP_24BPP=y
CONFIG_BMP_32BPP=y
CONFIG_WDT=y
CONFIG_WDT_STM32MP=y
CONFIG_ERRNO_STR=y
CONFIG_FDT_FIXUP_PARTITIONS=y
# CONFIG_LMB_USE_MAX_REGIONS is not set
CONFIG_LMB_MEMORY_REGIONS=2
CONFIG_LMB_RESERVED_REGIONS=16
CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_STM32=y
CONFIG_DEBUG_UART_BASE=0x5C000000
CONFIG_LOG=y
CONFIG_LOG_CONSOLE=y
CONFIG_SPL_LOG=y
CONFIG_SPL_LOG_CONSOLE=y
Can anybody out-there give me an hint on to proceed further?
Regards,
Gianluca