Page 1 of 1

Can driver stop transmitting after a while in release

Posted: Thu Mar 07, 2019 7:37 pm
by snahmad75
Hi,

Can driver on ESP32 from master branch stop transmitting after running for few minutes. Rx CAN driver still gets triggered and working.

In Debug build. It works. any idea?

Re: Can driver stop transmitting after a while in release

Posted: Fri Mar 08, 2019 7:03 am
by ESP_Dazz
Can you try the following:
  • Have a task periodically call can_get_status_info() and print the values of can_status_info_t before and after the CAN driver stops transmitting.
  • When initializing your CAN driver, enable the alerts that indicate some form of error (e.g. CAN_ALERT_ERR_PASS). The various alerts that occur better indicate what's going on with the CAN controller.

Re: Can driver stop transmitting after a while in release

Posted: Fri Mar 08, 2019 2:00 pm
by snahmad75
ESP_Dazz wrote:
Fri Mar 08, 2019 7:03 am
Can you try the following:
  • Have a task periodically call can_get_status_info() and print the values of can_status_info_t before and after the CAN driver stops transmitting.
  • When initializing your CAN driver, enable the alerts that indicate some form of error (e.g. CAN_ALERT_ERR_PASS). The various alerts that occur better indicate what's going on with the CAN controller.
ok, thanks. we are investigating. we will try out your suggestion as well.

Re: Can driver stop transmitting after a while in release

Posted: Wed Mar 13, 2019 9:21 am
by snahmad75
Should I use

CONFIG_FREERTOS_CORETIMER_0=y

or

CONFIG_FREERTOS_CORETIMER_1=

for Can driver.

Re: Can driver stop transmitting after a while in release

Posted: Thu Mar 14, 2019 6:49 am
by ESP_Dazz
Not entirely sure how this relates to CAN driver. CONFIG_FREERTOS_CORETIMER selects which timer to use to generate the tick interrupt for FreeRTOS, thus affects the entire operating system not just the CAN driver. I would recommend you use FREERTOS_CORETIMER_0 as tick interrupts should be of the lowest priority. This will allow other interrupts of higher priority (such as various driver interrupts) to be handled first.

Re: Can driver stop transmitting after a while in release

Posted: Thu Mar 14, 2019 12:44 pm
by snahmad75
ESP_Dazz wrote:
Thu Mar 14, 2019 6:49 am
Not entirely sure how this relates to CAN driver. CONFIG_FREERTOS_CORETIMER selects which timer to use to generate the tick interrupt for FreeRTOS, thus affects the entire operating system not just the CAN driver. I would recommend you use FREERTOS_CORETIMER_0 as tick interrupts should be of the lowest priority. This will allow other interrupts of higher priority (such as various driver interrupts) to be handled first.
Thanks for reply.
Yes not related. Sorry misunderstanding. I found later.
OK, Sys Tick of FreeRTOS as low prioirty make sense. as we are using Can driver Interrupt.


Just a though. how do we write in custom interrupt handler. Any example code.
I need interrupt handler to keep checking brownout using GPIO pin level checking. ESP32 brown detection is too late for our use case.

Re: Can driver stop transmitting after a while in release

Posted: Fri Mar 15, 2019 6:46 am
by ESP_Dazz
snahmad75 wrote: Just a though. how do we write in custom interrupt handler. Any example code.
I need interrupt handler to keep checking brownout using GPIO pin level checking. ESP32 brown detection is too late for our use case.
To allocate a GPIO interrupt, have a look at the GPIO example or the interrupt allocation API reference.

How are you planning to detect brownout using GPIO? Are you planning to use an external brownout detector?

Re: Can driver stop transmitting after a while in release

Posted: Tue Dec 10, 2019 10:22 am
by PeterR
This is an old post but in case it helps..
CAN will stop transmitting if it detects a bus error and goes into bus off state.
Common reasons are loose cables and/or that you place two of your own devices on the CAN bus and have forgotten to change the source address.
To recover you must close and reopen the device. I found that this was quite a lengthy process on the ESP.