UART ttyAMA0 RaspberryPI 3

Hello I have a simple app that needs to use the ttyAMA0 serial port of Raspberry PI 3.
I am using ResinOS dev configuration.
I have checked some posts on the forum and what I tried to do is :

  1. in the device configuration I have set RESIN_HOST_CONFIG_dtoverlay topi3-miniuart-bt
  2. in config.txt of the root partition I have set the same variable to the same value
  3. tried disabling the console output to the UART as suggested in Disable console over Serial in Dev on RPi3? :
    #mount -o remount,rw /
    #systemctl mask serial-getty@serial0.service
    I am still encountering problem when trying to read data from that serial port , specifically I am using libmodbus to read registers from a modbus device. the app works when I run it on the native Raspberry PI OS.
    do you have any suggestions I could try ?
    thanks
1 Like

Hello,
can you check the docs here: https://docs.resin.io/hardware/i2c-and-spi/#using-uart-or-serial-on-raspberry-pi-3
and this sample project here: https://github.com/resin-io-playground/rpi3-uart
and let us know if that helps?

Best,
ilias

I get these results running that application :
Calling write
Received: <Buffer 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d>
Received: <Buffer 21 21 21 21 21 21 21 21>
Received: <Buffer 21 21 21 21 21 21 21 21>
Received: <Buffer 21 21 21 21 21 21 21 21>
Received: <Buffer 21 21 21 21 21 21 21 21>
Received: <Buffer 21 21 21 21 21 21 21 21>
Received: <Buffer 21 21 21 21 21 21 21 21>
Received: <Buffer 21 21 21 21 21 21 21 21>

So you receive data successfully there.
Is there of any help to you? I mean, can you adapt this project or get ideas from it for your application?

yes it is useful.
I made a simple c++ app that does a similar echo test and I cannot make it work perfectly at the moment when using it on a container on ResinOs. It seems there are other bytes sometimes, I can read other strings, possibily from the console output ?
this simple C++ uart echo app is working properly when on the native Raspberry Pi OS.
I tried removing the console line voice from the command_line.txt file , but the problem still happens.

Hi @Antonio77
Were you able to make any progress on this issue?

Hello Lucian, none else from Resin told me if there are fixes on this. You should ask this to Resin’s team as I found this problem with the Raspberry PI image from Resin. I have no way to modify it, as far as I know. my app is ok with standard Raspbian Image for Raspberry PI. I haven’t checked if there are recent updates to the image available from Resin.

Hi @Antonio77,

Could you try all the steps listed in this reply to the post you linked earlier? Disable console over Serial in Dev on RPi3? These steps appear to have solved the problem for that user.

If that doesn’t work, could you try using a production image, and let us know the results? Please include the version of ResinOS you are using in your response.