Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: kimfaint on May 11, 2022, 08:46:52 AM

Title: Command to detect A20 LIME2 board revision
Post by: kimfaint on May 11, 2022, 08:46:52 AM
We have a large number (hundreds) of A20 LIME2 boards deployed remotely and we need to work out how many are Rev.C/Rev.D (no EEPROM) and how many are a later revision Rev.E and above.

Is there a command I can use to probe the EEPROM to see if it exists and if it does what board revision it has stored in the EEPROM?
Title: Re: Command to detect A20 LIME2 board revision
Post by: LubOlimex on May 11, 2022, 01:04:31 PM
You can directly probe it inside the Linux, no need to go to u-boot. Use the python tool from here:

https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A20/A20-eeprom-contents

You can use the code as basis for own tool.

The documents inside the folder describe the data structure of the EEPROM.
Title: Re: Command to detect A20 LIME2 board revision
Post by: kimfaint on May 12, 2022, 10:10:29 AM
Thanks.  I tried the above and had no luck.

Using the latest minimal image A20-OLinuXino-bullseye-minimal-20220413-094751.img.7z (https://images.olimex.com/release/a20/A20-OLinuXino-bullseye-minimal-20220413-094751.img.7z) on a A20 LIME2 Rev.L I installed the python lib, downloaded the script and ran:
root@a20-olinuxino:~# apt update
root@a20-olinuxino:~# sudo apt install python3-smbus
root@a20-olinuxino:~# wget https://github.com/OLIMEX/OLINUXINO/raw/master/SOFTWARE/A20/A20-eeprom-contents/Python_read/brd_info.py
root@a20-olinuxino:~# python3 brd_info.py
Traceback (most recent call last):
  File "/root/brd_info.py", line 7, in <module>
    block = bus.read_i2c_block_data(0x50, 0, 32);
OSError: [Errno 16] Device or resource busy
There is nothing using the devices according to lsof:
root@a20-olinuxino:~# lsof /dev/i2c-*
During boot the EEPROM was used by U-Boot:
U-Boot SPL 2021.04+olimex-1-20220413.080758 (Apr 13 2022 - 08:09:11 +0000)
DRAM: 1024 MiB
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
Loading configuration from EEPROM: OK
Verifying data: OK
Trying to boot from MMC1


U-Boot 2021.04+olimex-1-20220413.080758 (Apr 13 2022 - 08:09:11 +0000) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
ID:    A20-OLinuXino-LIME2-e16Gs16M Rev.L
SN:    0001E99F
MAC:   30:1F:9A:D0:FB:23
I2C:   ready
DRAM:  1 GiB
Title: Re: Command to detect A20 LIME2 board revision
Post by: LubOlimex on May 12, 2022, 10:15:37 AM
What is the exact board? How is it listed at start of boot? For example, at the board I have here I get this:

U-Boot 2021.04+olimex-1-20220413.080758 (Apr 13 2022 - 08:09:11 +0000) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
ID:    T2-OLinuXino-MICRO-IND Rev.M
SN:    00020C0F
MAC:   30:1F:9A:D1:0D:07
I2C:   ready
DRAM:  1 GiB
MMC:   mmc@1c0f000: 0, mmc@1c12000: 1
Loading Environment from EXT4... *** Warning - bad CRC, using default environment


What do you get at your side?
Title: Re: Command to detect A20 LIME2 board revision
Post by: kimfaint on May 12, 2022, 10:31:40 AM
Exact board detected by U-Boot is A20-OLinuXino-LIME2-e16Gs16M Rev.L.
U-Boot 2021.04+olimex-1-20220413.080758 (Apr 13 2022 - 08:09:11 +0000) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
ID:    A20-OLinuXino-LIME2-e16Gs16M Rev.L
SN:    0001E99F
MAC:   30:1F:9A:D0:FB:23
I2C:   ready
DRAM:  1 GiB
SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
MMC:   mmc@1c0f000: 0, mmc@1c11000: 1
Loading Environment from EXT4... *** Warning - bad CRC, using default environment

Using same Rev.L board but with a much much older wheezy based image (our current production image  :-[ ) I installed as follows and got:
root@a20-olimex:~# apt-get install python-smbus
root@a20-olimex:~# wget https://github.com/OLIMEX/OLINUXINO/raw/master/SOFTWARE/A20/A20-eeprom-contents/Python_read/brd_info.py
root@a20-olimex:~# chmod +x brd_info.py
root@a20-olimex:~# ./brd_info.py
<6>HDMI not connected
[  364.779773] HDMI not connected
Traceback (most recent call last):
  File "./brd_info.py", line 7, in <module>
    block = bus.read_i2c_block_data(0x50, 0, 32);
IOError: [Errno 5] Input/output error
Interestingly when I connected a HDMI monitor I then got:
root@a20-olimex:~# ./brd_info.py
Invalid EEPROM data
Header = 0xffffff00L; should be 0x4f4caa55