Raspberry Pi Zero 2 W - USB attached - Kernel Boot issues with BalenaOS

Following Setup:

1x Raspberry Pi Zero 2W
1x WS-20895 (Waveshare POE USB Hat)
1x 32GB SD Card
1x USB Speaker

Download a given OS version of BalenaOS (tested with balena-cloud-raspberrypi0-2w-64-4.1.3+rev2-v14.13.13, balena-cloud-raspberrypi0-2w-64-5.4.0+rev3-v16.4.1, raspberrypi4-64-6.1.24+rev4-v16.10.1)

Flash to SD Card.

=> Problem the Pi Zero wont boot with already plugged in USB speaker.

To troubleshoot:

  1. Mound SD Card on your PC
  2. Enable UART debugging:
sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" bootcode.bin
  1. Edit the config.txt with those changes (comment Out, change 0 to 1, add this line)
#gpu_mem=16
enable_uart=1
dtoverlay=miniuart-bt
  1. Connect a UART to USB for serial monitoring:

The Result the system is stuck after gpioman (not completely loading the kernel8.img):

Raspberry Pi Bootcode

Found SD card, config.txt = 1, start.elf = 1, recovery.elf = 0, timeout = 0
Read File: config.txt, 2357 (bytes)




Raspberry Pi Bootcode
Read File: config.txt, 2357
Read File: start.elf, 2975616 (bytes)
Read File: fixup.dat, 7262 (bytes)
MESS:00:00:01.339638:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:01.345303:0: brfs: File read: 2357 bytes
MESS:00:00:01.380880:0: HDMI0:EDID error reading EDID block 0 attempt 0
MESS:00:00:01.387044:0: HDMI0:EDID error reading EDID block 0 attempt 1
MESS:00:00:01.393380:0: HDMI0:EDID error reading EDID block 0 attempt 2
MESS:00:00:01.399718:0: HDMI0:EDID error reading EDID block 0 attempt 3
MESS:00:00:01.406054:0: HDMI0:EDID error reading EDID block 0 attempt 4
MESS:00:00:01.412390:0: HDMI0:EDID error reading EDID block 0 attempt 5
MESS:00:00:01.418728:0: HDMI0:EDID error reading EDID block 0 attempt 6
MESS:00:00:01.425064:0: HDMI0:EDID error reading EDID block 0 attempt 7
MESS:00:00:01.431401:0: HDMI0:EDID error reading EDID block 0 attempt 8
MESS:00:00:01.437739:0: HDMI0:EDID error reading EDID block 0 attempt 9
MESS:00:00:01.443833:0: HDMI0:EDID giving up on reading EDID block 0
MESS:00:00:01.451143:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:01.456922:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
MESS:00:00:01.653471:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
MESS:00:00:01.659293:0: *** Restart logging
MESS:00:00:01.663167:0: brfs: File read: 2357 bytes
MESS:00:00:01.668412:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 0
MESS:00:00:01.675869:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 1
MESS:00:00:01.682726:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 2
MESS:00:00:01.689585:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 3
MESS:00:00:01.696443:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 4
MESS:00:00:01.703299:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 5
MESS:00:00:01.710158:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 6
MESS:00:00:01.717016:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 7
MESS:00:00:01.723874:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 8
MESS:00:00:01.730731:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 9
MESS:00:00:01.737347:0: hdmi: HDMI0:EDID giving up on reading EDID block 0
MESS:00:00:01.743251:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 0
MESS:00:00:01.751044:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 1
MESS:00:00:01.757901:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 2
MESS:00:00:01.764758:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 3
MESS:00:00:01.771615:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 4
MESS:00:00:01.778474:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 5
MESS:00:00:01.785332:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 6
MESS:00:00:01.792188:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 7
MESS:00:00:01.799047:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 8
MESS:00:00:01.805905:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 9
MESS:00:00:01.812520:0: hdmi: HDMI0:EDID giving up on reading EDID block 0
MESS:00:00:01.818135:0: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead
MESS:00:00:01.826879:0: HDMI0: hdmi_pixel_encoding: 162000000
MESS:00:00:01.832594:0: vec: vec_middleware_power_on: vec_base: 0x7e806000 rev-id 0x00002708 @ vec: 0x7e806100 @ 0x00000420 enc: 0x7e806060 @ 0x00000220 cgmsae: 0x7e80605c @ 0x00000000
MESS:00:00:01.849612:0: kernel=
MESS:00:00:01.858163:0: dtb_file 'bcm2710-rpi-zero-2-w.dtb'
MESS:00:00:01.862360:0: dtb_file 'bcm2710-rpi-zero-2.dtb'
MESS:00:00:01.871073:0: brfs: File read: /mfs/sd/bcm2710-rpi-zero-2.dtb
MESS:00:00:01.875993:0: Loaded 'bcm2710-rpi-zero-2.dtb' to 0x100 size 0x79fe
MESS:00:00:01.897233:0: brfs: File read: 31230 bytes
MESS:00:00:01.923657:0: brfs: File read: /mfs/sd/overlays/overlay_map.dtb
MESS:00:00:02.017416:0: brfs: File read: 2347 bytes
MESS:00:00:02.022963:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:02.028973:0: brfs: File read: 2357 bytes
MESS:00:00:02.046199:0: brfs: File read: /mfs/sd/overlays/vc4-fkms-v3d.dtbo
MESS:00:00:02.071984:0: Loaded overlay 'vc4-fkms-v3d'
MESS:00:00:02.075390:0: dtparam: audio=on
MESS:00:00:02.090021:0: dtparam: i2c_arm=on
MESS:00:00:02.101610:0: dtparam: spi=on
MESS:00:00:02.111722:0: dtparam: audio=on
MESS:00:00:02.161579:0: dtwarn: overlay 'pi3-miniuart-bt' has been renamed 'miniuart-bt'
MESS:00:00:02.168953:0: brfs: File read: 1446 bytes
MESS:00:00:02.185115:0: brfs: File read: /mfs/sd/overlays/miniuart-bt.dtbo
MESS:00:00:02.214093:0: Loaded overlay 'pi3-miniuart-bt'
MESS:00:00:02.276617:0: brfs: File read: 1819 bytes
MESS:00:00:02.280608:0: brfs: File read: /mfs/sd/cmdline.txt
MESS:00:00:02.285225:0: Read command line from file 'cmdline.txt':
MESS:00:00:02.291082:0: 'dwc_otg.lpm_enable=0 rootfstype=ext4 rootwait dwc_otg.lpm_enable=0 rootwait console=serial0,115200 console=tty1 splash vt.global_cursor_default=0 consoleblank=0 cgroup_enable=memory'
MESS:00:00:02.327309:0: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined
MESS:00:00:02.552815:0: brfs: File read: 182 bytes
MESS:00:00:02.594958:0: brfs: File read: /mfs/sd/kernel8.img
MESS:00:00:02.598900:0: Loaded 'kernel8.img' to 0x80000 size 0x8e6c0
MESS:00:00:02.604989:0: Device tree loaded to 0x1bfe7e00 (size 0x8127)
MESS:00:00:02.612127:0: uart: Set PL011 baud rate to 103448.300000 Hz
MESS:00:00:02.618915:0: uart: Baud rate change done...
MESS:00:00:02.622330:0: uart: Baud rate change done...
MESS:00:00:02.628601:0: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined

