diff --git a/components/esp_driver_twai/esp_twai_onchip.c b/components/esp_driver_twai/esp_twai_onchip.c index 517302b4eb..c2676dd403 100644 --- a/components/esp_driver_twai/esp_twai_onchip.c +++ b/components/esp_driver_twai/esp_twai_onchip.c @@ -579,8 +579,8 @@ esp_err_t twai_new_node_onchip(const twai_onchip_node_config_t *node_config, twa ESP_RETURN_ON_FALSE(node_config->tx_queue_depth > 0, ESP_ERR_INVALID_ARG, TAG, "tx_queue_depth at least 1"); ESP_RETURN_ON_FALSE(!node_config->intr_priority || (BIT(node_config->intr_priority) & ESP_INTR_FLAG_LOWMED), ESP_ERR_INVALID_ARG, TAG, "Invalid intr_priority level"); - // Allocate TWAI node object memory - twai_onchip_ctx_t *node = heap_caps_calloc(1, sizeof(twai_onchip_ctx_t) + twai_hal_get_mem_requirment(), TWAI_MALLOC_CAPS); + // Allocate TWAI node from internal memory because it contains atomic variable + twai_onchip_ctx_t *node = heap_caps_calloc(1, sizeof(twai_onchip_ctx_t) + twai_hal_get_mem_requirment(), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); ESP_RETURN_ON_FALSE(node, ESP_ERR_NO_MEM, TAG, "No mem"); node->ctrlr_id = -1; // Acquire controller diff --git a/components/esp_driver_twai/test_apps/test_twai/main/CMakeLists.txt b/components/esp_driver_twai/test_apps/test_twai/main/CMakeLists.txt index 28874f143a..0738e89286 100644 --- a/components/esp_driver_twai/test_apps/test_twai/main/CMakeLists.txt +++ b/components/esp_driver_twai/test_apps/test_twai/main/CMakeLists.txt @@ -10,6 +10,6 @@ endif() idf_component_register( SRCS ${srcs} - PRIV_REQUIRES esp_driver_twai esp_timer esp_driver_uart + PRIV_REQUIRES esp_driver_twai esp_timer esp_driver_uart esp_psram WHOLE_ARCHIVE ) diff --git a/components/esp_driver_twai/test_apps/test_twai/sdkconfig.defaults.esp32c5 b/components/esp_driver_twai/test_apps/test_twai/sdkconfig.defaults.esp32c5 new file mode 100644 index 0000000000..db575808cf --- /dev/null +++ b/components/esp_driver_twai/test_apps/test_twai/sdkconfig.defaults.esp32c5 @@ -0,0 +1,2 @@ +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0