2025-08-07 1:09 AM
Hello STM32 Community,
I'm developing a cellular IoT device using STM32L4 and facing an architectural challenge regarding IWDG implementation with long cellular communication timeouts. I'd appreciate your expertise and recommendations.
System Overview:
IWDG Configuration:
The Challenge: My low-level AT command function implements timeout-based communication to prevent infinite loops:
int <function_name>(const char *command, const char *expected_response,
/* other params */, int timeout_ms) {
uint32_t start_time = HAL_GetTick();
// Send AT command via UART
while ((HAL_GetTick() - start_time) < timeout_ms) {
if (rx_data_ready_flag) {
// Copy UART response to buffer
// Check for expected response patterns
}
if (strstr(response_buffer, expected_response)) {
// Parse response and return success
break;
}
// Handle error responses, retries, etc.
}
return result;
}
The Problem: Some legitimate cellular operations require timeouts exceeding IWDG maximum:
Currently, IWDG triggers reset during these legitimate operations, causing communication failures.
Questions for the Community:
Current Timeout Examples:
The system works reliably when IWDG is disabled during development, but I need it enabled for production deployment to handle potential firmware hangs, memory corruption, or hardware issues. The device operates in remote locations where manual recovery isn't feasible, making robust watchdog implementation critical. However, cellular connectivity can be unpredictable, and legitimate operations sometimes require extended timeouts.
Any insights, experiences, or architectural recommendations would be greatly appreciated!
Best regards,
NG
2025-08-07 2:18 AM