It can happen that it successfully boots but this is rare (1 out of 20 attempts)

Raspberry Pi Bootcode

Found SD card, config.txt = 1, start.elf = 1, recovery.elf = 0, timeout = 0
Read File: config.txt, 2355 (bytes)




Raspberry Pi Bootcode
Read File: config.txt, 2355
Read File: start.elf, 2986432 (bytes)
Read File: fixup.dat, 7330 (bytes)
MESS:00:00:01.348299:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:01.353934:0: brfs: File read: 2355 bytes
MESS:00:00:01.389122:0: HDMI0:EDID error reading EDID block 0 attempt 0
MESS:00:00:01.395286:0: HDMI0:EDID error reading EDID block 0 attempt 1
MESS:00:00:01.401622:0: HDMI0:EDID error reading EDID block 0 attempt 2
MESS:00:00:01.407959:0: HDMI0:EDID error reading EDID block 0 attempt 3
MESS:00:00:01.414295:0: HDMI0:EDID error reading EDID block 0 attempt 4
MESS:00:00:01.420632:0: HDMI0:EDID error reading EDID block 0 attempt 5
MESS:00:00:01.426969:0: HDMI0:EDID error reading EDID block 0 attempt 6
MESS:00:00:01.433306:0: HDMI0:EDID error reading EDID block 0 attempt 7
MESS:00:00:01.439643:0: HDMI0:EDID error reading EDID block 0 attempt 8
MESS:00:00:01.445980:0: HDMI0:EDID error reading EDID block 0 attempt 9
MESS:00:00:01.452075:0: HDMI0:EDID giving up on reading EDID block 0
MESS:00:00:01.459651:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:01.465383:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
MESS:00:00:01.661717:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
MESS:00:00:01.667537:0: *** Restart logging
MESS:00:00:01.671413:0: brfs: File read: 2355 bytes
MESS:00:00:01.676837:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 0
MESS:00:00:01.684116:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 1
MESS:00:00:01.690974:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 2
MESS:00:00:01.697831:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 3
MESS:00:00:01.704689:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 4
MESS:00:00:01.711547:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 5
MESS:00:00:01.718404:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 6
MESS:00:00:01.725262:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 7
MESS:00:00:01.732120:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 8
MESS:00:00:01.738978:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 9
MESS:00:00:01.745593:0: hdmi: HDMI0:EDID giving up on reading EDID block 0
MESS:00:00:01.751498:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 0
MESS:00:00:01.759290:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 1
MESS:00:00:01.766148:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 2
MESS:00:00:01.773005:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 3
MESS:00:00:01.779863:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 4
MESS:00:00:01.786721:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 5
MESS:00:00:01.793578:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 6
MESS:00:00:01.800436:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 7
MESS:00:00:01.807294:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 8
MESS:00:00:01.814151:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 9
MESS:00:00:01.820766:0: hdmi: HDMI0:EDID giving up on reading EDID block 0
MESS:00:00:01.826380:0: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead
MESS:00:00:01.835126:0: HDMI0: hdmi_pixel_encoding: 162000000
MESS:00:00:01.840850:0: vec: vec_middleware_power_on: vec_base: 0x7e806000 rev-id 0x00002708 @ vec: 0x7e806100 @ 0x00000420 enc: 0x7e806060 @ 0x00000220 cgmsae: 0x7e80605c @ 0x00000000
MESS:00:00:01.871102:0: dtb_file 'bcm2710-rpi-zero-2-w.dtb'
MESS:00:00:01.880674:0: brfs: File read: /mfs/sd/bcm2710-rpi-zero-2-w.dtb
MESS:00:00:01.885768:0: Loaded 'bcm2710-rpi-zero-2-w.dtb' to 0x100 size 0x8398
MESS:00:00:01.907822:0: brfs: File read: 33688 bytes
MESS:00:00:01.918044:0: brfs: File read: /mfs/sd/overlays/overlay_map.dtb
MESS:00:00:01.949768:0: brfs: File read: 2347 bytes
MESS:00:00:01.955403:0: brfs: File read: /mfs/sd/config.txt
MESS:00:00:01.961429:0: brfs: File read: 2355 bytes
MESS:00:00:01.984855:0: brfs: File read: /mfs/sd/overlays/vc4-fkms-v3d.dtbo
MESS:00:00:02.010917:0: Loaded overlay 'vc4-fkms-v3d'
MESS:00:00:02.014333:0: dtparam: i2c_arm=on
MESS:00:00:02.027406:0: dtparam: spi=on
MESS:00:00:02.074728:0: brfs: File read: 1446 bytes
MESS:00:00:02.082879:0: brfs: File read: /mfs/sd/overlays/miniuart-bt.dtbo
MESS:00:00:02.112857:0: Loaded overlay 'miniuart-bt'
MESS:00:00:02.177387:0: brfs: File read: 1819 bytes
MESS:00:00:02.181086:0: brfs: File read: /mfs/sd/cmdline.txt
MESS:00:00:02.185996:0: Read command line from file 'cmdline.txt':
MESS:00:00:02.191855:0: 'dwc_otg.lpm_enable=0 rootfstype=ext4 rootwait dwc_otg.lpm_enable=0 rootwait console=serial0,115200 console=tty1 splash vt.global_cursor_default=0 consoleblank=0 cgroup_enable=memory'
MESS:00:00:02.228443:0: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined
MESS:00:00:02.546922:0: brfs: File read: 182 bytes
MESS:00:00:02.589527:0: brfs: File read: /mfs/sd/kernel8.img
MESS:00:00:02.593471:0: Loaded 'kernel8.img' to 0x200000 size 0x8e6f0
MESS:00:00:02.600317:0: Kernel relocated to 0x80000
MESS:00:00:02.604231:0: Device tree loaded to 0x1bfe7700 (size 0x884e)
MESS:00:00:02.611649:0: uart: Set PL011 baud rate to 103448.300000 Hz
MESS:00:00:02.618170:0: uart: Baud rate change done...
MESS:00:00:02.621584:0: uart: Baud rate change done...
MESS:00:00:02.627804:0: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined

  
   
      
   
       
       
       
       
       
       
     
       
       
   
       
      
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.15.92-v8 (oe-user@oe-host) (aarch64-poky-linux-gcc (GCC) 11.4.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Wed Feb 8 16:47:50 UTC 2023
[    0.000000] random: crng init done
[    0.000000] Machine model: Raspberry Pi Zero 2 W Rev 1.0
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x000000000bc00000, size 256 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] On node 0, zone DMA: 16384 pages in unavailable ranges
[    0.000000] percpu: Embedded 28 pages/cpu s73752 r8192 d32744 u114688
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: kernel page table isolation forced ON by KASLR
[    0.000000] CPU features: detected: Kernel page table isolation (KPTI)
[    0.000000] CPU features: detected: ARM erratum 843419
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 112896
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 cgroup_disable=memory  smsc95xx.macaddr=B8:27:EB:10:C1:3B vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 rootfstype=ext4 rootwait dwc_otg.lpm_enable=0 rootwait console=ttyAMA0,115200 console=tty1 splash vt.global_cursor_default=0 consoleblank=0 cgroup_enable=memory root=UUID=b372fd27-6843-4fb0-b4dd-17a211406419 rootwait
[    0.000000] cgroup: Disabling memory control group subsystem
[    0.000000] cgroup: Enabling memory control group subsystem
[    0.000000] Unknown kernel command line parameters "splash", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 139176K/458752K available (9792K kernel code, 1574K rwdata, 3648K rodata, 30784K init, 923K bss, 57432K reserved, 262144K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 38222 entries in 150 pages
[    0.000000] ftrace: allocated 150 pages with 4 groups
[    0.000000] trace event string verifier disabled
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000]  Rude variant of Tasks RCU enabled.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 100 jiffies.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] Root IRQ handler: bcm2836_arm_irqchip_handle_irq
[    0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000000] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000327] Console: colour dummy device 80x25
[    0.001215] printk: console [tty1] enabled
[    0.001289] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=19200)
[    0.001342] pid_max: default: 32768 minimum: 301
[    0.001478] LSM: Security Framework initializing
[    0.001712] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.001760] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.005863] rcu: Hierarchical SRCU implementation.
[    0.006926] EFI services will not be available.
[    0.007565] smp: Bringing up secondary CPUs ...
[    0.008835] Detected VIPT I-cache on CPU1
[    0.008917] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.010820] Detected VIPT I-cache on CPU2
[    0.010884] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.012641] Detected VIPT I-cache on CPU3
[    0.012700] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.013329] smp: Brought up 1 node, 4 CPUs
[    0.013461] SMP: Total of 4 processors activated.
[    0.013490] CPU features: detected: 32-bit EL0 Support
[    0.013518] CPU features: detected: CRC32 instructions
[    0.016501] CPU: All CPU(s) started at EL2
[    0.016581] alternatives: patching kernel code
[    0.017749] devtmpfs: initialized
[    0.035401] Enabled cp15_barrier support
[    0.035470] Enabled setend support
[    0.035516] KASLR enabled
[    0.035929] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.035988] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.046663] pinctrl core: initialized pinctrl subsystem
[    0.047688] DMI not present or invalid.
[    0.048232] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.057782] DMA: preallocated 1024 KiB GFP_KERNEL pool for atomic allocations
[    0.058160] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.059188] DMA: preallocated 1024 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.059336] audit: initializing netlink subsys (disabled)
[    0.059691] audit: type=2000 audit(0.058:1): state=initialized audit_enabled=0 res=1
[    0.060408] thermal_sys: Registered thermal governor 'step_wise'
[    0.060715] cpuidle: using governor menu
[    0.061233] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.061480] ASID allocator initialised with 32768 entries
[    0.061680] Serial: AMBA PL011 UART driver
[    0.070712] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.087470] raspberrypi-firmware soc:firmware: Attached to firmware from 2024-12-05T11:47:03, variant start
[    0.088485] raspberrypi-firmware soc:firmware: Firmware hash is 03554ca336a03ace164f36755144e0d8c060062d
[    0.135321] bcm2835-dma 3f007000.dma-controller: DMA legacy API manager, dmachans=0x1
[    0.139775] SCSI subsystem initialized
[    0.140054] usbcore: registered new interface driver usbfs
[    0.140170] usbcore: registered new interface driver hub
[    0.140262] usbcore: registered new device driver usb
[    0.140640] usb_phy_generic phy: supply vcc not found, using dummy regulator
[    0.140890] usb_phy_generic phy: dummy supplies not allowed for exclusive requests
[    0.141212] pps_core: LinuxPPS API ver. 1 registered
[    0.141242] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.141301] PTP clock support registered
[    0.141616] Advanced Linux Sound Architecture Driver Initialized.
[    0.143319] clocksource: Switched to clocksource arch_sys_counter
[    0.201972] VFS: Disk quotas dquot_6.6.0
[    0.202118] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.202340] FS-Cache: Loaded
[    0.202672] CacheFiles: Loaded
[    0.203591] simple-framebuffer 1eaa9000.framebuffer: framebuffer at 0x1eaa9000, 0x151800 bytes
[    0.203635] simple-framebuffer 1eaa9000.framebuffer: format=a8r8g8b8, mode=720x480x32, linelength=2880
[    0.207796] Console: switching to colour frame buffer device 90x30
[    0.211562] simple-framebuffer 1eaa9000.framebuffer: fb0: simplefb registered!
[    0.224041] NET: Registered PF_INET protocol family
[    0.224353] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.225443] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.228171] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.230751] TCP established hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.233357] TCP bind hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    0.235985] TCP: Hash tables configured (established 4096 bind 4096)
[    0.238736] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.241406] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.244392] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.255598] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.263688] Initialise system trusted keyrings
[    0.266994] workingset: timestamp_bits=46 max_order=17 bucket_order=0
[    0.279812] zbud: loaded
[    0.284970] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.290102] aufs 5.15.41-20220620
[    0.293466] Key type asymmetric registered
[    0.296279] Asymmetric key parser 'x509' registered
[    0.299360] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[    0.302212] io scheduler mq-deadline registered
[    0.305038] io scheduler kyber registered
[    0.318743] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[    0.324403] bcm2835-rng 3f104000.rng: hwrng registered
[    0.328037] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    0.335452] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    0.357553] brd: module loaded
[    0.373470] loop: module loaded
[    0.377152] zram: Added device: zram0
[    0.380741] Loading iSCSI transport class v2.0-870.
[    0.386019] tun: Universal TUN/TAP device driver, 1.6
[    0.388923] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    0.592510] Core Release: 2.80a
[    0.594989] Setting default values for core params
[    0.597413] Finished setting default values for core params
[    0.800193] Using Buffer DMA mode
[    0.802542] Periodic Transfer Interrupt Enhancement - disabled
[    0.804917] Multiprocessor Interrupt Enhancement - disabled
[    0.807276] OTG VER PARAM: 0, OTG VER FLAG: 0
[    0.809579] Dedicated Tx FIFOs mode
[    0.815023] 
[    0.815035] WARN::dwc_otg_hcd_init:1072: FIQ DMA bounce buffers: virt = ffffffc008471000 dma = 0x00000000cc000000 len=9024
[    0.821721] FIQ FSM acceleration enabled for :
[    0.821721] Non-periodic Split Transactions
[    0.821721] Periodic Split Transactions
[    0.821721] High-Speed Isochronous Endpoints
[    0.821721] Interrupt/Control Split Transaction hack enabled
[    0.832710] 
[    0.832720] WARN::hcd_init_fiq:496: MPHI regs_base at ffffffc00805d000
[    0.837073] dwc_otg 3f980000.usb: DWC OTG Controller
[    0.839344] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    0.841631] dwc_otg 3f980000.usb: irq 74, io mem 0x00000000
[    0.843839] Init: Port Power? op_state=1
[    0.845931] Init: Power Port (0)
[    0.848365] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.15
[    0.852474] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.854697] usb usb1: Product: DWC OTG Controller
[    0.856912] usb usb1: Manufacturer: Linux 5.15.92-v8 dwc_otg_hcd
[    0.859136] usb usb1: SerialNumber: 3f980000.usb
[    0.862187] hub 1-0:1.0: USB hub found
[    0.864437] hub 1-0:1.0: 1 port detected
[    0.868525] usbcore: registered new interface driver usb-storage
[    0.870999] usbcore: registered new interface driver usbserial_generic
[    0.873166] usbserial: USB Serial support registered for generic
[    0.879017] sdhci: Secure Digital Host Controller Interface driver
[    0.881332] sdhci: Copyright(c) Pierre Ossman
[    0.884044] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.887667] ledtrig-cpu: registered to indicate activity on CPUs
[    0.890517] hid: raw HID events driver (C) Jiri Kosina
[    0.892864] usbcore: registered new interface driver usbhid
[    0.894969] usbhid: USB HID core driver
[    0.897425] ashmem: initialized
[    0.899747] bcm2835_vchiq 3f00b840.mailbox: there is not valid maps for state default
[    0.909085] IPVS: Registered protocols (TCP, UDP, SCTP, AH, ESP)
[    0.911448] IPVS: Connection hash table configured (size=4096, memory=32Kbytes)
[    0.913990] IPVS: ipvs loaded.
[    0.916407] Initializing XFRM netlink socket
[    0.919417] NET: Registered PF_INET6 protocol family
[    0.923426] Segment Routing with IPv6
[    0.925728] In-situ OAM (IOAM) with IPv6
[    0.927981] NET: Registered PF_PACKET protocol family
[    0.930197] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.934711] Key type dns_resolver registered
[    0.938470] registered taskstats version 1
[    0.940660] Loading compiled-in X.509 certificates
[    0.944023] Key type .fscrypt registered
[    0.946179] Key type fscrypt-provisioning registered
[    0.965097] uart-pl011 3f201000.serial: there is not valid maps for state default
[    0.967622] uart-pl011 3f201000.serial: cts_event_workaround enabled
[    0.970116] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 99, base_baud = 0) is a PL011 rev2
[    0.977525] Indeed it is in host mode hprt0 = 00021501
[    0.981032] printk: console [ttyAMA0] enabled
[    1.166345] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.178529] 3f215040.serial: ttyS0 at MMIO 0x3f215040 (irq = 71, base_baud = 50000000) is a 16550
[    1.181529] Indeed it is in host mode hprt0 = 00001101
[    1.189647] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    1.389645] usb 1-1: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
[    1.395075] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    1.399617] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    1.407331] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    1.408210] usb 1-1: Product: USB 2.0 Hub
[    1.411484] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[    1.438175] sdhost: log_buf @ 00000000d3197479 (c6264000)
[    1.447560] hub 1-1:1.0: USB hub found
[    1.539106] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    1.540954] hub 1-1:1.0: 4 ports detected
[    1.552380] of_cfs_init
[    1.624545] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.627663] of_cfs_init: OK
[    1.648661] mmc0: new high speed SDHC card at address aaaa
[    1.667189] ALSA device list:
[    1.675550] mmcblk0: mmc0:aaaa SH32G 29.7 GiB 
[    1.682708]   No soundcards found.
[    1.985348] usb 1-1.1: new full-speed USB device number 3 using dwc_otg
[    1.995570]  mmcblk0: p1 p2 p3 p4 < p5 p6 >
[    2.348041] mmcblk0: mmc0:aaaa SH32G 29.7 GiB (quirks 0x00004000)
[    2.394256] Freeing unused kernel memory: 30784K
[    2.401563] Run /init as init process
[    2.428654] usb 1-1.1: New USB device found, idVendor=1f9b, idProduct=1f90, bcdDevice= 2.01
[    2.442261] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.452388] usb 1-1.1: Product: USB Advanced Audio Device
[    2.460466] usb 1-1.1: Manufacturer: C-Media Electronics Inc.
[    2.489731] mmc1: new high speed SDIO card at address 0001
[    2.538581] input: C-Media Electronics Inc. USB Advanced Audio Device as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1:1.3/0003:1F9B:1F90.0001/input/input0
[    2.611892] hid-generic 0003:1F9B:1F90.0001: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc. USB Advanced Audio Device] on usb-3f980000.usb-1.1/input3
[    2.810371] usb 1-1.4: new high-speed USB device number 4 using dwc_otg
[    3.015800] usb 1-1.4: New USB device found, idVendor=0bda, idProduct=8152, bcdDevice=20.00
[    3.029487] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.039596] usb 1-1.4: Product: USB 10/100 LAN
[    3.046765] usb 1-1.4: Manufacturer: Realtek
[    3.053767] usb 1-1.4: SerialNumber: 00E04C361299
[    4.343667] zram0: detected capacity change from 0 to 432104
[    5.657412] usb 1-1.1: reset full-speed USB device number 3 using dwc_otg
[   14.482777] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.
[   14.586012] EXT4-fs (mmcblk0p5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.
[   15.714128] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null). Quota mode: none.
[   15.787952] EXT4-fs (mmcblk0p6): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.
[   16.271720] systemd[1]: System time before build time, advancing clock.
[   17.016442] systemd[1]: /lib/systemd/system/balena-host.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/balena-host.sock → /run/balena-host.sock; please update the unit file accordingly.
[   17.102134] systemd[1]: /lib/systemd/system/balena-engine.socket:7: ListenStream= references a path below legacy directory /var/run/, updating /var/run/balena-engine.sock → /run/balena-engine.sock; please update the unit file accordingly.
[   18.075087] fuse: init (API version 7.34)
[   19.825370] usb 1-1.1: device not accepting address 3, error -32
[   21.367658] bcm2835_audio bcm2835_audio: Failed to get DT property 'brcm,pwm-channels'
[   21.957226] usb 1-1.1: 1:1: cannot get freq at ep 0x1
[   21.986065] usb 1-1.1: 2:1: cannot get freq at ep 0x82
[   22.098128] usb 1-1.1: 6:0: cannot get min/max values for control 2 (id 6)
[   22.859005] usb 1-1-port1: cannot reset (err = -71)
[   23.013459] bcm2835-codec bcm2835-codec: Invalid control
[   23.217379] usb 1-1.1: device descriptor read/64, error -71
[   23.243285] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[   25.848664] hub 1-1:1.0: hub_ext_port_status failed (err = -71)
[   26.224562] usb 1-1.1: device descriptor read/all, error -71
[   26.418063] usb 1-1-port1: cannot reset (err = -71)
[   26.785399] usb 1-1.1: device descriptor read/64, error -71
[   27.497390] usb 1-1.1: device not accepting address 3, error -32
[   28.145507] usb 1-1.1: device not accepting address 3, error -32
[   28.761409] usb 1-1.1: device not accepting address 3, error -32
[   29.145460] usb 1-1.1: device descriptor read/64, error -71
[   29.441487] usb 1-1.1: device descriptor read/64, error -71
[   29.735458] usb 1-1-port1: cannot reset (err = -71)
[   30.097368] usb 1-1.1: device descriptor read/64, error -71
[   30.462552] usb 1-1.1: unable to read config index 0 descriptor/all
[   30.469017] usb 1-1.1: can't read configurations, error -71
[   30.797557] hub 1-1:1.0: hub_ext_port_status failed (err = -71)
[   31.009629] hub 1-1:1.0: hub_ext_port_status failed (err = -71)
[   31.993353] usb 1-1.1: device not accepting address 7, error -32

