Debug console Baud rate issues

Hi,

Observed non-formatted logs from debug console during Ubuntu core boot up.
I experienced such issues if there is mismatch in baud rate configuration between the device debug UART and serial application(minicom/teraterm).

buad rate and debug port are define in the uboot.env.in file as below

baudrate=115200
.
.
console=ttymxc3,115200

Do I need to consider any other settings to get proper debug messages?

i have not used minicom in a decade, but i know that screen behaves a lot better with serial, probably try a different terminal app ?

I usually try picocom, starting with -b 115200 and then cycle different baud rates with C-a C-d and C-a C-u. The console is configured to use 8n1 by default (8 data bits, no parity, 1 stop bit). I don’t know about your board/bootloader/kernel, but sometimes uboot may be configured to use a different baud rate than the Linux kernel. I’ve seen setups where the kernel console was using 115200, but uboot was set up to use 38400, what made things a bit annoying.

If you’re attaching using jump wires or test hooks, make sure that ground is properly connected.

My uboot is configured 15200 with 8n1.I have tested the boot loader binary in the device and verified debug console.But when I am testing the same binary with Ubuntu core package I am observing this behavior.

Do we need to export any debug instructions in gadget snap yaml ?

There is nothing the gadget snap does that could influence u-boot beyond what you define in uboot.env.in or do use as build config. once flashed to the device u-boot behaves like any other u-boot, no special debug options in gadget.yaml are needed or definable …

Okay…I got your point.Let me check on boot-loader.

I prepared the gadget snap using prebuilt uboot binary. I verified the same binary in the hardware and found debug console works.

Gadget yaml file looks like below,
bootloader: u-boot
schema: mbr
structure:
- name: u-boot
type: bare
size: 1152512
content:
- image: imx-boot
- name: system-boot
type: 0C
filesystem: vfat
filesystem-label: system-boot
size: 128M

Here mainly , I focused on the uboot binary size.It is actually 1152272 bytes and I rounded off to 1152512.

In snapcraft.yamal

  plugin: dump
    source: .
    override-build: |
      cp imx-boot $SNAPCRAFT_PART_INSTALL/
      tools/mkenvimage -r -s 131072 -o $SNAPCRAFT_PART_INSTALL/uboot.env ../../../u-boot-var.env.in
      cd $SNAPCRAFT_PART_INSTALL/; ln -s uboot.env uboot.conf

I instructed snapcraft to use imx-boot (bootloader binary) and prepared passed the boot environment variables.

Is there anything can affect from uboot.conf or offset to my gadget snap? I am not using offset in gadget.yaml file.I understand that is optional.

if a pre-built binary works it sounds more likely that some config option is missing/added/changed when you build it in the gadget context.

the size should not have much influence as long as it is big enough to fit your binary in (i typically pick it a little bigger so i dont need to adjust for every development build) and you can divide it by 512 (the expected partition blocksize by ubuntu-image)

Sorry, I did not understand this point.
Do I need to add any additional configuration to uboot loader? Could you please give some light on config option for gadget context.

it depends for what release you build, for UC16 and UC18 patches to u-boot are required (to make it support raw initrd files and to make it find the uboot.env file):

with UC20 everything changed (specifically uboot.env is gone and has been replaced) and i do not know where/if there is any documentation of what bits and pieces are needed yet …

I am trying for UC20.Can I get some reference link to make the gadget snap up and running.

well, there are the pi gadgets at

but this is for Pi’s, chainloading from the proprietary bootloader into u-boot.

you will likely be able to deduct the u-boot behaviour from the setup, but will need to handle the installation of u-boot differently than it is there … (i guess merging what you have in your current gadget with the boot.scr, boot.sel and whatnot stuff the new team introduced is the way to go)

Below dd command is used to write uboot binary into SD card.
dd if=imx-boot-sd.bin of=/dev/sdX bs=1K seek=33 conv=fsync

I would like to cross check the boot-loader placing in the gadget.yaml to narrow down the issue.

I mentioned offset: 16896 in yaml file. ie 33x512
Size mentioned is the adjusted size which is following factor of 512.
Actual binary size is 1152272,So I considered 1152512 as size in yaml.

Is this okay to use?

the numbers look correct to me, yeah …

Thank you for clear response … I consider gadget snap is placing the bootloader into proper offset. But I am not seeing any bootloader messages… Do I need to consider any other parameters which affect the gadget snap or during using “ubuntu-image” to prepare the final image?

Hi after correcting the offset, Boot-loader started to boot and getting console messages properly.

Thank you all. Special thanks to @jvgediya :clap:

2 Likes