I have a uint8_t rxBuffer[200] = {0};
array.
The buffer receives messages from UART
USART1.Receive(rxBuffer, sizeof(rxBuffer));
I want to receive UART responses in this rxBuffer, parse them and then reuse this array to parse further responses. How do I clear this buffer and reuse it ?
I tried using memset(rxBuffer, 0, sizeof rxBuffer);
but nothing prints on the debug console when i try to print out the buffers contents
What is that i am doing incorrect here ?
I will provide a sudo code to what i am trying to do:
uint8_t rxBuffer[200] = {0};
uint8_t at[] = "AT\r\n";
uint8_t atSetSTA[] = "AT+CWMODE=1\r\n";
DEMO_USART1.Send(at, sizeof(at) - 1);
delay(1000);
DEMO_USART1.Receive(rxBuffer, sizeof(rxBuffer));
print(rxBuffer);
memset(rxBuffer, 0, sizeof rxBuffer)
DEMO_USART1.Send(atSetSTA, sizeof(atSetSTA) - 1);
delay(1000);
DEMO_USART1.Receive(rxBuffer, sizeof(rxBuffer));
print(rxBuffer);
memset(rxBuffer, 0, sizeof rxBuffer)
When i use memset, Nothing prints to the console. When i dont use memset, in this case it will print the previous responses as well.