[Ovmsdev] Twizy / 500 kbps CAN lockups

Mark Webb-Johnson mark at webb-johnson.net
Fri Nov 9 22:17:23 HKT 2012


Michael,

I'll try to integrate over the weekend, and let you know.

Regards, Mark.

On 9 Nov, 2012, at 8:56 PM, Michael Balzer <dexter at expeedo.de> wrote:

> Hi Michael + Mark,
> 
> solved it, and found something that might be useful for other cars as well:
> 
> I played around with some more timing schemes, but the lockups remained. Just for the record, my current scheme follows the CAN open scheme as described here:
> http://www.softing.com/home/en/industrial-automation/products/can-bus/more-can-open/timing/bit-timing-specification.php
> I mention that because the timing is quite different from that used by the Tesla and Volt modules, not sure about CAN open on those cars though.
> 
> The lockups had nothing to do with the timing at all, they were buffer overflows. The PIC manual says the RXBnOVFL bits in the COMSTAT register must be cleared by the MCU. Those bits alone were half way, clearing also the interrupt and buffer full flags finally did the job. I integrated this check + fix into ticker1(), that should be sufficient.
> 
> I think my interrupt handler is smaller and faster than the others, so I don't know why this has been no issue on other cars yet. Maybe the Twizy sends much more messages? Anyway, this info might at least be valuable for other cars to come.
> 
> The solution is part of my new commit:
> https://github.com/dexterbg/Open-Vehicle-Monitoring-System/commit/bfdbd6ee67b9432ba055dd50d3d91c8a67b17242
> ...can_twizy lines 568+.
> 
> The commit also includes major optimizations and extensions for the Twizy module.
> 
> Regards,
> Michael
> 
> 
> Am 03.11.2012 10:11, schrieb Mark Webb-Johnson:
>> Looking at the Microchip AN for this, and online calculators, this looks very complex.
>> 
>> The current numbers we use originally came from Michael Stegen. Not sure how he calculated them.
>> 
>> Michael J got it working in his 500kbps Volt/Ampera using BRGCON1=0x01 - so same settings as 1Mhz, but with a x2 prescaler. That seems a good solution and the approach should work also for 256kbps, 128kbps, etc.
>> 
>> You say that the CAN reception stops, and starts again by switching the car off+on. Does that also reset the OVMS module? Another possibility is that the Twizy go to sleep and stops transmitting on the can bus?
>> 
>> Regards, Mark.
>> 
>> On 3 Nov, 2012, at 3:54 AM, Michael Balzer <dexter at expeedo.de> wrote:
>> 
>>> During my tests I had two times some sort of a CAN lockup, i.e. everything worked except the CAN reception -- was fixed by switching the car off + on.
>>> 
>>> I'm not sure yet what caused that, it (of course) did not happen again since I included a first debug output of the RXERRCNT...
>>> 
>>> I saw the 1 mbps setup does not follow the intrepid timing calculator standard parameters but increases prop delay from 1 to 3 and decreases phase 1 from 5 to 3.
>>> 
>>> A similar change to the 500 kbps parameters though did not work with the Twizy.
>>> 
>>> Do you have any hints on debugging this?
>>> 
>>> My current setup for 500 kbps is:
>>> 
>>>    // 500 kbps -- tool recommendation + multisampling:
>>>    BRGCON1 = 0x00;
>>>    BRGCON2 = 0xFA;
>>>    BRGCON3 = 0x07;
>>> 
>>> Thanks,
>>> Michael
>>> 
>>> -- 
>>> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
>>> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
>>> 
>>> <dexter.vcf>_______________________________________________
>>> OvmsDev mailing list
>>> OvmsDev at lists.teslaclub.hk
>>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>> _______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.teslaclub.hk
>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
> 
> -- 
> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
> 
> <dexter.vcf>_______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev



More information about the OvmsDev mailing list