PSRAM Free heap memory reduced upon using UART with RTS,CTS Pins set
Posted: Thu Mar 14, 2019 10:39 am
Hi,
I am using esp 32 wrover for my project. I have enabled PSRAM to make use of external RAM and set the memory to be automatically allocated as part of the malloc() function call (the default option).
When I initialized my code without UART I used to have the complete free memory which is more than 4 MB (Internal RAM + PSRAM). But, the moment I enable UART initialization, the free memory gradually drops to around 30 KB or less which is clearly only Internal memory.
With below initialization, the free memory of PSRAM is gone.
As at trail and error, when I set the PINs as below, free memory is intact.
Can someone please explain the reason? I am guessing one of the reason could be usage of DMA internally for UART which is restricting usage of external memory. But, I don't understand why this would happen when HW_FLOWCTRL is clearly disabled.
I am using esp 32 wrover for my project. I have enabled PSRAM to make use of external RAM and set the memory to be automatically allocated as part of the malloc() function call (the default option).
When I initialized my code without UART I used to have the complete free memory which is more than 4 MB (Internal RAM + PSRAM). But, the moment I enable UART initialization, the free memory gradually drops to around 30 KB or less which is clearly only Internal memory.
With below initialization, the free memory of PSRAM is gone.
Code: Select all
#define TXD (18)
#define RXD (19)
#define RTS (17)
#define CTS (5)
uart_config_t uart_config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 122,
};
uart_param_config(EX_UART_NUM, &uart_config);
uart_set_pin(EX_UART_NUM, TXD, RXD, RTS, CTS);
Code: Select all
uart_set_pin(EX_UART_NUM, TXD, RXD, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);