facing issues reading data from the SIM800 module

Good day devs, I tried integrating a SIM800 module with FreeRTOS for a small start up. I plan to use HAL_UART functions with a timeout mechanism for UART communication, but I'm concerned about later on interference with the FreeRTOS scheduler. Please and please I need guidance on implementing the timeout functionality without disrupting the scheduler. I'm facing issues reading data from the SIM800 module. But I've declared a buffer and attempted to print its contents using printf(ReadBuffer), nothing is displayed. How can I correctly read and process the received data? I don't know if I should use TCP/IP to connect the SIM800 module to a server.
// Setting up my UART data reading
HAL_UART_Receive_IT(&huart1, ReadBuffer, sizeof(ReadBuffer));

// Printing my received data
printf("Received Data: %s\n", ReadBuffer);
// Setting up my UART data reading
HAL_UART_Receive_IT(&huart1, ReadBuffer, sizeof(ReadBuffer));

// Printing my received data
printf("Received Data: %s\n", ReadBuffer);
2 Replies
UC GEE
UC GEE7mo ago
I suggest you should Try and use the xTimerCreate function to make a timer with a specific period ,you can use 1000 milliseconds for a 1 second timeout . Later you can now set the timer to call a callback function when timeout happens. Use xTimerStart to start your time . @Sterling
Sterling
Sterling7mo ago
Thanks for the suggestion tho, but I am also thinking about the implementation. What if I set up the xTimer to handle the timeout, but the UART interrupt completes successfully before the timer expires? How should I handle stopping or resetting the timer in that case to avoid unnecessary callbacks or resource usage? @UC GEE @Middleware & OS
Want results from more Discord servers?
Add your server