Skip to contentSkip to conversation

help with serial on the rockchip64

U-Boot Sérgio de Almeida Lenzi 3 participants 5 messages Sep 24, 2019 – Sep 25, 2019

lore
Share & tools
lore
#0 lore raw

Hello...
I am having problem with the insane 1,500,000 bps baud rate serial2 port in rockchip64 I manage to configure the file in configs/rock64-rk3328_defconfig
and change it from 1500000 to 115200.. The ship starts to boot in 115200 than it writes on the serial line:
U-Boot SPL 2017.09 (Sep 24 2019 - 14:04:29)
board_init_sdmmc_pwr_en
setup_ddr_param 1
booted from SD
Trying to boot from MMC2
================================
after that it reverts to 1,500,000 bps
and writes:
================================
D:0x805 Y
In
LPDDR3
333MHz
Bus Width=32 Col=11 Bank=8 Row=15/15 CS=2 Die Bus-Width=32 Size=4096MB ddrconfig:7
OUT

NOTICE:  BL31: v1.3(release):22b599a
NOTICE:  BL31: Built : 09:06:22, Jul 12 2019
NOTICE:  BL31:Rockchip release version: v1.3
INFO:    ARM GICv2 driver initialized
INFO:    Using opteed sec cpu_context!
INFO:    boot cpu mask: 1
INFO:    plat_rockchip_pmu_init: pd status 0xe
INFO:    BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return
SMC_UNK
ERROR:   Error initializing runtime service opteed_fast
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x200000
INFO:    SPSR = 0x3c9

No serial driver found
### ERROR ### Please RESET the board ###
Where else must be done to make the chip continue in 115200 bps???

Thank for any help

Sergio

#1 lore raw
Quoted 5 lines · Sérgio de Almeida Lenzi

D:0x805 Y
In
LPDDR3
333MHz
...

This is output from Rockchip's binary-only loader, which always resets the UART speed to 1.5Mbps. But it should be running before the U-Boot SPL, not after it.

How are you building the microSD-card image? Here are the commands I've been using to build working images for the ROCK64:

Building U-Boot (note this will overwrite your configuration with the contents of the defconfig file):

make distclean; rm -f idbloader.img
make rock64-rk2238_defconfig all u-boot.itb

Assembling an image with the Rockchip loader:

tools/mkimage -n rk3328 -T rksd -d
~/src/rockchip-linux/rkbin/bin/rk33/rk3328_ddr_333MHz_v1.16.bin idbloader.img
cat spl/u-boot-spl.bin >> idbloader.img

Writing it to the microSD card:

sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 sudo dd if=u-boot.itb of=/dev/mmcblk0 seek=16384

Signature · 2 lines
Simon South
simon at simonsouth.net
#2 lore raw

Em ter, 2019-09-24 às 18:08 -0400, Simon South escreveu:

Quoted 2 lines

This is output from Rockchip's binary-only loader, which always resets the UART speed to 1.5Mbps. But it should be running before the U-Boot SPL, not after it.

I use NetBSD-9 and pkgsrc to build the u-boot
The NetBSD builds a fat32 partition starting at offset 32768 with 80Mb that holds the u-boot and boot logic for the rockchip

Quoted 1 line

How are you building the microSD-card image? Here are the commands I've been using to build working images for the ROCK64:

I burn the image on the sd card, and than I write the u-boot imgfile
using the command: dd if=/usr/pkg/share/u-boot/rock64/rksd_loader.img of=/dev/rsd0d seek=64 conv=sync note that NetBSD only uses ONE boot file...

In the fat32 partition there are 2 config files
cmdline.txt:
root=ld0a console=fb

config.txt:
arm_64bit=1
kernel=netbsd.img
kernel_address=0x200000
enable_uart=1
force_turbo=0

You said: Rockchip's binary-only loaderalways resets the UART speed to 1.5Mbps

So the binary-only loader is it within the rockchip or makes part of the u-boot code???

why does the Rockchip's binary-only loader is unable to detect the serial once I change the baud rate???

