Can driver stop transmitting after a while in release

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Can driver stop transmitting after a while in release

Postby snahmad75 » Thu Mar 07, 2019 7:37 pm

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?

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: Can driver stop transmitting after a while in release

Postby ESP_Dazz » 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.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Can driver stop transmitting after a while in release

Postby snahmad75 » Fri Mar 08, 2019 2:00 pm

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.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Can driver stop transmitting after a while in release

Postby snahmad75 » Wed Mar 13, 2019 9:21 am

Should I use

CONFIG_FREERTOS_CORETIMER_0=y

or

CONFIG_FREERTOS_CORETIMER_1=

for Can driver.

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: Can driver stop transmitting after a while in release

Postby ESP_Dazz » 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.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: Can driver stop transmitting after a while in release

Postby snahmad75 » Thu Mar 14, 2019 12:44 pm

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.

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: Can driver stop transmitting after a while in release

Postby ESP_Dazz » Fri Mar 15, 2019 6:46 am

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?

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Can driver stop transmitting after a while in release

Postby PeterR » Tue Dec 10, 2019 10:22 am

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.
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: No registered users and 128 guests