Trying to use Storyboard to read sensor data and display them

Hello guys,

First of all I want to say that we are really new to torizon and linux development, but we are forced to learn fast as we are working on a student project (ETH Zurich Switzerland), where we are building a fully electric motorcycle. So I thank you for you understanding in advance.

We are running the Apalis iMX6Q 2GB IT V1.1C with the Ixora V1.1A carrier board. Our host plattform is ubuntu 18.04LTS. We are planning to use a HDMI display with a USB touch interface.

The Goal:

We would like to build a user interface with the CrankSoftware Storyboard Suite for our motorcycle project to display different sensor data (e.g. ambient temperatur, speed etc). For this we need 2 working protocols I2C and CAN.

The Challenge:

We are quite familiar with MCUs now, but we are having a hard time figuring out how to get a C application running on Torizon, such that it reads the sensor data and sends it to the UI. We got the demo UI up and running and we are able to put a custom made interface on it.

The Questions:

1: How do I get a C application running on Torizon? We already went through the getting started guide and got into the debian docker container, where everything works as usual. Is it possible build a C application there and run it in the background as long as the container is running? Or should we build a docker container where a standalone C application is running, similar to the weston container from CrankSoftware.

2: After having a C application running, how do I initialize the peripherals like I2C/CAN and get them running, such that they can read and send data from sensors? I tried to execute i2cdetect on the debian container, but I always got the error “Error: Could not open file `/dev/i2c-0’: Operation not permitted”. Do we have to write our own drive/library or is there already one? Sorry for this dump question, but I think this is where we stuck the most.

3: After having the above two things, how can I send the data to the UI? If this isn’t your part, I understand that, and I will have a deeper look in StoryboardIO for that and contact CrankSoftware for that.

4: Is it possible to use Storyboard with an HDMI display and a USB touch interface?

Sorry for having this many basic questions but after a lot of researching, we thought posting this in you forum would be the best.

Thank you for your help

Dear @mfailla ,

Thank you for the call a while ago.

The following developer article might be helpful in guiding you through accessing I2C and it also features an example to change the value of I2C directly from the command line, who can also be extended into a C program as in your case.

And this is the documentation:

Hope this helps you to keep going forward with the project!

Best Regards, Janani

Greetings @mfailla

Let me try to go through your questions one by one.

  1. The idea with Torizon would be to have an application container that contains your C binary and it’s dependencies with it. This container could be a modified crank container that runs your C application along with the UI or a separate container that communicates with the Crank container.
  2. I believe Saijanani above is on the right track, though let me know if there are further issues with I2C preferably with some details of how you’re trying to access I2C and how it fails.
  3. I’m only lightly familiar with how the Crank tool-set works I’d suggest bringing this to them. They are a partner company of ours and have helped us provide the demo Crank container. Meaning they should be familiar with the mechanisms involved.
  4. This should be possible, are you running into any problems where it doesn’t work?

I hope this helps alleviate some of your issues. Please comment below if there are any future issues or any clarifications I can help provide.

Best Regards,

First of all thank you for your answer!

  1. Thank you this makes sense. I contacted the CrankSoftware-team and it seems that we are able to implement a code directly in the storyboard suite. This should then be compiled together with the UI. However I am not sure, if it can access the hardware directly.

  2. Yes, I got to work, but I never see a device on the bus. Connected to PIN 5 and PIN 6 of the X27 extension of the Ixora 1.1A board.

  3. see 1

  4. No, we were planning to use a USB Touch Interface display, but I’m not sure, how to get it working and to implement it. But for now I am having more problems running the 7’’ capacitive touch display, because there is no touch input and I’m a bit confused on how to modify the devicetree.

Best Regards,

  1. What kind of I2C device do you have connected? Also those pins should correlate to i2c1.
  2. USB touch should “just work” as far as we’ve tested at Toradex. As for the 7’’ cap display I will assume you mean the one Toradex sells. For this we provide a utility container that can apply “Device Tree Overlays” which act as a patch on a currently deployed device tree. Documentation for this utility can be found here:

For overlays we provide some default overlays in the container for some of our displays. The 3 overlays you’ll want to apply are as follows:

  • enable_parallel_display_apalis_imx6.dts
  • display_7_parallel_cap_touch.dts
  • touch_cap_apalis_imx6_evb.dts

In the case you are using a different 7’’ display then you can use the overlays we have provided as reference to create your own.

Best Regards,