Module programming via CAN

Everything regarding communication-protocols like CAN, OBD, LIN, JTAG, BDM, I2C, SPI, ...
User avatar
Stevebe
Pro
Posts: 258
Joined: 08 Feb 2019, 12:28

Re: Module programming via CAN

Post by Stevebe »

geier99 wrote: 16 Feb 2019, 12:04 I have updated the page, so you can order the previous version if you want. (only shipped to europe)
Both version has the same function, there is only one less LED mounted and the bug-fix (1 missing connection) is being solved by hand as you will see in the picture.
Or you can also make your own version and download the hex-file and flash it with the ST-Link Utility.
Thank youi have just ordered one
Digimod
DGAlexandru
Pro
Posts: 364
Joined: 04 Aug 2019, 22:47

Re: Module programming via CAN

Post by DGAlexandru »

I prefer to use Rasppery PI and Linux.
You can add CAN modules to it on SPI interface and you have precompiled can-utils that help you with logging, sending data.
Based on your programming skils you can then choose to use the programming language you want.

You don't need to be a Linux guru, only to be able to follow some tutorials on how to setup RaspBerry PI and then how to connect to it by SSH.
It is far faster than an Arduino board :)
Last edited by DGAlexandru on 19 Aug 2019, 15:13, edited 2 times in total.
User avatar
Stevebe
Pro
Posts: 258
Joined: 08 Feb 2019, 12:28

Re: Module programming via CAN

Post by Stevebe »

DGAlexandru wrote: 18 Aug 2019, 12:25 I prefer to use Rasppery PI and Linux.
You can add a CAN modules to it on SPI interface and you have precompiled can-utils that help you with logging, sending data.
Based on you programming skils you can then choose to use the programming language you want.

You don't need to be a Linux guru, only to be able to follow some tutorials on how to setup Rasspery PI and then how to connect to it by SSH.
It is far faster than an Arduino board :)
That would be something I would like to try, I’m not very good with software, I’m ok with the hardware. Have you got a link to the info on how to use a RAS PI
Digimod
DGAlexandru
Pro
Posts: 364
Joined: 04 Aug 2019, 22:47

Re: Module programming via CAN

Post by DGAlexandru »

If you think you will need 2 HDMI outputs, then go with latest version of RaspBerry PI 4 B, if only one HDMI output is enough, then go with RaspBerry PI 3 B+, which is not so hungry in terms of power and cooling (v4 might need some cooling - at least a radiator if not a fan too).
If you don't need a LAN port - can work only with WiFi, then you can also take into consideration RaspBerry PI Zero W

Tutorial on how to install Linux on it, the official version: https://projects.raspberrypi.org/en/pro ... setting-up
Tutorial on how to install can-utils and configure the interface: https://www.raspberrypi.org/forums/view ... 4&t=141052

If you have some Linux skils and don't want to have all the software installed if you don't need it, then you can do with a stripped-down version of the official Linux image: https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9

Things you should buy to have a working RaspBerry PI environment:
  1. RaspBerry Pi 3 B+ or 4 B 1GB RAM - 35EUR .. or PI Zero W 512MB RAM - 11EUR or 15EUR with pins already soldered to it
  2. Power Supply for it - V4 needs a different PS, 3Amps 5.1V USB-C connector - 9EUR
    V2/3 and Zero W versions can use the same one, 2.5A, Micro USB - 8EUR
  3. Mini SD card - your choice, at least 8GB
  4. Maybe a case for RaspBerry PI - again, V4 needs a different one versus V2 or V3 - starting from 5EUR
    You can also buy a kit that has 1+2+3 and maybe 4.
  5. HDMI cable if you want video output - for this CAN Bus project it is not needed, maybe only for the setup part, but this can also be configured when you create the SD on your Windows / Linux / Mac PC. R PI V4 needs a micro HDMI cable.
  6. a USB keyboard and maybe a mouse if you want to use R PI as a mini-computer with Graphical Interface
Things you should buy to have CAN Bus added to RaspBerry PI:
  1. MonkeyJack MCP2515 Module CAN Bus - this is the cheapest one, but for RaspBerry PI it needs a hardware mod - it is described in the can-utils tutorial - 5EUR link You will also need some wires and knoledge on how to connect it to your R PI - also described in the above tutorial.
  2. PiCAN2 Duo CAN-Bus Board for Raspberry Pi 2/3 - it has 2 independent CAN BUS interfaces, it also works with V4 but you need to be carefull with the airflow in order not to overheat R PI's CPU (you can use an adapter to have this shield further from the R PI's board) - very easy to install, just plug it directly on the pins of R PI but it is more expensive and it is harder to add other things to R PI as you need to modify it to have access to unused pins. - 60EUR
I did my own CAN BUS "shield" design which is based on this PiCAN2 Duo, I also added a 60OHM resistor as an option with jumpers for the CAN BUS - you might get in the situation that you want to have on CAN BUS only one device and this device doesn't have a 120OHM resistor so you should add one on the wires. My "hack" of using only one resistor of 60OHM is not according to the CAN BUS specification, but for a testing scenario and short wires it is OK.
I also bought a DC-DC variable voltage regulator of 5Amps that allow me to power everything from +12V - look for "XL4015" - something like this: https://robu.in/product/xl4015-5a-dc-dc ... -heatsink/ or https://protosupplies.com/product/xl401 ... wn-module/ that also have a display

I connect to my R PI only by SSH (like Telnet .. Comand Line Interface) and run the needed comands in order to do what I want. I use can-utils in scripts done in Perl or Python and even Bash. I have also build a webpage on R PI with Node.JS that allows me to send and receive CAN data over a Browser.

If you have any question, please be free to ask and I'll try to answer :)
User avatar
Stevebe
Pro
Posts: 258
Joined: 08 Feb 2019, 12:28

Re: Module programming via CAN

Post by Stevebe »

thank you for all the info, i do have several P.s I zero, 2, 3, and a 4, im ok using Linux to a point .. i had been doing a lot of work with Lora Wan'
ill have a go and see how i get on with the PI. thank you
Digimod
Post Reply