Command to detect A20 LIME2 board revision

Started by kimfaint, May 11, 2022, 08:46:52 AM

Previous topic - Next topic

kimfaint

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?

LubOlimex

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.
Technical support and documentation manager at Olimex

kimfaint

#2
Thanks.  I tried the above and had no luck.

Using the latest minimal image 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

LubOlimex

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?
Technical support and documentation manager at Olimex

kimfaint

#4
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

faraz

olimex@a20-olinuxino:~$ sudo ./brd_info.py
Traceback (most recent call last):
  File "/home/olimex/./brd_info.py", line 8, in <module>
    block = bus.read_i2c_block_data(0x50, 0, 32);
  File "/usr/local/lib/python3.9/dist-packages/smbus2/smbus2.py", line 612, in read_i2c_block_data
    self._set_address(i2c_addr, force=force)
  File "/usr/local/lib/python3.9/dist-packages/smbus2/smbus2.py", line 354, in _set_address
    ioctl(self.fd, I2C_SLAVE, address)
OSError: [Errno 16] Device or resource busy

I get this error when I run the script.
I think its because the smbus has changed?

Is there a new version of this script? I want to see the board revision of a site that is not failing.

I can only get to the board via ssh sor similar.

LubOlimex

I can confirm the script stopped working at some point not sure why.
Technical support and documentation manager at Olimex