ESP-IDF CAN driver with Arduino - error transmit as invalid_state
Posted: Tue Apr 21, 2020 9:29 am
Hello,
I am trying to use the IDF CAN driver with the Arduino Framework in Platformio. Everything seems to work fine when receiving CAN frames. However, when I try to transmit a CAN data frame or RTR I get an error in the bus (see below). I made a post in the github for the esp32/arduino but thought that it would be good to have it here too as it is related to ESP-IDF.
I can't find the error in my code or simply I am using the API in the wrong way. It is also hard to debug with JTAG as the driver is already compiled in the Arduino implementation and can't track it Platformio.
Do I need to create a specific task for transmitting? or reset the CAN driver after each transmission?
See the complete code and hardware description here https://github.com/espressif/arduino-esp32/issues/3921
I found these two threads and I can see they implemented it in a similar way as I did. Nevertheless they only show the receiving part.
viewtopic.php?f=19&t=12606&hilit=can+co ... A8+can+bus
https://esp32.com/viewtopic.php?f=19&t=12607
After this the CAN goes BUSS-OFF.
I am trying to use the IDF CAN driver with the Arduino Framework in Platformio. Everything seems to work fine when receiving CAN frames. However, when I try to transmit a CAN data frame or RTR I get an error in the bus (see below). I made a post in the github for the esp32/arduino but thought that it would be good to have it here too as it is related to ESP-IDF.
I can't find the error in my code or simply I am using the API in the wrong way. It is also hard to debug with JTAG as the driver is already compiled in the Arduino implementation and can't track it Platformio.
Do I need to create a specific task for transmitting? or reset the CAN driver after each transmission?
See the complete code and hardware description here https://github.com/espressif/arduino-esp32/issues/3921
I found these two threads and I can see they implemented it in a similar way as I did. Nevertheless they only show the receiving part.
viewtopic.php?f=19&t=12606&hilit=can+co ... A8+can+bus
https://esp32.com/viewtopic.php?f=19&t=12607
Code: Select all
ESP_ERROR_CHECK_WITHOUT_ABORT failed: esp_err_t 0x103 (ESP_ERR_INVALID_STATE) at 0x4008d8df
file: "src/main.cpp" line 122
func: void CAN_transmit_stdData(uint32_t, uint8_t, uint8_t*)
expression: can_transmit(&message, pdMS_TO_TICKS(100))