CANopenNode / CANopenDemo

CANopenNode tutorial and testing
Apache License 2.0
42 stars 30 forks source link

Provide an example working with two CAN interfaces #1

Open Voldemaar84 opened 3 years ago

Voldemaar84 commented 3 years ago

Hello. Could you provide an example of code working with two CAN IFs ? I have Linux x86-64 PC with PCIe dual CAN card. Interfaces are can0 and can1. I have two ODs (OD1.c, OD1.h, OD2.c, OD2.h) OPT += -DCO_MULTIPLE_OD in Makefile. What to do next? Example code in "demo" directory cannot be compiled with 'OPT += -DCO_MULTIPLE_OD'

BR

CANopenNode commented 3 years ago

It is advanced topic. You can make own main.c or even own CANopen.c file, etc.

Basic example with CO_MULTIPLE_OD enabled (but still one OD) was recently added. See: https://github.com/CANopenNode/CANopenNode/blob/84487ef6ce6a62d997a1b31362404cfbff23439d/example/main_blank.c#L87 https://github.com/CANopenNode/CANopenLinux/blob/b4c6ba0e132862b5280056d8f9d07db68c9cf5d5/CO_main_basic.c#L440