If using the raspbian os image with a recent Linux version 6.6.70-v8+ kernel it boots as usual.

I’ve also already tried to use the dtb, fixup files from the rpi firmware git repo, but that’s not making any difference here. Just replacing the kernel does make a difference. The ubuntu kernel wont work because it can’t mount root partition though.

1 Like

Hello, so just to clarify, when the USB speaker is plugged in, the OS versions you mentioned won’t boot, but if the USB speaker is not plugged in, it does boot? What is the make/model of USB speaker? Do you always have the Waveshare POE connected? If so, can you try without that (perhaps using a simple USB adapter?)

1 Like

Hi Alanb128,

yes you’re correct.

RaspberryPi + Waveshare boots. If usb is plugged in later it works fine. If its already plugged it its stuck at loading the kernel.

This is the speaker

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#=  5 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs=  1
P:  Vendor=1f9b ProdID=1f90 Rev=02.01
S:  Manufacturer=C-Media Electronics Inc.
S:  Product=USB Advanced Audio Device
C:  #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=156mA
I:  If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I:  If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I:  If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I:  If#= 3 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=87(I) Atr=03(Int.) MxPS=  16 Ivl=1ms

I did recompile the recent balenaos-raspberrypi repo for the pi 0 and there is no difference.
If we use the kernel8.img from the Debian layer provided while compiling, it shows the boot output and loads the kernel, but this image wont boot further till loading the kernel as it is not the completely compiled kernel.

