在使用esp-idf-v4.4的库及esp32-c3-s32模组的情况下,遇到twai功能的两个GPIO2/GPIO3无数据波形的情况,有朋友遇到过吗?如何解决
void app_main(void)
{
twai_message_t message;
esp_err_t err;
//Initialize configuration structures using macro initializers
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(TX_GPIO_NUM, RX_GPIO_NUM, TWAI_MODE_NORMAL);
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_500KBITS();
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
//Install TWAI driver
if (twai_driver_install(&g_config, &t_config, &f_config) == ESP_OK)
{
ESP_LOGI(EXAMPLE_TAG, "Driver installed\n");
}
else
{
ESP_LOGI(EXAMPLE_TAG, "Failed to install driver\n");
return;
}
//Start TWAI driver
if (twai_start() == ESP_OK)
{
ESP_LOGI(EXAMPLE_TAG, "Driver started\n");
}
else
{
ESP_LOGI(EXAMPLE_TAG, "Failed to start driver\n");
return;
}
message.identifier = 0xAAAA;
message.extd = 1;
message.data_length_code = 8;
for (int i = 0; i < 8; i++)
{
message.data = 0x0A;
}
while(1)
{
//Queue message for transmission
err = twai_transmit(&message, portMAX_DELAY);
if (err == ESP_OK)
{
ESP_LOGI(EXAMPLE_TAG,"Message queued for transmission\n");
}
else
{
ESP_LOGI(EXAMPLE_TAG,"Failed to queue message for transmission\n");
twai_clear_transmit_queue();
}
vTaskDelay(pdMS_TO_TICKS(10000));
}
vTaskDelete(NULL);
}
ESP32-C3-S32使用TWAI的问题
-
- Posts: 3
- Joined: Wed Feb 23, 2022 8:05 am
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 77 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.