Setup Raspberry PI 4 with CORE2-ROS


I am trying to configure Raspberry PI 4 SBC with CORE2-ROS controller (modified with new resistors supporting I2C at the end 2019). Talking about ROSBOT.
I know you guys are not supporting RPI 4 yet, so I am installing everything in there from scratch, including the following:

As result, RPi.GPIO test works, ROS Noetic works with rviz, rgt_graph.

However I could not establish serial communications with CORE2-ROS with following error:
[INFO] [1641958937.312490]: ROS Serial Python Node
[INFO] [1641958937.329470]: Connecting to /dev/serial1 at 525000 baud
[ERROR] [1641958937.338039]: Error opening serial: [Errno 13] could not open port /dev/serial1: [Errno 13] Permission denied: ‘/dev/serial1’

Also, I have few questions to make sure that all required packages installed properly.

  • Do you have procedure or documentation describing which packages should be installed from scratch if you are not using pre-packaged images? As far as I know (and I tested as well), ASUS Tinker Board full images provided by Husarion don’t work on RPI.
  • Should CORE2-ROS firmware for ROS Noetic work with RPI as is?
  • You also you mentioned about docker containers that might work on RPI and Tinker. From the Husarion · GitHub or Docker Hub which one’s do you recommend installing on RPI 4?

Thank you very much!

Hi lsradets.

Sorry for late response. You are lucky because we are currently testing raspberry, and we had exactly the same problems with CORE as you have right now. Fortunately, we solve them. You have to make few changes in /boot/firmware/config.txt. I will send you more details on Monday. We haven’t finished transitions yet, so I can’t promise everything will work.

In case of other questions:

  • Any docker container should work with raspberry as long as it was built for arm64. As I remember, all of them were built that way, so everything should work just fine. Some of them were even tested on this platform.
  • CORE2 firmware is related to ROS distro, not SBC, so it will work just fine. Docker images have their own CORE firmware, so you will need to flash a new one if you plan to use docker. With working UART it will be the same procedure as always.
  • An last question, but in revers order from yours - the software. Chroot for Up Board and for TInker Board are all you need. We recently moved our build system to github, so now you can check what exactly what is in our systems. Those scripts have everything we are customizing. If you want to stick to bare minimum, a docker will be all you need.

Other changes you have already done make sense and I hope you will make it running.

Best regards,
Krzysztof Wojciechowski.

Thank you Krzysztof_Woj ! I will be waiting for the good solutions :wink:
I think it will be great for the whole RPI community!

Hi lsradets

In order to communicate RPI with CORE2 follow these steps:

  • Setup GPIO:

    • sudo gropuadd gpio
    • sudo adduser $USER gpio
    • pip3 install RPi.GPIO
  • Modify U-Boot

  • The simlink /dev/serial0 should refer to /dev/ttyAMA0 otherwise it will be impossible to flash CORE2 using uart pins.

  • Edit the cmdline.txt file. Remove the console=serial0,115200 entry and make sure enable_uart=1 is set.

  • Add dtoverlay=disable-bt to usercfg.txt

  • Run sudo systemctl disable hciuart

All the above steps should allow you to flash CORE2 from Rapsberry Pi 4. Like I said before. I can’t promise it will 100% work, so I will really appreciate your feedback. Also, sorry for once again pointing steps you have already done, but it’s better for other people to have everything as step by step instruction.

Edit: corrected errors pointed in message below

Best regards,
Krzysztof Wojciechowski

Thank you very much for your quick reply!
Couple of things to mention.

  1. There is a typo in the first 2 lines in Setup GPIO of your reply (not big deal, just to make it clean for people who will be copy these lines :grinning_face_with_smiling_eyes: ). It should read:

Setup GPIO:

  • sudo groupadd gpio
  • sudo adduser $USER gpio
  • pip3 install RPi.GPIO
  1. In my RPI configuration I have simlink /dev/serial1 → ttyAMA0
    husarion@husarion:/boot$ ls -l /dev/se*
    crw-rw----+ 1 root audio 14, 1 Dec 10 04:04 /dev/sequencer
    crw-rw----+ 1 root audio 14, 8 Dec 10 04:04 /dev/sequencer2
    lrwxrwxrwx 1 root root 7 Dec 10 04:04 /dev/serial1 → ttyAMA0

  2. My cmdline.txt and usercfg.txt located in /boot/firmware directory. Please see below.

husarion@husarion:/boot/firmware$ nano cmdline.txt
net.ifnames=0 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc quiet splash

  1. I modified it, and it looks now:
    husarion@husarion:/boot/firmware$ nano cmdline.txt
    net.ifnames=0 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc quiet splash


  2. I ran sudo systemctl disable hciuart and then restarted RPI and CORE2
    husarion@husarion:/boot/firmware$ sudo systemctl disable hciuart
    Removed /etc/systemd/system/

  3. After power Off / On I observed the following:

  • husarion@husarion:~$ sudo python3
    LR1 yellow LED was flashing 10 times - test passed

  • And I lost port and simlink /dev/serial1 → ttyAMA0 now it’s /dev/serial1 → ttyS0:
    husarion@husarion:/boot$ ls -l /dev/ser*
    lrwxrwxrwx 1 root root 7 Dec 10 04:04 /dev/serial1 → ttyS0

    As result I can not test sudo stm32loader -c rpi -f F4 -p /dev/serial1:
    husarion@husarion:sudo stm32loader -c rpi -f F4 -p /dev/serial1
    Could not configure port

  • Before I make changes to cmdline.txt and usercfg.txt when I executed
    husarion@husarion:sudo stm32loader -c rpi -f F4 -p /dev/serial1
    LR1 yelow LED was lit solid yellow, no command output, until I pressed CTRL-C to stop it. So I guess, at least telling me that port /dev/serial1 existed, but misconfigured.
    Now after new configuration I lost it. Just a thought…

Please let me know your thoughts

Thanks so much,

Hi lsradets

I am sorry for that late response, but I had a really busy week. So far I send you what I got from our internal tests. Can we postpone setting it up to the next week, so I will get my hands on Raspberry Pi as well? I will be preparing a script for automated build of ubuntu core so in the end it should be just a matter of running a bash script on a fresh system.

I also edited my message to what you pointed out. Thanks for the catch!

Best regards,
Krzysztof Wojciechowski.

Thank you, Krzysztof!
It would be a great idea to use scripted build. This way we will avoid mistakes, typos and most important we don’t need to keep track of optimized Ubuntu installation for RPI, ROS setup / configuration, additional software installation / tweaking. Everything will be consistent if we need to re-build or troubleshoot. Another advantage would be for educational or debugging purposes, we will be able to read the script and install packages manually line by line as well!

So looking forward to the automated script!!!

Thanks again,