we are testing a project on a CompuLab iot-gate-imx8 device and we need to access the onboard serial to comunicate using Modbus protocol.
The onboard serial can be set on 232 or 485 mode, but we cannot find a way to set it on 485.
It should be on /dev/ttymxc0
Using a Debian distro we made it work using command cl_setenv uart_mode rs485
Is there a way to enable and use the port on Balena too?
I found some additional info.
The 232/485 board is based on a SP330 chip.
The /dev/ttymxc0 port is served by IMX-uart driver
How can I switch that port from 232 to 485 and viceversa?
Having to reboot the system is also fine, I just need to set it once.
Is there a U-Boot env variable to set as in the official Debian/Yocto?
Hello @MaxFerretti78 Thanks for posting your issue and researching more about it.
Let me ask my colleagues the solution for your problem.
Hi, in order to access the u-boot shell you can provision a development balena OS image. Once you do that you can hit Enter when the board boots up and then you should have access to the u-boot shell where you can inspect the environment (“pri” should list all the env)
Hi @floion and thank you for your time.
Actually, we are able to access u-boot shell from the boot process and we can set the correct environment variable from there.
The problem seems to be that current BalenaOS image for CompuLab Gateway IMX8 does not recognize the proper env variable set on U-Boot and therefore does not switch serial module to RS485.
We found an issue related to this behaviour: https://github.com/balena-os/balena-iot-gate-imx8/issues/9
Also found another problem and PRed it: meta-balena-imx8mm:layer.conf: Fix typo for u-boot-fw-utils provider by floion · Pull Request #13 · balena-os/balena-iot-gate-imx8 · GitHub
So the next OS release should have it all fixed
I am currently working on a project evaluating the iot-gate-imx8 in combination with BalenaOS. This issue is a showstopper for us. Will the next release be availaible soon? Is there a pre-release available somewhere?
Hi @acostach, thanks for the very nice update.
We’ll try updating with the new OS as soon as we can and get back with a feedback,
Hi @AndreaAlgeri , if you are updating from IOT-GATE-IMX8 v2.71.5+rev6, you’ll need to first enter the webterminal or ssh to the device trough balena cli and execute:
mount -o remount,rw / && rm /etc/profile.d/resize.sh
After that you can trigger the OS update from the dashboard. This is necessary only when updating from 2.71.5+rev6, newer versions don’t need this.
Hi @acotash I have done a clean install with the new image. I am at a loss on how to set the uart_mode permanently. Once booted fw_setenv has no write permission to the boot partition and setting the variable from the boot prompt has no effect after boot. I am new to U-boot and balenaOS so I need a hint here.
Edit: I discovered that cl_setenv does what I need. i just got confused by fw_printenv and fw_setenv existence.
Hey, is the new image working as expected then based on your last message?