Skip to content

Commit

Permalink
allow for wifi init timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Jan 22, 2025
1 parent 9d28b96 commit fb2becc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions firmware/ext/atwinc1500/driver/source/nmasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ sint8 chip_apply_conf(uint32 u32Conf)
val32 |= rHAVE_XO_XTALGM2_DIS_BIT;
#endif

int timeoutCounter = 50;

val32 |= rHAVE_RESERVED1_BIT;
do {
nm_write_reg(rNMI_GP_REG_1, val32);
Expand All @@ -91,6 +93,14 @@ sint8 chip_apply_conf(uint32 u32Conf)
if(reg == val32)
break;
}

timeoutCounter--;
if (timeoutCounter == 0) {
return M2M_ERR_TIME_OUT;
}

// Not timed out yet, try again, but let other thread have a chance
nm_bsp_sleep(10);
} else {
break;
}
Expand Down

0 comments on commit fb2becc

Please sign in to comment.