Thanks for your help

Sergio

#3 lore raw
Quoted 1 line · Sergio de Almeida Lenzi

note that NetBSD only uses ONE boot file...

Ah, I'm not familiar with the U-Boot package in NetBSD; I've been working from the main U-Boot repository. So I'm don't know how pkgsrc builds that image or what it contains.

Quoted 2 lines

So the binary-only loader is it within the rockchip or makes part of the u-boot code???

Neither. It's a separate, binary-only file released by Rockchip [1] that, until recently, U-Boot relied on to perform the initial system setup ahead of U-Boot's own secondary program loader (SPL) running.

Now U-Boot has its own, open-source tertiary program loader (TPL) that's meant to take the place of Rockchip's loader to initialize the system and launch the SPL---although I'm still struggling at the moment to get it working fully on my ROCK64. [2]

Quoted 2 lines

why does the Rockchip's binary-only loader is unable to detect the serial once I change the baud rate???

I don't think that message is coming from Rockchip's loader; it's being output from the "trusted firmware" (BL31) code. Rockchip's code exits after printing "OUT".

But regardless, I think the underlying problem is that the order of execution is wrong. The way I believe it's supposed to work (and the way things have been working for me) is

- First either the Rockchip loader or U-Boot's TPL runs, to do basic hardware setup (mostly just configuring the UART and SDRAM controller) and load the U-Boot SPL.

- The U-Boot SPL then finishes initializing the hardware and determines how the operating system is to be launched, by loading and executing a kernel or an EFI bootloader, for instance.

- Then the operating system runs and does everything else required to get to a login prompt.

From the output you sent it seems the U-Boot SPL is running _first_,
ahead of everything else. After that the Rockchip loader runs, re-initializing the hardware (including the UART, setting it back to the default speed) and once it and the trusted-firmware image have finished... there's nothing to hand control to next, since only the SPL actually knows how to launch an operating system and it's already exited.

All I can suggest right now is to try building a U-Boot image as described in my last email (which basically duplicates the instructions in older versions of U-Boot [3]) and see if you can get that working. If you can get that far, perhaps it will become apparent what the NetBSD package is doing differently and whether it ought to be changed.

[1]
https://github.com/rockchip-linux/rkbin/blob/master/bin/rk33/rk3328_ddr_333MHz_v1.16.bin
[2] https://lists.denx.de/pipermail/u-boot/2019-September/384076.html
[3]
https://gitlab.denx.de/u-boot/u-boot/blob/8b1ceb0ac1aa1746c6751d698ce7a012a236fa65/doc/README.rockchip

Signature · 2 lines
Simon South
simon at simonsouth.net
#4 lore raw
In reply to Simon South

Em ter, 2019-09-24 às 18:08 -0400, Simon South escreveu:

Quoted 2 lines

This is output from Rockchip's binary-only loader, which always resets the UART speed to 1.5Mbps. But it should be running before the U-Boot SPL, not after it.

I use NetBSD-9 and pkgsrc to build the u-bootThe NetBSD builds a fat32 partition starting at offset 32768 with 80Mb that holds the u-boot and boot logic for the rockchip

Quoted 1 line

How are you building the microSD-card image? Here are the commands I've been using to build working images for the ROCK64:

I burn the image on the sd card, and than I write the u-boot imgfileusing the command: dd if=/usr/pkg/share/u- boot/rock64/rksd_loader.img of=/dev/rsd0d seek=64 conv=syncnote that NetBSD only uses ONE boot file... In the fat32 partition there are 2 config files cmdline.txt:root=ld0a console=fb config.txt:arm_64bit=1kernel=netbsd.imgkernel_address=0x200000enable_uart=1force_turbo=0
You said: Rockchip's binary-only loaderalways resets the UART speed to 1.5Mbps
So the binary-only loader is it within the rockchip or makes part of the u-boot code???
why does the Rockchip's binary-only loader is unable to detect the serial once I change the baud rate??? Thanks for your help
Sergio