Question
HAL_UART Transmit/Receive dont work when not using a fixed size as parameter?
in my program is receive first data that tells me what's the size of the payload i am getting next through UART ,When i use that variable as parameter in the UART functions it doesnt work ,however when i hard code a value say HAL_Uart_Receive(&huart1,buffer,5,...) it does indeed work.
Here is my code
#define Max_Buffer_Size 16384UL
uint8_t buffer[Max_Buffer_Size];
HAL_UART_Receive(&huart1,buffer,1,HAL_MAX_DELAY);
int payload_length =buffer[0];
HAL_UART_Receive(&huart1,buffer,payload_length,HAL_MAX_DELAY);as i said if replace line 6 with this is it works :
HAL_UART_Receive(&huart1,buffer,5,HAL_MAX_DELAY);Thank you for your help.
