Skip to content

Commit 7bca1fe

Browse files
committed
Merge branch 'fix/twai_psram' into 'master'
test(twai): with malloc comes from PSRAM by default Closes IDF-13045 See merge request espressif/esp-idf!39246
2 parents abd5be5 + 3d842bc commit 7bca1fe

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

components/esp_driver_twai/esp_twai_onchip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ esp_err_t twai_new_node_onchip(const twai_onchip_node_config_t *node_config, twa
579579
ESP_RETURN_ON_FALSE(node_config->tx_queue_depth > 0, ESP_ERR_INVALID_ARG, TAG, "tx_queue_depth at least 1");
580580
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");
581581

582-
// Allocate TWAI node object memory
583-
twai_onchip_ctx_t *node = heap_caps_calloc(1, sizeof(twai_onchip_ctx_t) + twai_hal_get_mem_requirment(), TWAI_MALLOC_CAPS);
582+
// Allocate TWAI node from internal memory because it contains atomic variable
583+
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);
584584
ESP_RETURN_ON_FALSE(node, ESP_ERR_NO_MEM, TAG, "No mem");
585585
node->ctrlr_id = -1;
586586
// Acquire controller

components/esp_driver_twai/test_apps/test_twai/main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ endif()
1010

1111
idf_component_register(
1212
SRCS ${srcs}
13-
PRIV_REQUIRES esp_driver_twai esp_timer esp_driver_uart
13+
PRIV_REQUIRES esp_driver_twai esp_timer esp_driver_uart esp_psram
1414
WHOLE_ARCHIVE
1515
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_SPIRAM=y
2+
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0

0 commit comments

Comments
 (0)