2

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 candump to read the data and I get the output as:

can0 18FF50E5 [8] 00 1F 00 00 10 00 00 00

which is the bus (can0), the id (18FF50E5), the number of bytes ([8]), 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 cansend and a C program (http://skpang.co.uk/blog/archives/1199) but I get no response.

The way I use cansend is

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 

1 Answer 1

0

I did a few things that made this work.

First of all, the charger requires the presence of a battery, and not just a battery, but a battery with voltage greater than 6.2V (some kind of Elcon uC setting).

Then, I sent CAN messages continuously, rather than a single test message and it worked. The charger requires atleast five continuous messages before it starts responding.

Here are the working code samples:

In C: https://gist.github.com/chintanp/2251dff8f0a0664fc02f

In NodeJS: https://gist.github.com/chintanp/3c8efb788e1cb80c505d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.