Enable uart1
peterbmckinley opened this issue · 6 comments
Hi Nick,
Fantastic work on the LicheePi Nano. I was hoping to use your repo as a starting point to getting the MangoPi-R3c board working, as the vendors Buildroot repo here is too badly broken and out of date in that it builds but the resulting sd card image fails to boot, with a kernel panic error.
The MangoPi-R uses the F1C200s, a drop-in replacement for the F1C100s but with 64MB RAM. The problem is that MangoPi use uart1 for debugging via an onboard CH340 uart to USB bridge (versions prior to the R3c used a CP2104).
I can easily modify your Buildroot menuconfig to use uart1 instead of the default uart0, as described here but I still get no output on the CH340.
Could your repo be modified to enable ttyS1 if it doesn't already, since the LicheePi Nano also exposes uart1 to the pin header?
If it helps, the boot log from the vendors repo is as follows. Note that the repo for Buildroot for the original Widora Tiny 200 that MangoPi SBC forked (here) behaves EXACTLY the same, so is presumed to be identical.
U-Boot SPL 2020.07 (Jan 29 2022 - 14:44:22 +0000)
DRAM: 64 MiB
Trying to boot from MMC1
U-Boot 2020.07 (Jan 29 2022 - 14:44:22 +0000) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Allwinner F1C100s Generic Device
DRAM: 64 MiB
MMC: mmc@1c0f000: 0, mmc@1c10000: 1
Setting up a 800x480 lcd console (overscan 0x0)
In: serial
Out: serial
Err: serial
Allwinner mUSB OTG (Peripheral)
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
Card did not respond to voltage select!
unrecognized JEDEC id bytes: ff, c8, 51
Failed to initialize SPI flash at 0:0 (error -2)
List of MTD devices:
- spi-nand0
- device: spi-nand@1
- parent: spi@1c05000
- driver: spi_nand
- type: NAND flash
- block size: 0x20000 bytes
- min I/O: 0x800 bytes
- OOB size: 128 bytes
- OOB available: 4 bytes
- 0x000000000000-0x000008000000 : "spi-nand0"
=========================
Boot Device: mmc0
Boot Slot 0: mmc0
Boot Slot 1: spi-nand
=========================
Error: "splash_mmc0" not defined
Unknown command 'bmp' - try 'help'
gpio: pin 134 (gpio 134) value is 1
switch to partitions #0, OK
mmc0 is current device
Booting from MMC0...
4327000 bytes read in 703 ms (5.9 MiB/s)
Loading kernel from FIT Image at 81000000 ...
Using 'conf@0' configuration
Trying 'kernel@0' kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: uncompressed
Data Start: 0x810000cc
Data Size: 4309536 Bytes = 4.1 MiB
Architecture: ARM
OS: Linux
Load Address: 0x80000000
Entry Point: 0x80000000
Hash algo: crc32
Hash value: 538d4a7d
Verifying Hash Integrity ... crc32+ OK
Loading fdt from FIT Image at 81000000 ...
Using 'conf@0' configuration
Trying 'fdt@0' fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x8141c3d0
Data Size: 15666 Bytes = 15.3 KiB
Architecture: ARM
Hash algo: crc32
Hash value: 61472816
Verifying Hash Integrity ... crc32+ OK
Booting using the fdt blob at 0x8141c3d0
Loading Kernel Image
Loading Device Tree to 817f9000, end 817ffd31 ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.99 (peter@peter-powermatemlxxx) (gcc version 8.4.0 (Buildroot -gfe8d6d3)) #1 Sat Jan 29 14:46:29 GMT 2022
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Widora MangoPi R3
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Reserved 16 MiB at 0x82c00000
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 15883
[ 0.000000] Kernel command line: console=ttyS0,115200 rootwait init=/preinit root=/dev/mtdblock2 rootfstype=squashfs overlayfsdev=/dev/mtdblock3 net.ifnames=0 vt.global_cursor_default=0
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 37232K/64036K available (6144K kernel code, 248K rwdata, 1676K rodata, 1024K init, 225K bss, 10420K reserved, 16384K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x254/0x444 with crng_init=0
[ 0.000050] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000145] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000895] Console: colour dummy device 80x30
[ 0.000999] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070272] pid_max: default: 32768 minimum: 301
[ 0.070809] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.070856] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.072807] CPU: Testing write buffer coherency: ok
[ 0.074961] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076200] devtmpfs: initialized
[ 0.088014] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.088079] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.092385] pinctrl core: initialized pinctrl subsystem
[ 0.094995] NET: Registered protocol family 16
[ 0.098722] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.101081] cpuidle: using governor menu
[ 0.141944] SCSI subsystem initialized
[ 0.142353] usbcore: registered new interface driver usbfs
[ 0.142521] usbcore: registered new interface driver hub
[ 0.142683] usbcore: registered new device driver usb
[ 0.143138] mc: Linux media interface: v0.10
[ 0.143264] videodev: Linux video capture interface: v2.00
[ 0.143376] pps_core: LinuxPPS API ver. 1 registered
[ 0.143397] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giometti@linux.it
[ 0.143457] PTP clock support registered
[ 0.144541] ion_parse_dt_heap_common: id 4 type 4 name cma align 1000
[ 0.145494] Advanced Linux Sound Architecture Driver Initialized.
[ 0.147959] clocksource: Switched to clocksource timer
[ 0.149766] simple-framebuffer 83e89000.framebuffer: framebuffer at 0x83e89000, 0x177000 bytes, mapped to 0x(ptrval)
[ 0.149822] simple-framebuffer 83e89000.framebuffer: format=x8r8g8b8, mode=800x480x32, linelength=3200
[ 0.176647] Console: switching to colour frame buffer device 100x30
[ 0.201899] simple-framebuffer 83e89000.framebuffer: fb0: simplefb registered!
[ 0.232541] thermal_sys: Registered thermal governor 'step_wise'
[ 0.233298] NET: Registered protocol family 2
[ 0.234866] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.234954] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.235019] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.235071] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.235385] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.235458] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.236018] NET: Registered protocol family 1
[ 0.238921] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.240730] Initialise system trusted keyrings
[ 0.241368] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.263466] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.264089] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.373445] Key type asymmetric registered
[ 0.373486] Asymmetric key parser 'x509' registered
[ 0.373671] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 0.373699] io scheduler mq-deadline registered
[ 0.373717] io scheduler kyber registered
[ 0.389187] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.412792] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.419091] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pa not found, using dummy regulator
[ 0.420445] printk: console [ttyS0] disabled
[ 0.440774] 1c25400.serial: ttyS0 at MMIO 0x1c25400 (irq = 26, base_baud = 6250000) is a 16550A
[ 0.908290] printk: console [ttyS0] enabled
[ 0.923403] SCSI Media Changer driver v0.25
[ 0.929424] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[ 0.942542] spi-nand spi0.0: GigaDevice SPI NAND was found.
[ 0.948262] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
[ 0.958166] 5 fixed-partitions partitions found on MTD device spi0.0
[ 0.964532] Creating 5 MTD partitions on "spi0.0":
[ 0.969447] 0x000000000000-0x000000100000 : "u-boot"
[ 0.980912] 0x000000100000-0x000000600000 : "kernel"
[ 0.987021] random: fast init done
[ 1.012754] 0x000000600000-0x000003000000 : "rom"
[ 1.182965] 0x000003000000-0x000004000000 : "vendor"
[ 1.253367] 0x000004000000-0x000007000000 : "overlay"
[ 1.436379] random: crng init done
[ 1.450087] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.456625] ehci-platform: EHCI generic platform driver
[ 1.462356] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.468681] ohci-platform: OHCI generic platform driver
[ 1.474451] usbcore: registered new interface driver usb-storage
[ 1.481572] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.495453] i2c /dev entries driver
[ 1.499772] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[ 1.513660] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[ 1.524686] sun4i-csi 1cb0000.csi: Packed (RAW) format enabled.
[ 1.532723] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[ 1.542736] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[ 1.581018] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[ 1.590483] usbcore: registered new interface driver usbhid
[ 1.596062] usbhid: USB HID core driver
[ 1.600370] sunxi-cedar 1c0e000.video-codec: sunxi cedar version 0.01alpha
[ 1.607609] sunxi-cedar 1c0e000.video-codec: cedar-ve the get irq is 19
[ 1.619918] debugfs: Directory '1c23c00.codec' with parent 'F1C100s Audio Codec' already present!
[ 1.635222] sun4i-codec 1c23c00.codec: Codec <-> 1c23c00.codec mapping ok
[ 1.651432] NET: Registered protocol family 17
[ 1.655998] Key type dns_resolver registered
[ 1.661724] Loading compiled-in X.509 certificates
[ 1.679858] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.697854] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.704711] ALSA device list:
[ 1.707702] #0: F1C100s Audio Codec
[ 1.712006] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.720732] cfg80211: failed to load regulatory.db
[ 1.729793] List of all partitions:
[ 1.733412] 1f00 1024 mtdblock0
[ 1.733422] (driver?)
[ 1.740069] 1f01 5120 mtdblock1
[ 1.740077] (driver?)
[ 1.746616] 1f02 43008 mtdblock2
[ 1.746621] (driver?)
[ 1.753217] 1f03 16384 mtdblock3
[ 1.753224] (driver?)
[ 1.759806] 1f04 49152 mtdblock4
[ 1.759814] (driver?)
[ 1.766337] No filesystem could mount root, tried:
[ 1.766343] squashfs
[ 1.771248]
[ 1.775021] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[ 1.783357] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.99 #1
[ 1.789085] Hardware name: Allwinner suniv Family
[ 1.793854] [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[ 1.801635] [] (show_stack) from [] (panic+0xe8/0x2e4)
[ 1.808527] [] (panic) from [] (mount_block_root+0x2bc/0x31c)
[ 1.816008] [] (mount_block_root) from [] (prepare_namespace+0x128/0x188)
[ 1.824538] [] (prepare_namespace) from [] (kernel_init+0x8/0x108)
[ 1.832453] [] (kernel_init) from [] (ret_from_fork+0x14/0x34)
[ 1.839999] Exception stack(0xc2839fb0 to 0xc2839ff8)
[ 1.845047] 9fa0: 00000000 00000000 00000000 00000000
[ 1.853214] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1.861375] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 1.867985] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2) ]---
Hope this helps!!
Peter
Hey, thanks for checking out this repo!
So if I understand correctly, are you trying to see U-Boot output on uart1 as well, or just Linux kernel console? Not sure if you already did that but the first step should be adding the uart1 node to the DTS (device tree) file for U-Boot as well as Linux kernel. Then menuconfig stuff as you already mentioned.
I have not looked into further DTS file modifications yet, could you try forking this repo (and/or https://github.com/unframework/linux/tree/nano-5.11) and adding the necessary changes? Sorry I could not be of more help yet, I am pretty new to embedded programming.
Hey, thanks for checking out this repo!
So if I understand correctly, are you trying to see U-Boot output on uart1 as well, or just Linux kernel console? Not sure if you already did that but the first step should be adding the uart1 node to the DTS (device tree) file for U-Boot as well as Linux kernel. Then menuconfig stuff as you already mentioned.
I have not looked into further DTS file modifications yet, could you try forking this repo (and/or https://github.com/unframework/linux/tree/nano-5.11) and adding the necessary changes? Sorry I could not be of more help yet, I am pretty new to embedded programming.
Hi sorry I realise I wasn't very clear. My problem is that I'm getting no console output at all using the sd card image from your repo, and I understand the reason is that the MangoPi-R3 uses uart1 for debug / login, not uart0.
"the first step should be adding the uart1 node to the DTS (device tree) file for U-Boot as well as Linux kernel". Unfortunately I don't know how to do this! Can you explain?
Peter
Hi having investigated further, I dont think the problem was whether UARTs were enabled or not, or which one was used. I compared the menuconfig of your build to the one from the vendor and have attached screenshots. I have edited yours to match the one for the MangoPi-R and am building now.
Because it doesn't look like the problem I had was related to whether certain peripherals were enabled in your build or not, I'm going to go ahead and close this issue. Thanks for your time! If necessary I will re-open it.
Peter
Hi having investigated further, I dont think the problem was whether UARTs were enabled or not, or which one was used. I compared the menuconfig of your build to the one from the vendor and have attached screenshots. I have edited yours to match the one for the MangoPi-R and am building now.
Because it doesn't look like the problem I had was related to whether certain peripherals were enabled in your build or not, I'm going to go ahead and close this issue. Thanks for your time! If necessary I will re-open it.
Peter
Sadly this didn't work, still no console output, back to the drawing board..............
Closing on basis my issue is not directly related to Lichee Nano board
In case anyone wants to use the other UARTs, I was able to get uart1 working. It got mapped to /dev/ttyS1
for me. You can check with dmesg | grep tty
.
It should be the same for adding uart2. Changing the pinmux should also be possible.