7

I am using the raspberry pi 4. I have no screen connected to the raspberry pi, I do everything trough ethernet cable.

I am currently changing kernels and thus sometimes I cannot boot, since I created a broken kernel. In those cases it seems like all I can do is wait and check if the device comes online.

I got UART0 working and now I get output if the device boots. But what if it does not boot? I would expect there to be some way other than connecting a screen to figure out that the device is not booting and why. So, is there a possibility to read information trough a serial device even if there is no storage device from which the RPI can boot?

Cheiron
  • 173
  • 5

3 Answers3

6

is there a possibility to read information trough the serial device even if there is no boot device?

Yes! It is possible since Raspberry Pi 4B.

The RPi 4B comes with an EEPROM containing the boot loader and that is reprogramable. Have a look at Raspberry Pi 4 boot EEPROM. There you can set a debug flag BOOT_UART=1 as described at Pi4 Bootloader Configuration.

Here the output from my RPi 4B with nothing connected (except power and the serial USB/TTL adapter attached to GPIO 14 and 15), not even a SD Card inserted (no boot device).

management-console ~$ tio /dev/ttyUSB0
[tio 20:40:27] tio v1.32
[tio 20:40:27] Press ctrl-t q to quit
[tio 20:40:27] Connected

PM_RSTS: 0x00001000
RPi: BOOTLOADER release VERSION:f626c772 Sep 10 2019 10:41:52 BOOTMODE: 0x00000006 part: 0 BUILD_TIMESTAMP=1568112110
uSD voltage 3.3V
SD HOST: 200000000 CTL0: 0x00000000 BUS: 100000 Hz div: 2000 status: 0x1fff0000 delay-ticks: 1080
SD HOST: 200000000 CTL0: 0x00000f00 BUS: 100000 Hz div: 2000 status: 0x1fff0000 delay-ticks: 1080
: ERROR: ''
        CMDTM: 0x081a0010 ARG1: 0x000001aa waiting for cmd-index: 8
        start:  5728148 now:  5730149 delay:     2001 max-delay: 2000
        RESP0: 0x00000000 RESP1: 0x00000000: RESP2: 0x00000000 RESP3: 0x00000000
        before cmd
        STATUS: 0x1fff0000 INTERRUPT: 0x00000000 CONTROL2: 0x00000000 BLKSIZECNT: 0x00000000
        now
        STATUS: 0x1fff0001 INTERRUPT: 0x00000000 CONTROL2: 0x00000000 BLKSIZECNT: 0x00000000
evtype: 0x0000004e error: 2 ''
evtype: 0x0000003f error: 2 ''
evtype: 0x00000019 error: 2 ''
Failed to open device: 'arasan-emmc0' 2
FATAL @ 0x800023bc
LDO: 0xde

Of course you have to know what all these characters and numbers from the very low level debug are meaning but with the last three lines containing Failed to open device: 'arasan-emmc0' google tells you that the term eMMC is short for "embedded Multi-Media Controller" and refers to a package consisting of both flash memory and a flash memory controller integrated on the same silicon die.

Or in short: missing the SD Card.

Ingo
  • 42,107
  • 20
  • 85
  • 197
4

is there a possibility to read information trough the serial device even if there is no boot device?

See Ingo's answer -- which may or may not provide useful information in the context of your question.

I would expect there to be some way other than connecting a screen to figure out that the device is not booting and why.

This kind of circumvents the concept of "broken", referring to something that does not work. There maybe degrees of brokenness, but at some point it must mean there is no useful direct source of information because the device is broken beyond that point. Most of the time boot failures do not mean the Pi is physically broken, but since we can speak of "broken software", that is an arbitrary perspective that again tries to befuddle the concept, broken.

95% of the time the cause is some degree of corruption on the SD card because it was not created properly, or the system was shut down uncleanly. If you can put the card in another computer that can access all of it properly (ie., not a stock Windows box) and run diagnostics on the filesystems, then that is a useful form of information.

The closest thing to what you are looking for would be the state of the green ACT led. For common problems with the contents of the SD card, this will flash in a regular pattern -- start here and read downwards to get to the detials about that.

If the green led does not do this, that page may still be of assistance. Additionally, there is the boot problems sticky maintained by the Pi Foundation discussion forum.

Finally:

  • If the green led doesn't flash but flickers intermittently for 10+ seconds then stops (or continues indefinitely), then the OS has booted, but this does not mean it is fully functional. The best source of info in that case is going to be plugging in a screen presuming you have hdmi_force_hotplug=1 in /boot/config.txt. If the serial console or sshd works, then there is also that.

  • If the green led doesn't do anything, or comes on and stays on, try unplugging it, taking out the SD card and plugging it back in. Chances are it does exactly the same thing, meaning the card cannot be read at all properly. This can happen even with a small amount of corruption if it is in the right place. You may be able to salvage it using another computer (or at least salvage some of the data if there is anything important), but if that's not an option (it may take a certain amount of skill), then you need to reflash the card.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • I ment a storage device with "boot device", so assuming we have a fully functional RPI but no valid SD and USB, can I figure out what the problem is without checking the storage device. Your tips are very helpfull, thank you. – Cheiron Jan 02 '20 at 15:35
  • please edit your post ... it still says boot device – jsotola Jan 02 '20 at 21:55
  • Since RPi 4 it is possible to get debug messages from the boot loader even if there is no "boot device". You may have a look at my answer. – Ingo Jan 04 '20 at 20:20
2

@goldilock's answer provides a good overview for debugging boot issues.

However, to answer the question of:

So, is there a possibility to read information trough the serial device even if there is no boot device?

This would generally be done through JTAG, using a hardware debugger. This provides capabilities such as reading memory and register values, and stepping the code instruction-by-instruction.

Pretty much any JTAG debugger that supports ARM processors can be used with Raspberry Pi. However, it does require enabling the JTAG pins through a bootloader flag in config.txt: enable_jtag_gpio=1.

So for Raspberry Pi, no, it does not appear there is a way to get debug output other than the LED blinks if there is no storage device at all connected.

jpa
  • 434
  • 2
  • 5