Advantech-IIoT / UNO-220-POE-

4 stars 1 forks source link

Some problems with Bullseye version #4

Open FStefanni opened 2 years ago

FStefanni commented 2 years ago

Hi,

I know that the official docs say that the supported RaspberryOS version is Buster, but the porting to the latest stable would be great.

At the moment I have seen these issues with Bullseye:

  1. The RTC deb package does not install
  2. The GPIO are not working, at least for writing.

Regards

kumajaya commented 2 years ago

Installing Ubuntu server on Raspberry Pi 4B with Advantech UNO-220-P4N2AE HAT

  1. Installing Ubuntu server: how-to-install-ubuntu-on-your-raspberry-pi
  2. Enable Epson RX-8010SJ-B RTC, edit modules.conf to load rtc_rx8010 kernel module on boot:

sudo nano /etc/modules-load.d/modules.conf

rtc_rx8010

  1. Edit config.txt to enable TI TCA9554 IO expander:

$ sudo nano /boot/firmware/config.txt

dtoverlay=pca953x,addr=0x27

  1. Enable Infineon OPTIGA™ TPM SLB9670:

$ dtc -I dtb -O dts /boot/firmware/overlays/tpm-slb9670.dtbo -o tpm-slb9670-ce0.dts

$ nano tpm-slb9670-ce0.dts

$ sudo dtc -I dts -O dtb tpm-slb9670-ce0.dts -o /boot/firmware/overlays/tpm-slb9670-ce0.dtbo

$ sudo nano /boot/firmware/config.txt

dtoverlay=tpm-slb9670-ce0

  1. Set location timezone, i.e. Asia/Jakarta:

$ sudo timedatectl set-timezone Asia/Jakarta

  1. Reboot

  2. Get RTC time:

$ sudo hwclock -r --verbose

  1. Set RTC time:

$ sudo hwclock -w --verbose

  1. Test IO expander using gpiod tools, connect GPIO 0 to GPIO 1 terminal:
$ sudo apt-get install gpiod
$ gpiodetect
$ gpioinfo
$ gpioset 2 0=0
$ gpioget 2 1
$ gpioset 2 0=1
$ gpioget 2 1
  1. To use IO expander in Node-RED using node-red-contrib-tca9554, unload gpio_pca953x kernel module first or comment out "dtoverlay=pca953x,addr=0x27" in /boot/firmware/config.txt to disable kernel driver permanently:

$ sudo modprobe -r gpio_pca953x

  1. Control PL1 GPIO LED using rpi gpio out node on PIN 32 (GPIO 12)

  2. Test TPM support:

$ sudo apt-get install tpm2-tools
$ sudo tpm2_getrandom 8 | xxd -p
$ sudo tpm2_getrandom 16 | xxd -p
$ sudo tpm2_getrandom 32 | xxd -p
  1. For serial console, connect RS-232/RS-485 USB serial converter and use minicom (Linux) or Tera Term (Windows) on host PC
  1. Delete "console=serial0,115200" in cmdline.txt to disable serial console and use RS-232/RS485 port for something else:

$ sudo nano /boot/firmware/cmdline.txt

FStefanni commented 2 years ago

Hi,

thank you for the proposed procedure, I will eventually try it.

In the meantime, I have done some tests, and I am able to install and run GPIO's. Follows what I have discovered (I also report some documentation found scattered in various places).

Before installing:

  1. The package firmware-misc-nonfree can cause big issues with the Advantech packages:
    • version 1:20210315-3+rpt5 works fine with Advantech packages
    • version 1:20210315-3+rpt6 with Advantech packages destroys the system!
  2. So I suggest a downgrade, and to hold the version:
    # Check the package status: if installed and its version
    apt list firmware-misc-nonfree 
    # If installed, downgrade its version and put on hold:
    apt install firmware-misc-nonfree=1:20210315-3+rpt5
    apt-mark hold firmware-misc-nonfree
  3. The older version could be no more available... in case, try to find it somewhere in internet, install it by hand, and put on hold. I have been unable to find it in internet... (for my luck, a new OS image had already installed the correct version).

To install:

  1. The simplest way to install the packages is by adding the apt source: deb [trusted=yes] https://advantechralph.github.io/uno-220/dpkg/ /
  2. Install all the following: uno220config uno220gpio uno220uart uno220gpiopins
  3. The uno220rtc does not install...
  4. uno220tpm, uno220cputempmon are optionals, and I did not install them
  5. I only tested the GPIO, not other functionalities

Nevertheless, an up-to-date version of Advantech packages would be welcome.

Regards.

Yuchun-Chen-ADV commented 2 years ago

Hi,

Thanks for your advise.

Advantech has upgrade the RTC packages to support new Bullseye version. The version is V0.1-6. You can try it again. Please follow the below step to install all packages. Thanks. https://github.com/Advantech-IIoT/UNO-220-POE-/tree/docs/dpkg/README/#how-to-install-uno-220-packages