I have installed Torizon Core (minimal with docker support) and I install node-red for docker, all works fine, but when I use modbus contrib and configure serials instead TCP, serial doesn’t output data.
I have used /dev/ttyLP0
I’m using Col evaluation board and IMX8. I have used also serial contrib sending data on the serial port directely but nothing.
ttyLP0 works properly if i send following command from terminal:
echo -ne ‘Hello World’ > /dev/ttyLP0
As you can see the original user never replied back to this post, so it never got looked at. Given that, I have some questions before we look into this.
What version of TorizonCore are you running here?
Are you experiencing the exact same issue as the original user? (i.e. serial ports not working with node-red)
Hi @jeremias.tx,
thank you for your quick response.
To answer your questions:
I’m running the following version of TorizonCore:
$ uname -a
Linux verdin-imx8mm-06895363 5.4.77-5.1.0+git.afc2df4893e6 #1-TorizonCore SMP PREEMPT Wed Dec 30 18:41:13 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
As mentioned, I’m running node-red in a docker container and installed node-red-contrib-modbus to use Modbus communication via the UARTs. As stated in the docs, I also tried listing the available UARTs from inside the node-red container using npx @serialport/list which gives me
although I’ve mapped the correct UARTs into the container (see configuration from my first post).
Communication works well when I use a python container and implement Modbus communication using pymodbus for example. Seems that there is a problem with the UARTs mapping…?
Everything else, such as using GPIOs works well from node-red.
Alright after digging around for a bit, I think I have a educated guess about the issue here. So I think the issue is with node itself. As you noticed NXP i.MX devices use ttymxc* for their serial/UART devices. I went through the serialport utilities in node and found this: bindings-cpp/linux-list.ts at main · serialport/bindings-cpp · GitHub
In the typescript source I listed it seems ttymxc* isn’t a valid serial port name in this node utility. Which is why it’s never detected or picked up as you noticed. My typescript and node knowledge isn’t the best so I may also be interpreting this wrong. But it leads me to believe node may not have support for ttymxc* devices. Not sure if there is a way around this, other than asking the maintainers to add support.
That’s possibly an idea, assuming the detection doesn’t ignore symlinks or it evaluates the symlink to the absolute path. But yeah as you said there may be other factors that could make or break this. Which is why I’m tentatively judging that node does not support i.MX serial ports.
@GGG Not really. The issue is still ultimately with node’s serialport module not supporting the naming scheme NXP uses for their serial/UART devices. You can try bringing this issue to the related Github project and ask for support for this use-case.