error frame on TWAI initialization

Cedric
Posts: 1
Joined: Mon Nov 20, 2023 11:27 am

error frame on TWAI initialization

Postby Cedric » Mon Nov 20, 2023 1:58 pm

Hello,

I use the twai and can successfully write and receive frames. However, when I reset the esp23 I see error frames showing up. It seems that the esp_tx pin send a negative pulse on initialization which result in an error on the bus. How can I prevent this? You can see what happens on the screenshots I added.

This is the code I use to initialize the twai.
  1.     // Initialize configuration structures using macro initializers
  2.     twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT( CAN_TX,CAN_RX, TWAI_MODE_NORMAL);
  3.     g_config.tx_queue_len          = 10;
  4.     twai_timing_config_t t_config  = TWAI_TIMING_CONFIG_100KBITS();
  5.     twai_filter_config_t f_config  = TWAI_FILTER_CONFIG_ACCEPT_ALL();
  6.  
  7.     // Install TWAI driver
  8.     // negative pulse occures in next function
  9.     if (twai_driver_install(&g_config, &t_config, &f_config) == ESP_OK) {
  10.         printf("Driver installed\n");
  11.     } else {
  12.         printf("Failed to install driver\n");
  13.         return;
  14.     }
  15.  
  16.     // Start TWAI driver
  17.     if (twai_start() == ESP_OK) {
  18.         printf("Driver started\n");
  19.     } else {
  20.         printf("Failed to start driver\n");
  21.         return;
  22.     }
Board: ESP32-S3-DevKitC-1 v1.0
ESP-IDF: platform-espressif32 6.4.0
CAN transceiver: SN65HVD232DR
esp_twai_tx_pin: GPIO_NUM_11
esp_twai_rx_pin: GPIO_NUM_12
Attachments
logic analyzer GPIO.png
logic analyzer GPIO.png (283.24 KiB) Viewed 864 times
savvy can error messages.png
savvy can error messages.png (363.6 KiB) Viewed 864 times

Who is online

Users browsing this forum: No registered users and 119 guests