uboot serial sam9x60 questions

Discussions about all user software around SAM Series.

Moderator: nferre

Cactus17
Posts: 6
Joined: Sun Mar 15, 2020 10:09 pm

uboot serial sam9x60 questions

Wed Apr 22, 2020 10:47 pm

Been really stumped on getting the serial console going when u-boot starts up.

Initially, I've initialized the sam9x60 and dbgu in the at91 bootstrap -- seems to be no issues there. In the at91 bootstrap I selected the menuconfig option to load u-boot. There appears to be good signal on the external 24mhz clock. The 32768 khz oscillator has a good signals being produced.

My u-boot binary has multiple gzipped dtb files. The dts file compiles with no errors. It appears to extract them when embedded in the binary. I had to be careful with the malloc sizes on the gzip compression but it appears to work.

When control is switched to u-boot in the boot process before relocation I get an error:

Code: Select all

SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
�No serial driver found
resetting ...
If I turn off CONFIG_REQUIRE_SERIAL_CONSOLE then sometimes there will be one more line with cpu info and some garbage characters. But then the character output stops. if I have a single dtb file uncompressed, console required and embedded I get the same error.

I dumped the code and it only showed a single root node. I'm under the impression "u-boot,dm-pre-reloc;" would have caused drivers to be loaded in u-boot?

I made a dts file that includes sam9x60.dtsi. Stuff related to the dbgu is like the following from fdtdump -s on the uboot.bin file:

note: I used "[AT]" to get through the spam filter.

Code: Select all

/ {
	model = "My test board";
	compatible = "vendor,myproject", "microchip,sam9x60", "atmel,at91sam9";

  chosen {
        stdout-path = "/ahb/apb/serial[AT]fffff200";
        i2c0 = "/ahb/apb/flexcom[AT]f801c600";
        u-boot,dm-pre-reloc;
    };
    aliases {
        serial0 = "/ahb/apb/serial[AT]fffff200";
        gpio0 = "/ahb/apb/gpio[AT]fffff400";
        gpio1 = "/ahb/apb/gpio[AT]fffff600";
        gpio3 = "/ahb/apb/gpio[AT]fffffa00";
        spi0 = "/ahb/apb/spi[AT]f0014000";
        u-boot,dm-pre-reloc;
    };
  
flexcom[AT]f801c600 {
                compatible = "atmel,sama5d2-flexcom";
                reg = <0xf801c000 0x00000200>;
                clocks = <0x00000009>;
                #address-cells = <0x00000001>;
                #size-cells = <0x00000001>;
                ranges = <0x00000000 0xf801c000 0x00000800>;
                status = "okay";
                atmel,flexcom-mode = <0x00000003>;
        
            };
            
 serial[AT]fffff200 {
                compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
                reg = <0xfffff200 0x00000200>;
                clocks = <0x0000000e>;
                clock-names = "usart";
                status = "okay";
                u-boot,dm-pre-reloc;
            };

  dbgu_clk {
                        #clock-cells = <0x00000000>;
                        reg = <0x0000002f>;
                        u-boot,dm-pre-reloc;
                        phandle = <0x0000000e>;
                    };
My u-boot environment file has the following in it:

Code: Select all

baudrate=115200
stderr=serial0[AT]fffff200
stdin=serial0[AT]ffff200
stdout=serial0[AT]fffff200
Another question I have is there is no other file with "atmel,at91sam9". Is that correct for compatibility?

In flexcom[AT]f801c600, there is a reg with two cell values. The first is the address and the second is size cell of 0x00000200 . How is the size determined? If I look at the datasheet I see a range from 0xF801C000 to 0xF8020000 with an id of 5. Should that be 0x4000 for the second cell? Or is it just the registers needed to access dbgu are only in the first 0x200? If I were to look at the datasheet how would I arrive at the size cell number?

I suspect its something really simple is causing the serial not to load. :) I'm pretty new to u-boot and fdt.
blue_z
Location: USA
Posts: 2131
Joined: Thu Apr 19, 2007 10:15 pm

Re: uboot serial sam9x60 questions

Thu Apr 23, 2020 11:20 pm

Cactus17 wrote: Been really stumped on getting the serial console going when u-boot starts up.
You neglect to provide essential information such as the version and configuration that you are trying to build.
FWIW a u-boot.bin built with the tarball of Linux4SAM 6.2 release built using the Linaro GCC 7.3 toolchain and the sam9x60ek_mmc_defconfig boots without any issues.

Cactus17 wrote: I'm under the impression "u-boot,dm-pre-reloc;" would have caused drivers to be loaded in u-boot?
What do you mean by "load"?
The u-boot.bin is a single executable image. Any drivers that it needs should be linked in. There is no loadable module feature.
Are you conflating driver "loading" with driver initialization?

Cactus17 wrote: My u-boot environment file has the following in it:

Code: Select all

baudrate=115200
stderr=serial0[AT]fffff200
stdin=serial0[AT]ffff200
stdout=serial0[AT]fffff200
AFAIK U-Boot only needs Device Tree if you intend to use a single executable on several (similar) boards.
Otherwise the traditional U-Boot build is configured for a single specific board and specific medium for fetching kernel boot images. The use of the DBGU for the console is hardcoded for such configurations.

IOW if you're building U-Boot for just one board (like an AT91Bootstrap build is intended for only one board), then you can simplify the build by foregoing DT support in U-Boot.
Determine what you need instead of blindly replicating demo code that has multiboard support.

Regards
Cactus17
Posts: 6
Joined: Sun Mar 15, 2020 10:09 pm

Re: uboot serial sam9x60 questions

Fri Apr 24, 2020 3:19 am

From make menuconfig, I see Buildroot 2020.05, U-Boot 2020.04. I've compiled linux-5.4-at91 via git in Buildroot. Though, I have not gotten to the step of booting Linux or to the U-boot prompt.

I'm referring to driver initialization. The drivers are compiled into the binary.

Right, it might be easier to forego the device tree just to get things working.

The sam9x60 chip I'm using has default factory settings.

Return to “Software”

Who is online

Users browsing this forum: No registered users and 1 guest