I am trying to control an Elcon battery charger (http://www.elconchargers.com/catalog/item/7344653/7638003.htm ) which outputs a DC voltage and current and can be set through a CANBus adapter.
I have interfaced this adapter with Raspberry Pi using a PiCAN2 (http://skpang.co.uk/catalog/pican2-canbus-board-for-raspberry-pi-2-with-smps-p-1476.html), and then made configurations on the RPi required for it to function.
This has enabled me to read the data coming from the charger's CANBus adapter as it continuously emits its status and I use
to read the data and I get the output as:
can0 18FF50E5  00 1F 00 00 10 00 00 00
which is the bus (can0), the id (18FF50E5), the number of bytes (), next two bytes (001F) represent voltage, next two (0000) represent current, and next four bytes are there internal settings.
But I am not able to update these values. The charger expects a CAN frame every second for it to set the voltage and current. I have tried using
and a C program (http://skpang.co.uk/blog/archives/1199) but I get no response.
The way I use
cansend can0 1806E5F4#0128001E00000000
where 1806E5F4 is the device ID and content following # is the data including voltage and current.
The charger is fairly new and I doubt that it has problems. My current configuration settings are as under:
> cat /proc/net/can/version rev 20120528 abi 9 > ip -s -d link show can0 3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10 link/can promiscuity 0 can state ERROR-ACTIVE restart-ms 0 bitrate 250000 sample-point 0.875 tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1 mcp251x: tseg1 3..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1 clock 8000000 re-started bus-errors arbit-lost error-warn error-pass bus-off 0 0 0 0 0 0 RX: bytes packets errors dropped overrun mcast 1295108022 241508426 44170717 1 44170717 0 TX: bytes packets errors dropped carrier collsns 6424 1853 5 5 0 0