./tmp/work/raspberrypi0_2w_64-poky-linux/rpi-bootfiles/20230509~buster-r3/raspberrypi-firmware-1.20230509~buster/boot/kernel8.img 

The size difference is ~8MB for the “original” one and ~600KB for the BalenaOS compiled one.

1 Like

It looks as if U-Boot might be detecting the USB speaker as either a storage device or a HID, like a keyboard, and maybe trying to boot from it. From your output:

I: If#= 3 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid

To better understand, could you adjust your build by setting OS_DEVELOPMENT = "1" in your conf/local.conf file and then capture the U-Boot serial output during boot?

1 Like

Hi,

I’m trying to build it with the flag enabled:

I’m running:

> ./balena-yocto-scripts/build/barys --remove-build --dry-run
> source layers/poky/oe-init-build-env
> cd ..
> vim build/conf/local.conf
> ./balena-yocto-scripts/build/barys -m raspberrypi0-2w-64 

If I then check the same file again its back to 0:

OS_DEVELOPMENT = "0"

The logs from the fresh build IMG do not look different. What am I doing wrong ?

I managed to comment out the lines in barys sh script:

this is the log of the boot loader:

U-Boot 2021.10 (Oct 04 2021 - 15:09:26 +0000)

DRAM:  448 MiB
RPI: Board rev 0x12 unknown
RPI Unknown model (0x902120)
MMC:   mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from <NULL>... Unable to read "uboot.env" from mmc0:1... In:    serial
ut:   serial
Err:   serial
Net:   No ethernet found.
starting USB...
Bus usb@7e980000: usb dr_mode not found
USB DWC2
scnning bus usb@7e980000 for devices...

