iMX7 - how to quickly develop a Serial datalogger software

Good morning to anybody reading, I hope someone could help me or give meaningful suggestions.

Introduction
I’m a newbie to Toradex modules, and also to Docker and containers world. My previous coding experiences spans to MS Windows, (very older) linux sbc’s, some microcontrollers (also arduino, esp32, esp8266) and raspberry (a little). I’m using Windows to develop as a host machine. Coding languages I know: C/C++, Pascal and Python basically. Some Labview experience. Recently I’ve been playing with Nodered (and a little javascript inside it) for home automation. For the task I’m asking help, I will be working together with a colleague which shares similar know-how - stronger on the hardware side - both of us will be involved producing source code.

Object
We are about to develop an autonomous (battery-powered) system whose role is to acquire and log several sensors, dealing mainly with RS232 serial ports and gpio. We chose Toradex SoMs to start development, in particular iMX7d 1Gb with Torizon (preferably) and an Iris carrier. Few hours a day, for several months, the system has to gather sensors’ data (ASCII or binary) coming from RS232 channels (multiplexed) and manage gpio’s, then parse strings and produce data files with no human intervention. It could seem pretty simple… but we only have a couple of months to do that.

Question
I was fascinated by containers phylosophy. The “Torizon with Containers” evaluation I installed on the board allowed to test some pretty NodeRED too. However, soon when I tried to test something with serial ports (using portainer, and device /dev/ttymxc1 “passing”) nothing was woriking, and I found this post from an user that came into a similar issue:
Node-red and serial ports

I thought that using NodeRED could give us an advantage (in terms of development time) over other solutions, in order to easily access data, produce files (even CSV), access them with an easy GUI, and manage config files - all within the “flows” and built-in nodes.
Considering that we must talk to RS232 ports - do you think it’s still possible to develop such an “advanced datalogger” software code by means of NodeRED? Otherwise, what would you suggest in order to get quickly to the result? Feel free to suggest other SoMs or even Yocto or other OS rather than Toradex and docker containers.

Thank you for your kind support (and time, to read my long post!)

Kind regards,
Flavio

Hi @flavio.f!

Thanks for reaching out and welcome to our community :rocket: ! Please feel free to roam around and ask any questions needed.

Can you please add some information for us in order to support you better?

  • Which exact version of TorizonCore do you plan to use?
  • Which Carrier Board and version you’re using?
  • Do you get any error log when trying to run your code? How are you testing the RS232 port?
  • Can you please share how you use the docker run command? Usually, you should add any serial device that you want to have running inside the container

Hello @gclaudino.tx , thanks for your contact.
I will try to reply to your questions although I can be somehow not so expert.

Carrier board I’m currently using is IRIS v1.1B. This is the intended carrier for final use, although in our lab we can use (during development) also ASTER v1.1B and COL Evaluation v3.2B at the moment. Regarding the TorizonCore, I just installed (with EasyInstaller) the latest Torizon with Evaluation containers:

torizon@colibri-imx7-emmc-06514626:~$ uname -a
Linux colibri-imx7-emmc-06514626 5.4.193-5.7.0+git.f5d73fd6e9f8 #1-TorizonCore SMP Fri Jun 24 10:15:32 UTC 2022 armv7l armv7l armv7l GNU/Linux

I was using node-red-node-serialport from within a container created in Portainer based on the NodeRed template.
Through Portainer advanced settings for launching the container, on “advanced settings” I removed access control, set privileged mode, and added devices “/dev/colibri-uartb” and “/dev/colibri-uartc”.
It was the Nodered deploy that wasn’t able to connect serial ports. Today I will try again, maybe also with different serial node; anyhow I was concerned about the post of another user (this one) which probably gave up on this topic.

I will experiment again with NodeRed; although please consider that my request (as I’m very new to this kind of “containers environment”) was also more general, to ask suggestions about: how to quickly build such a “programmable RS232 streams datalogger” application, what could it be the easiest approach according to the experience of other users.

I hope you (and other Toradex users!) can help speed up my development.
Thanks in advance & kind regards.
Flavio

Hi @flavio.f, sorry for the delay in answering you back.

Thanks for the update. It’s nice to know that you have these boards available.

After some internal discussions, this is indeed a problem with the Node-red container. This is a container that Toradex did not develop, we checked if it worked and did some tests. However, what happens with this container is that the way the ports are defined is incompatible with the standard namings on our boards. If you check here, these are the names that they’ll search in order to make the integration of the serial ports: https://github.com/serialport/bindings-cpp/blob/main/lib/linux-list.ts#L6. Therefore, the only way to use the serial ports with Node-Red would be to send a merge request to their github and contribute to the project by adding our naming specifications.

What you can also do in the meantime would be to take a look on the Torizon Samples github. You may find some templates that can use the serial port and even other interfaces: GitHub - toradex/torizon-samples: All sample code related to TorizonCore project.

Another option would be to use another container from one of our partners such as QT/Crank.

We’d also like to suggest you check with our partner list if there could be one of them to help you set up your desired goal. We have companies that works with us that can help from application to carrier board design. Embedded Computing | Hardware & Software Service Partners

How does this sound to you?

Best regards,

Many thanks again @gclaudino.tx
I’m taking a really great tour on the Torizon samples related to hardware, by helping myself with your wonderful tutorials: Peripheral Access Overview

To improve the situation, I went forward on my tests just to find that’s indeed possible to let serial ports work from inside a NodeRed container. To the benefit of other users, here’s how I did

  • put Colibri iMx7 on an IRIS carrier board, to easily connect UARTB TX pin to UARTC RX pin
  • run NodeRed from Portainer, in Privileged mode
  • checked on the terminal of the running container that /dev/ttymxc1 and /dev/ttymxc2 were truly available
  • instead of using other (newer) nodes, I tested this node-red-node-serialport-wildcard 0.7.2. And once it has been properly configured… serial strings were able to flow!

so thanks for all your extensive support and I’ll be posting very soon.
Kind regards,

Flavio

Hi @flavio.f, how are you?

I’m really glad our documentation helped and that you could find a solution on your own :smiley:

Please feel free to come back anytime soon.

Best regards,