IOT2000: Arduino support?

Hi,
I am sending a message here after posting on the Github issues of the repo, as those forums are more active :wink:

A major feature of the IOT2020/2040 is to run Arduino programs alongside Linux.
Deploying such programs is done by flashing the example image onto the microSD card and booting, then using the MicroUSB port on the device, selecting the right COM port in the Arduino IDE and using the ā€œUploadā€ button.
Unfortunately, when using the BalenaOS/ResinOS image (either from the cloud panel or the homepage), the IOT2020 wonā€™t show up in both the Arduino IDE and Windows Device Manager.
Is Arduino supported? If not, is it a planned feature? We are trying out BalenaOS as a replacement to the base image but Arduino support is a must have.
Cheers!

Hi, the Arduino feature as you have mentioned is not supported. It sounds from your explanation, that it needs a special OS for that to work (as booting from that SD card).

Found some posts regarding this feature, and looks interesting: Tutorial - Program the IOT2000 with Arduino IDE!

Not entirely sure how that feature would combine with the way balenaOS is set up (in terms of how to get the software on the device, and how to run it), weā€™d need to look into this.

Looking at the tutorial, the IoT2000 might be a Intel Galileo compatible board (or using Galileo inside?), so Iā€™m sure it can be programmed many different ways, and the hardware interfaces should be documented.

Thus, thanks for bringing this to our attention, weā€™ll have to try it out, In the meantime thereā€™s no Arduino programming support planned for IoT200 with balenaOS. I believe it should be possible to provide similar support by running a specially crafted container on the device, but thatā€™s just a hunch. This is the current status, but let you know if we have anything new regarding this!

Hey @edorgeville was looking into this a bit more, and actually it seems much more feasible than Iā€™ve expected ( knock on wood).

  • looking inside Siemensā€™ example image, it might be possible to replicate that functionality (it looks like only a few tools are involved), and could possibly receive sketches over serial
  • also it seems like the Arduino IDE creates Linux executables for the IOT2000 (based on this forum post), so it could be checked in and shipped/deployed to devices by the natural balenaCloud way. This is just a hunch, but would make things interesting.

So there might even be more than one way to do this, catering to more interesting workflows.
Would recommend checking things out along this path, and as mentioned, weā€™ll look into this further and let you know if thereā€™s any development!

1 Like

Wonderful news!
I did notice the elf files in the past, didnā€™t think that would be an executable.
I will do more digging toward making a Dockerfile running said .elf file.
Thanks a lot!

This was a waaaaay deeper rabbit hole than I thought :sweat:
I tried to understand the structure of the meta-iot2000 repo but the whole Yocto ecosystem is still a complete mystery to me after a day and a half of reading.

Hey @edorgeville I would not think the solution will be in meta-iot2000, that is the host OS. In my opinion based on the few hours check above, it should all work on the application level, so donā€™t have to dig into that area at all.

The main thing is I believe:

  • creating an application that does the same thing as the Siemens example OSā€™s Arduino service, just inside a container, or
  • check out the files created by the Arduino IDE and check how to ship and run those.

These should be a lot more tractable. No need to go down to the OS level necessarily.

I compiled the Blink example from Arduino, here is the elf file in case anyone wants something to test with :slight_smile: It blinks the USER led on and off.
https://gist.github.com/edorgeville/fa4955c3234a6fb05bd67d3f5ecae206

I tried loading up resin/iot2000-alpine-buildpack-deps, chmod +xā€™ing the file and running it but I get a No such file or directory error.

$ run -it --rm resin/iot2000-alpine-buildpack-deps /bin/bash

$ wget https://gist.github.com/edorgeville/fa4955c3234a6fb05bd67d3f5ecae206/raw/8dbb019d14a205a47601c20ff7b6cf84b860e624/Blink.ino.elf
$ chmod +x Blink.ino.elf
$ ./Blink.ino.elf
#> bash: ./Blink.ino.elf: No such file or directory

I also included a readelf -a output which I do not understand any of either.

Interesting platform.

Its based on the Intel x1000. It might be worthwhile checking the old discontinued Intel Galileo dev board for hints on how to go about doing this.

This should be possible via the Arduino IDE. We need to figure out what is running in the SiemensOS that makes the communication with arduino ide happen. I tried to hunt around and I think the magic happens here

There is the launcher script with a systemd service.

      $CLLOADER $CLLOADER_OPTS < /dev/ttyGS0 > /dev/ttyGS0 & clPID=$!

Does that line read from /dev/ttyGS0 and then pipe it out to /dev/ttyGS0? Not entire sure what its doing. Reading from Arduino IDE via /dev/ttyGS0 and simultaneously writing to a sketch perhaps?
Maybe this is the way the clloader utility works

Do you see /dev/ttyGS0 in the host/app containers?

Regards
ZubairLK

1 Like

From what I understand, this would be the output (?), maybe what youā€™d get from running Serial.print() inside the Arduino program.
I think clloader does run the Arduino program (sketch) too.


Not from the host nor from a container. Hereā€™s the output of ls -la /dev (character limit wouldnā€™t let me post it here):

https://gist.githubusercontent.com/edorgeville/fa4955c3234a6fb05bd67d3f5ecae206/raw/f22e393517c9aa9d61bc1a15c944390e4db09096/dev_ls.txt

Also, let me know if you need access to the host, our unit is not currently in use.