You are correct it’s continuously scanning.

Found the solution for the issue:

Helpful was this blog entry here:

It’s caused by a timing issue. Maybe you can also port it to the main BalenaOS

The code is back ported from a newer u-boot release: usb: Add 1ms delay after first Get Descriptor request · u-boot/u-boot@3406e9d · GitHub

From 9b07063565ca2cf443458515e431b5f27e7727ce Mon Sep 17 00:00:00 2001
From: Noah Dressler <noah.dressler@netzwerkleute.de>
Date: Sat, 18 Jan 2025 13:22:17 -0600
Subject: [PATCH] common: usb: Fix usb detection on rpi0-2w with waveshare usb
 hub

Signed-off-by: Noah Dressler <noah.dressler@netzwerkleute.de>
---
 common/usb.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/usb.c b/common/usb.c
index aad13fd9c5..8f51738cc7 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1003,6 +1003,16 @@ static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
                err = get_descriptor_len(dev, 64, 8);
                if (err)
                        return err;
+               /*
+                * Logitech Unifying Receiver 046d:c52b bcdDevice 12.10 seems
+                * sensitive about the first Get Descriptor request. If there
+                * are any other requests in the same microframe, the device
+                * reports bogus data, first of the descriptor parts is not
+                * sent to the host. Wait over one microframe duration here
+                * (1mS for USB 1.x , 125uS for USB 2.0) to avoid triggering
+                * the issue.
+                */
+               mdelay(1);
        }
 
        dev->epmaxpacketin[0] = dev->descriptor.bMaxPacketSize0;
-- 
2.39.5
1 Like