[Ovmsdev] Can buses stop after some time

Mark Webb-Johnson mark at webb-johnson.net
Thu May 24 13:39:17 HKT 2018


The fault must be in mcp2515::RxCallback.

Good news is that the way we marshal these interrupts, that callback is in a normal task and can be logged / debugged using normal tools. It is not running in interrupt context.

The usual cause of these sorts of things is the interrupt not being raised, so mcp2515::RxCallback is not called, and locks forever. Perhaps you can try adding a command to inject a spoofed interrupt message (see MCP2515_isr and just use xQueueSend not xQueueSendFromISR), and see if that command can ‘free’ a locked up CAN bus. If so, that is the cause.

Regards, Mark.

> On 24 May 2018, at 1:26 PM, Greg D. <gregd2350 at gmail.com> wrote:
> 
> Hi Mark,
> 
> Ok, did some more poking around, being careful to not wiggle too many things at once.  I can get a reliable lockup by doing the following:
> 
> 1.  power ext12v off
> 2.  obdii ecu stop
> 3.  power ext12v on
> ...wait a few seconds 
> 4.  obdii ecu start can3
> 
> If I restart obdii too soon, all works.  Otherwise, I can repeatedly disable and re-enable 12v to cycle the HUD, and it will never connect.  The ordering of steps 1 and 2 don't seem to matter.  Unfortunately, I don't see anything in the can status that's uniquely different between scenarios where its working and not.  Will need some additional diagnostic logging...
> 
> Now, for fun, I hook the OBDII Dongle to the module, and try the same steps, but instead of turning on the HUD, I try connecting a few times while the OBDII ECU task is not running (simulating the HUD's attempts to connect), then start the ecu, then try to connect.  It connects!  And this is with the Dongle doing its multi-speed scan each time.  So simply having frames come in while we're not watching, or frames coming in at the wrong speed does not cause the hang.  Rather, it might be that we've got a window in the code where incoming traffic colliding with the opening of the CAN driver is nailing the chip in some critical region.  If I hit it just right, I can sometimes cause this collision with the Dongle by stopping the ecu, starting the connect, then restarting the ecu during the connect sequence.  Not always, but sometimes.
> 
> Just a guess...  I need to dust off the chip document and see if there are any interesting bits to look at.
> 
> Greg
> 
> 
> Mark Webb-Johnson wrote:
>> When the client (HUD, whatever) is trying to connect to the ECU, it can try 500K, 250K. Or it can try 250K, 500K. I suspect yours tries the first descending sequence, and hence doesn’t have any issues as it finds the match at 500K first.
>> 
>> Anyway, this MCP2515 can bus lockup is something we have to fix. The fact it is reproducible on obd2ecu is good and helpful for that.
>> 
> 
> _______________________________________________
> 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/20180524/1f04292e/attachment.htm>


More information about the OvmsDev mailing list