Twizy / 500 kbps CAN lockups
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
Hi Michael, nice to see you here. The Volt/Ampera has 500 kbps too. i only change this: // BRGCON1 = 0; // SET BAUDRATE to 1 Mbps BRGCON1 = 0x01; // SET BAUDRATE to 500 Kbps BRGCON2 = 0xD2; BRGCON3 = 0x02; And it works. I think i must recalculate, but it works. ;-) Mark check the Logs from my car and it looks good. Bye Michael PS: Bin aus Kaiserslautern. Warst du am Samstag in Wuppertal? Am 02.11.2012 um 20:54 schrieb Michael Balzer <dexter@expeedo.de>:
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@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Michael, Mark, thanks for your welcomes and quick advice :) I now went back to the prescaled timing -- I tried this in the first place, it did not work, now it does... maybe I had another problem back then. I don't know yet if that fixes the lockups, they did not occur again. I'll take that as a good sign. Regards, Michael PS: @Michael: na klar war ich da, bin doch einer von den 100 "Helden" ;) Aber war vor allem wegen der vielen zugereisten Tesla, Ampera uvm toll. For you other guys: we're talking about this event: http://emobil.wuppertal-aktiv.de/home/ PPS: @Mark: at least it's no "Bruce" pattern... ;) Am 03.11.2012 00:30, schrieb mikeljo@me.com:
Hi Michael,
nice to see you here.
The Volt/Ampera has 500 kbps too.
i only change this: // BRGCON1 = 0; // SET BAUDRATE to 1 Mbps BRGCON1 = 0x01; // SET BAUDRATE to 500 Kbps BRGCON2 = 0xD2; BRGCON3 = 0x02;
And it works. I think i must recalculate, but it works. ;-) Mark check the Logs from my car and it looks good.
Bye Michael
PS: Bin aus Kaiserslautern. Warst du am Samstag in Wuppertal?
Am 02.11.2012 um 20:54 schrieb Michael Balzer <dexter@expeedo.de>:
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@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
OvmsDev mailing list OvmsDev@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
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@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@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
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-c... 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/bfdbd6ee67... ...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@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@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
OvmsDev mailing list OvmsDev@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
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@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-c... 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/bfdbd6ee67... ...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@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@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
OvmsDev mailing list OvmsDev@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@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
participants (3)
-
Mark Webb-Johnson -
Michael Balzer -
mikeljo@me.com