[Ovmsdev] Fixed VIN from IncomingPollReply first frame data?

Mark Webb-Johnson mark at webb-johnson.net
Sun May 6 11:11:32 HKT 2018


I don’t think many (any?) are using the OBDII code in the real world. It was there mainly as a proof-of-concept, and looks like that part was broken in the polling port from v2 to v3. VIN not coming up correctly (at all) on my ODBII simulator hardware with vehicle module O2.

Not sure about KiaSoulEV.

I applied your patch, and the vehicle module O2 vs simulator hardware now identifies the VIN correctly.

I can’t really apply your whole commit to the master, as it includes other changes (to vehicle_nissanleaf) which is causing conflicts vs @carrott's recent pull request on Nissan Leaf. In general, easier to keep these code code change commits limited to just one commit (for which a pull request can easily be sent):




Anyway, I manually included the fix to vehicle.cpp and committed that to master - you should be able to pull that back into your now. Can you and @carrott work out what is required and re-do the pull request to include both Nissan Leaf changes?

Thanks, Mark.

> On 6 May 2018, at 8:56 AM, Robin O'Leary <ovmsdev at caederus.org> wrote:
> On Tue, May 01, 2018 at 09:59:04PM +0800, Mark Webb-Johnson wrote:
>> Suggestion: Can the model year of the car be determined from the VIN?
>> We do that for a few other of the models.
> So in order to read the Leaf VIN and battery data, I had some fun getting
> to know the ins and outs of ISO-TP and UDS so I could write my own packet
> reassembler.  Of course, it was only when I had it all working nicely that
> it dawned on me that Mark's comment above meant that there was probably
> already code for that somewhere that would have saved me the effort,
> which there is, in OvmsVehicle::PollerReceive and IncomingPollReply.  Duh!
> But when I swapped over to using those methods, I got different
> results---the first byte of the VIN was missing, and IncomingPollReply
> never got called with ml_remain==0 for the much longer battery data.
> So now I was glad that I had my own version for comparison, as it made
> me more sure than I might otherwise have been that PollerReceive was
> processing the first frame incorrectly.  Indeed, I think it is doing
> two things wrong: it starts reading data from byte 5 not byte 4, and it
> gets the overall length wrong by 2 (this confusion is likely because the
> length given in the ISO-TP layer includes the two UDS header bytes, but
> the rest of the UDS processing expects those bytes not to be counted in
> the data passed to IncomingPollReply).  Fixing both of those made both
> the Leaf VIN and battery data come out correctly.  My changes are here:
> https://github.com/caederus-ovms/Open-Vehicle-Monitoring-System-3/tree/leaf-poll
> That leads me to wonder how existing uses of this code haven't run in
> to the same problems.  It is used in at least two places that seem like
> they should have been affected:
> 	OvmsVehicleOBDII::IncomingPollReply
> 		case 0x02:  // VIN (multi-line response)
> 	OvmsVehicleKiaSoulEv::IncomingVMCU
>                case 0x02: // VIN (multi-line response):
> So could it be that the PollerReceive code is correct after all and that
> I am misunderstanding how it works, maybe because there is something
> odd about the Leaf?  Could any developers knowledgable about the OBDII
> interface and the Kia Soul see if my changes make things better or worse?
> Thanks.
> btw, I still don't know the answer to the original question of whether
> the model year of the car can be determined from the VIN, but at least
> we can now easily see what it is!
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev

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

More information about the OvmsDev mailing list