Arietta G25 serial ports

This forum is for all other ARMv5 devices

Arietta G25 serial ports

Postby jesseF » Mon Dec 07, 2020 4:41 am

I have arch linux running on my Arietta G25 board. I would like to use one of the 4 serial ports on the board (doesn't really matter which) for serial communication at 9600 baud.
Out of the box arch arm shows ttyS0 and ttyS1 I belive that ttyS0 is the one connected to the debug header and can be used for a console. I have added my user to the uucp group so I have access to the serial ports. When I try to open ttyS1 with picocom I get
Code: Select all
FATAL: failed to add port: Filedes is not a tty

I have masked out gettys with:
Code: Select all
systemctl mask getty@ttyS1

I suspect that there is some hardware configuration that I need to do. However, looking at the documentation for the arietta they suggest generating a .dtb file with the online generator and downloading it as /boot/acme-arietta.dtb. I tried this and it didn't seem to do anything as I changed the boot parameters and I did not see these reflected in /proc/cmdline. I also tried to replace the .dtb file in /boot/dtbs and this made the device not boot.
can someone point me in the correct direction? I know that for the rpi there are cmdline.txt and config.txt to configure things. On this board that does not seem to be the case. Any help would be greatly appreciated.
jesseF
 
Posts: 19
Joined: Mon Jun 15, 2020 3:36 am

Re: Arietta G25 serial ports

Postby summers » Mon Dec 07, 2020 12:46 pm

The UART are defined in this file: https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/at91sam9x5.dtsi

and: https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/at91sam9x5_usart3.dtsi

You could try setting more status to enable. Now hopefully your uboot has a way of doing this (modern ones do), and can probably do it by modifying a file in /boot typically /boot/boot.txt

You should be able to see which devices come up with
Code: Select all
dmesg | grep serial

Example from my odroid-c2, line in /boot/boot.txt
Code: Select all
    fdt addr ${fdt_addr_r}
    fdt set /soc/apb@d0000000/mmc@74000 max-frequency <0x08f0d180>

And this gives:
Code: Select all
[summers@odroid-c2 ~]$ od -t x1 /proc/device-tree/soc/apb\@d0000000/mmc\@74000/max-frequency
0000000 08 f0 d1 80
0000004

So by examining the dts, you can see what you need to change, fine it in /proc/device-tree just to make sure, then use uboot to change, and then use /proc/device-tree to check change has been made.
summers
 
Posts: 926
Joined: Sat Sep 06, 2014 12:56 pm

Re: Arietta G25 serial ports

Postby jesseF » Tue Dec 15, 2020 2:13 am

When I do
Code: Select all
dmesg | grep serial

I get this
Code: Select all
[   55.400000] audit: type=1130 audit(1607300186.059:21): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=serial-getty@ttyGS0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

which just seems to be the getty I set up on the gadget serial port

not quite sure what is going on in your boot.txt, can you expain? I'm unsure how to use that on my board.
Is there a way to query uboot to see what the options/version are?
jesseF
 
Posts: 19
Joined: Mon Jun 15, 2020 3:36 am

Re: Arietta G25 serial ports

Postby summers » Tue Dec 15, 2020 5:21 am

My boot.scr is a script that uboot distro runs. It basically just boots the machine with the right objects passed to kernel. What's probably better is give the listing of what is in /boot - then we can establish better what functionally your uboot has. What it's looking like is you don't have a typical arch arm set up ...

You should also be able to do something like:
Code: Select all
cat /proc/device-tree/ahb/apb/serial*/status

And see which of the uart are enabled/disabled. Path above, just created quickly, so could easily be wrong, just look around the tree for the serial descriptors in the device tree.
summers
 
Posts: 926
Joined: Sat Sep 06, 2014 12:56 pm

Re: Arietta G25 serial ports

Postby jesseF » Sat Dec 19, 2020 5:49 pm

Here is what is in boot:
Code: Select all
$ ls /boot/
acme-arietta.dtb  boot.bin dtbs  initramfs-linux.img  zImage

This is the stock install
I wrote a small script to print the contents of the status files for the serial files. results are as follows:
Code: Select all
/proc/device-tree/ahb/apb/serial@f801c000 : okay
/proc/device-tree/ahb/apb/serial@f8020000 : disabled
/proc/device-tree/ahb/apb/serial@f8024000 : disabled
/proc/device-tree/ahb/apb/serial@f8028000 : disabled
/proc/device-tree/ahb/apb/serial@f8040000 : disabled
/proc/device-tree/ahb/apb/serial@f8044000 : disabled
/proc/device-tree/ahb/apb/serial@fffff200 : okay
jesseF
 
Posts: 19
Joined: Mon Jun 15, 2020 3:36 am

Re: Arietta G25 serial ports

Postby summers » Sun Dec 20, 2020 10:07 am

yes thats good. We can see you have the device tree, and it has the serial ports in the standard place for that device. You can see that dbgu and usart0 have been enabled, but non of the others.

/boot/boot.bin sounds like it distro part of uboot, but standard names there are
Code: Select all
boot_scripts=boot.scr.uimg boot.scr

So looks like your uboot is set differently. Anyway look at the file /boot/boot.bin - hopefully most of it will be plain text; and explain how your machine boots. Thats probably what we need to modify to have uboot modify the device tree.
summers
 
Posts: 926
Joined: Sat Sep 06, 2014 12:56 pm

Re: Arietta G25 serial ports

Postby jesseF » Sun Dec 20, 2020 4:29 pm

unfotunantly boot.bin only has a small amount of text I have coppied the readable parts out of vim:
Code: Select all
^D^K^D^L^D^N^D^O^D`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�^@^@zImage^@AT91Bootstrap^@ 3.7-00025-g3f957ce-dirty (Sun Jun 14 20:41:08 MDT 2015)^@SD/MMC: ^@Done to load image
^@Failed to load image
^@Success to recovery
^@dtbs/at91-arietta256^@.dtb^@MCCK^@MCCDA^@MCDA0^@MCDA1^@MCDA2^@MCDA3^@1-Wire^@RXD^@TXD^@Error to read data, sr: %d
^@Data Transfer in Progress.
^@Cmd: %d Response Time-out
^@Cmd: %d, error check, status: %d
^@SD: Card Capacity: ^@Unusable Card
^@High or Extended
^@Standard
^@SD: Specification Version ^@1.0 and 1.01
^@1.10
^@3.0X
^@2.00
^@SD: Not support hs function switch
^@Timeout, wait for card ready
^@*** FATFS: f_open, filename: [%s]: error
^@*** FATFS: f_read: error
^@*** FATFS: f_mount mount error **
^@SD/MMC: Image: Read file %s to %d
^@*** FATFS: f_mount umount error **
^@*** FATFS: f_mount error **
^@SD/MMC: dt blob: Read file %s to %d
^@** Bad zImage magic found: %d
^@DT: the blob is not a valid fdt
^@
Using device tree in place at %d
^@
Starting linux kernel ..., machid: %d

^@
Booting zImage ......
^@zImage magic: %d is found
^@1-Wire: reset fail
^@1-Wire: Loading 1-Wire information ...
^@1-Wire: ROM Searching ... ^@Done, %d 1-Wire chips found

^@WARNING: 1-Wire: No 1-Wire chip found
 ^@1-Wire: BoardName | [Revid] | VendorName
^@1-Wire: family %d is not supported
^@1-Wire: reset failed
^@WARNING: 1-Wire: Failed to read from 1-Wire chip!
^@  #%d^@  %s [%c%c%c]      %s 
^@  %s [%c%c]      %s 
^@WARNING: 1-Wire: Unknown board type
^@1-Wire: Failed to read CM board information
^@1-Wire: Failed to read DM board information
^@1-Wire: Failed to read EK board information
^@
1-Wire: Using defalt information
^@
1-Wire: SYS_GPBR2: %d, SYS_GPBR3: %d

^@EMBEST^@FLEX^@RONETIX^@COGENT^@PDA INC^@PDA^@ATMEL-RFO^@SAM9x5-EK^@SAM9x5-DM^@SAM9G15-CM^@SAM9G25-CM^@SAM9G35-CM^@SAM9X25-CM^@SAM9X35-CM^@PDA-DM^@TM4300^@TM4301^@TM7000^@SAMA5D3x-MB^@SAMA5D3x-DM^@SAMA5D31-CM^@SAMA5D33-CM^@SAMA5D34-CM^@SAMA5D35-CM^@SAMA5D36-CM^@SAMA5D44-MB^@

Looks like the source can be found at https://github.com/tanzilli/at91bootstrap and the PKGBUILD (with a patch or two) is at https://github.com/archlinuxarm/PKGBUIL ... ap-arietta I looked but I didn't really see anything that stands out as far as how to configure it

You can see that dbgu and usart0 have been enabled, but non of the others.
I guess this would correspond with /dev/ttyS0 and /dev/ttyS1 that I see. Not sure why I wouldn't be able to open them.
jesseF
 
Posts: 19
Joined: Mon Jun 15, 2020 3:36 am

Re: Arietta G25 serial ports

Postby summers » Sun Dec 20, 2020 5:35 pm

Eik - so its looking like your board doesn't use uboot! This then makes it a lot harder, as not clear that we can make on the fly device tree changes.

You could attach a uart to the dbg port - and just record the messages as it comes up. But probably its becoming hard.

checking dmesg, and we should be able to see the two serial lines enabled so far coming up - which will help. /proc/cmdline should say which one gets the console messages. e.g. my pocket beagle has log like this:
Code: Select all
[    5.899743] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 20, base_baud = 3000000) is a 8250
[    6.763759] printk: console [ttyS0] enabled
[    6.769407] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 27, base_baud = 3000000) is a 8250
[    6.779578] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 28, base_baud = 3000000) is a 8250
[    6.789756] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 41, base_baud = 3000000) is a 8250


What may be part of the confusion is which device tree is used, one is /boot and another in /boot/dtbs
summers
 
Posts: 926
Joined: Sat Sep 06, 2014 12:56 pm

Re: Arietta G25 serial ports

Postby jesseF » Sun Dec 20, 2020 5:52 pm

so /proc/cmdline shows
Code: Select all
console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait

but I do not see the serial coming up in dmesg (I greped fror both "serial" and "ttyS") not sure if a kernel module is not being loaded or something??

I'll look at getting a USB-UART adapter on the debug port. I didn't buy the one that fits nicely so, I'll see what I have.

from looking at https://github.com/archlinuxarm/PKGBUIL ... -fix.patch and boot.bin, I am pretty sure that /boot/dtbs/at91-arietta256 is the dtb that is used
Last edited by jesseF on Mon Dec 28, 2020 3:12 am, edited 1 time in total.
jesseF
 
Posts: 19
Joined: Mon Jun 15, 2020 3:36 am

Re: Arietta G25 serial ports

Postby jesseF » Sun Dec 20, 2020 9:06 pm

I got a USB to UART adapter on the debug port. This is what I see on boot
Code: Select all
RomBOOT
���RomBOOT


AT91Bootstrap 3.7-00025-g3f957ce-dirty (Sun Jun 14 20:41:08 MDT 2015)

1-Wire: Loading 1-Wire information ...
1-Wire: ROM Searching ... Done, 0x0 1-Wire chips found

WARNING: 1-Wire: No 1-Wire chip found
 
1-Wire: Using defalt information

1-Wire: SYS_GPBR2: 0x4010425, SYS_GPBR3: 0x8421

SD/MMC: Image: Read file zImage to 0x22000000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: dt blob: Read file dtbs/at91-arietta256.dtb to 0x21000000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X

Booting zImage ......
zImage magic: 0x16f2818 is found

Using device tree in place at 0x21000000

Starting linux kernel ..., machid: 0xffffffff
jesseF
 
Posts: 19
Joined: Mon Jun 15, 2020 3:36 am

Next

Return to Community Supported

Who is online

Users browsing this forum: No registered users and 1 guest