I am using a vendor-provided DHCP library to implement DHCP on the W5500 chip, but I am afraid the library might be incorrectly synchronized. The library uses a volatile counter to detect timeouts, and assumes two thread: one that resets the counter and checks if it has expired, and another that increments it. Here is the declaration:
volatile uint32_t dhcp_tick_1s = 0; // unit 1 second
And here is the counter being used:
/* Reset the DHCP timeout count and retry count. */ void reset_DHCP_timeout(void) { dhcp_tick_1s = 0; dhcp_tick_next = DHCP_WAIT_TIME; dhcp_retry_count = 0; } void DHCP_time_handler(void) { dhcp_tick_1s++; }