-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAN bus goes to Bus Off after ECU startup. (IDFGH-13672) #14548
Comments
Do you have a Busoff Recovery ? Like this Example ? |
Yes we have BusOff recovery. |
how do you restart ? by a RESET, or by a Software-Triggered Restart ? like
|
or do you switch of and on power ? |
No I reset the device with using reset button on esp-prog. |
|
@HDLA-BG Can you more clear the issue
So you mean esp32s3 restart let other device bus off? or other devices restart let esp32s3 goto bus off? If first one, I know the reason, If 2nd one, please check on other devices |
Hello @wanckl Thank you for your help
Unfortunately some devices have BusOFF DTC(Data trouble code), so when our device is connected to the network, this might lead to DTCs stored on other devices. Schematics here maybe it can help: Please let me know if you need any additional information. |
our ECU
ECU use esp32s3, Simulator use Vector, other ECU no matter what, can use ESP32, can use other CPU
YES !
true !
no
good. please tell, or tell where to send beer, to tell.
|
yes, all explained good now. |
@Dazza0 maybe for you |
I think what's likely happening here is that when the ESP32-S3 resets, the TX pin is driven LOW momentarily. This results in the bus being drive to the DOMINANT state, which is causing error states in the other devices on the bus. An easy way to verify this is just to use a logic analyzer or oscilloscope and observe the TX pin of the ESP32-S3 when a reset occurs. @wanckl Please verify this is the case and run a git bisect |
Yes @Dazza0 's description is the reason, I just discover this recently will fix asap |
@wanckl that is great. I am wondering, how are you going to fix it? |
@HDLA-BG #include "esp_private/gpio.h"
#include "soc/io_mux_reg.h"
static void twai_configure_gpio(int controller_id, gpio_num_t tx, gpio_num_t rx, gpio_num_t clkout, gpio_num_t bus_status)
{
// assert the GPIO number is not a negative number (shift operation on a negative number is undefined)
assert(tx >= 0 && rx >= 0);
//Set RX pin
gpio_func_sel(rx, PIN_FUNC_GPIO);
gpio_set_pull_mode(rx, GPIO_FLOATING);
gpio_input_enable(rx);
esp_rom_gpio_connect_in_signal(rx, twai_controller_periph_signals.controllers[controller_id].rx_sig, false);
//Set TX pin
gpio_func_sel(tx, PIN_FUNC_GPIO);
gpio_set_pull_mode(tx, GPIO_FLOATING);
esp_rom_gpio_connect_out_signal(tx, twai_controller_periph_signals.controllers[controller_id].tx_sig, false, false);
//Configure output clock pin (Optional)
if (clkout >= 0 && clkout < GPIO_NUM_MAX) {
gpio_set_pull_mode(clkout, GPIO_FLOATING);
gpio_func_sel(clkout, PIN_FUNC_GPIO);
esp_rom_gpio_connect_out_signal(clkout, twai_controller_periph_signals.controllers[controller_id].clk_out_sig, false, false);
}
//Configure bus status pin (Optional)
if (bus_status >= 0 && bus_status < GPIO_NUM_MAX) {
gpio_set_pull_mode(bus_status, GPIO_FLOATING);
gpio_func_sel(bus_status, PIN_FUNC_GPIO);
esp_rom_gpio_connect_out_signal(bus_status, twai_controller_periph_signals.controllers[controller_id].bus_off_sig, false, false);
}
} |
IDF version.
esp-idf-v5.0.6
Espressif SoC revision.
ESP32S3
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
PowerShell
Development Kit.
Custom Board
Power Supply used.
External power supply
What is the expected behavior?
After ECU reset CAN BusOFF shall not be triggered.
What is the actual behavior?
After ECU reset CAN goes in BusOFF state. Which causes all other devices to try to recover.
Also it stops running simulations.
Steps to reproduce.
CAN configuration in the project:
We found that in IDF v5.0.4 the issue doesn't exist and first occurs on v5.0.5
Also identified what causes the problem
in twai_configure_gpio()
esp-idf/components/driver/twai/twai.c
Line 296 in 59e1838
if I change like this
if gpio_conf.mode is set to GPIO_MODE_DISABLE, the issue disappears, we still see some error frames due to not acknowledged frames, but the CAN doesn't go to BusOFF.
I don't understand why this change fixes the issue.
Can you give me a hint what could causes it and maybe a workboard, since this code exist even on the master branch.
The text was updated successfully, but these errors were encountered: