VS Code torizon extension cant create C project

Hi everyone!

Im trying to make a HMI with crank that can send and recieve CAN signals. My problem is that with the current state of crank this can only be achieved with a backend program talking with the CAN port and the GUI(crankstoryboard). I havent been able to find any solutions on this topic and on the toradex site the CAN communication program is in python, on cranks site the backend is in C and then there is the GUI which uses Lua.

Anybody, that has any information on making an application that is able to communicate via the CAN connectors and maybe send the signals to different containers, please dont be shy and share your results and experiences if you can. I would greatly appriciate them!

Best regards,
Jeffrey.

Greetings @BoaheneJeffrey,

Just to make sure I understand, are you primarily looking for an example of how to interface with CAN in C?

If so then the common method would be to use SocketCAN. Another customer actually has done this and provided their code in another thread here: Error binding can0 on ApalisiMX8 using socketcan

As for interfacing this with the Crank part of the stack this may need further comment from slack themselves.

Does this information help? Or are you looking for something else?

Best Regards,
Jeremias

Greetings!

Thank you for your answer it helped though im still stuck. Every time i run my application for it to be able send the CAN signal out i have to manually set the bitrate and the UP state with commands typed in otherwise it gives an error that the network is down. I would like it to be as it is with the example python code which does this automatically.

Any ideas?

Best regards,
Jeffrey.

Hi @BoaheneJeffrey,

Can you please have a look at the startup script (C/C++ Development and Debugging on TorizonCore Using Visual Studio Code | Toradex Developer Center) that is available on the extension? It will allow for you to type in commands to your module before running the container. You can find here an example of what this can be used for: LVDS V1.0A capacitive display - #4 by lucas_a.tx

Best regards,

I would like it to be as it is with the example python code which does this automatically.

You can also just execute these commands from the C program itself. Notice that this is what the example python program does as well.

Best Regards,
Jeremias