[Ovmsdev] Twizy / 500 kbps CAN lockups

Michael Balzer dexter at expeedo.de
Fri Nov 9 20:56:47 HKT 2012

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:
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:
...can_twizy lines 568+.

The commit also includes major optimizations and extensions for the 
Twizy module.


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dexter.vcf
Type: text/x-vcard
Size: 206 bytes
Desc: not available
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20121109/05044a21/attachment-0002.vcf>

More information about the OvmsDev mailing list