[Ovmsdev] Leaf canbus

Mark Webb-Johnson mark at webb-johnson.net
Wed May 7 09:08:47 HKT 2014


Regarding the polling framework, sorry this is very new and there is zero documentation. Implementation is in vehicle.{h,c}.

Have a look at vehicle_obdii.c for an example implementation.

The idea is that vehicle_poll_setpidlist() is used to set the table of PIDs to be polled, vehicle_poll_setstate() is used to set the state, and vehicle_fn_poll0() is used to receive the PID values coming back. The other vehicle_fn_poll1() function can be used for general listen-only can bus messages. The CAN bus rx filters for poll0() should be setup to receive the responses from the polled modules (the example in vehicle_obdii.c illustrates this for standard OBDII responses).

The table of PIDs to be polled is based on the vehicle_pid_t structure. It is stored in ROM and contains the CAN module ID, poll type, PID to be polled, and a sub-array of three poll times (for each of the three states). The states can be used for whatever is required (I suggest something like: 0=vehicle off, 1=charging, 2=driving), and setting a poll time to 0 for that state will disable polling of a particular PID. The poll type is designed to recognise different ways of polling for PID. We currently have listed VEHICLE_POLL_TYPE_OBDIICURRENT normal OBDII over CAN), VEHICLE_POLL_TYPE_OBDIIVEHICLE (for polling things like VIN over OBDII), VEHICLE_POLL_TYPE_OBDIIGROUP (for Nissan Leaf - currently just a stub implementation) and VEHICLE_POLL_TYPE_OBDIIEXTENDED (0x22 as used in Volt/Ampera).

Regards, Mark.

On 7 May, 2014, at 2:39 am, Nigel Jones <nigel at cherrybyte.me.uk> wrote:

> I have the OVMS module running in my car so found an hour tonight to start looking through the source - sorry it's taking a while to catch up, so forgive the newbie questions too......
> One thing I noticed is that I'm getting a 0% state of charge indication, and regular texts saying my battery is low (for testing I setup the sim with unlimited texts.....). I see there was a commit last year which used some of the data from the spreadsheet at 
> https://docs.google.com/spreadsheet/ccc?key=0An7gtcYL2Oy0dGRaSWl6VTV2eXBQMy1ON2xZSzlMUXc#gid=0
> which I found references from the nissan leaf forum discussion at
> http://www.mynissanleaf.com/viewtopic.php?f=44&t=4131&start=340
> If I'm not mistaken the OVMS currently reads the CAR CanBus ? 
> There's an indication in the spreadsheet that CAN message 0x5b3 contains SOC information - but in fact the spreadsheet refers to it as SOH. I have a leafDD and I think this is also known as the Hx figure -- ie it seems to vary with battery age/capacity -- mine for example is down to around 82%, but it is not current state of charge, so I don't think decoding that will help?
> GIDs are what I use in daily driving as they are absolute. The sheet suggests that figure might be retrievable from this message, but then most people would only see a % of 95% for example as life is lost? Is that's what's wanted? I suspect not for the overall SOC figure.
> I can't see much else decoded yet (I was looking for low hanging fruit!) on the CAR canbus - instead most work was done on the EV canbus, including looking at state of charge etc.
> So the question comes how to bridge the data from that bus onto the CAR can. There was reference to this previously on the list at 
> http://lists.teslaclub.hk/pipermail/ovmsdev/2013-October/001712.html
> It would appear the way to get any of the EV can data is to actively request the data. I can see examples of CAN data requests in the tesla module but haven't yet figured how I might for example retrieve CAN msg 0x5bb for example (it's one of the ones to try). I can also see the developers guide p24 which refers to writing on the bus. I'm also wary of the need to be careful in making active requests rather than the easier passive monitoring! Can anyone point me to an example of how I might do this? I'd make that call from the ticker functions? and then handle it in the poll right? 
> Apologies if this is all covered in the nissan leaf forum thread - I have 39 pages to read now...
> Thanks
> Nigel.
> nigel at cherrybyte.me.uk
> -- 
> ----
> Nigel Jones
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20140507/ee1ae43c/attachment.htm>

More information about the OvmsDev mailing list