Skip to content

Commit 8ea0118

Browse files
committed
Detect when ATWINC1500-XPRO is not attached during boot
* Allows for configuration of unconfigured ECC devices
1 parent 1f15a3a commit 8ea0118

File tree

3 files changed

+24
-4
lines changed
  • boards
    • samd21/src/ASF/common/components/wifi/winc1500/driver/source
    • samg55/src/ASF/common/components/wifi/winc1500/driver/source
  • src

3 files changed

+24
-4
lines changed

boards/samd21/src/ASF/common/components/wifi/winc1500/driver/source/nmdrv.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ sint8 nm_drv_init(void * arg)
280280
{
281281
sint8 ret = M2M_SUCCESS;
282282
uint8 u8Mode;
283+
uint32 chipid;
283284

284285
if(NULL != arg) {
285286
u8Mode = *((uint8 *)arg);
@@ -315,7 +316,15 @@ sint8 nm_drv_init(void * arg)
315316
goto ERR2;
316317
}
317318
#endif
318-
M2M_INFO("Chip ID %lx\n", nmi_get_chipid());
319+
/* Check to see if the device is attached */
320+
chipid = nmi_get_chipid();
321+
if (0x1503a0 != chipid)
322+
{
323+
ret = M2M_ERR_TIME_OUT;
324+
goto ERR2;
325+
}
326+
327+
M2M_INFO("Chip ID %lx\n", chipid);
319328
#ifdef CONF_WINC_USE_SPI
320329
/* Must do this after global reset to set SPI data packet size. */
321330
nm_spi_init();

boards/samg55/src/ASF/common/components/wifi/winc1500/driver/source/nmdrv.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ sint8 nm_drv_init(void * arg)
280280
{
281281
sint8 ret = M2M_SUCCESS;
282282
uint8 u8Mode;
283+
uint32 chipid;
283284

284285
if(NULL != arg) {
285286
u8Mode = *((uint8 *)arg);
@@ -315,7 +316,16 @@ sint8 nm_drv_init(void * arg)
315316
goto ERR2;
316317
}
317318
#endif
318-
M2M_INFO("Chip ID %lx\n", nmi_get_chipid());
319+
320+
/* Check to see if the device is attached */
321+
chipid = nmi_get_chipid();
322+
if (0x1503a0 != chipid)
323+
{
324+
ret = M2M_ERR_TIME_OUT;
325+
goto ERR2;
326+
}
327+
328+
M2M_INFO("Chip ID %lx\n", chipid);
319329
#ifdef CONF_WINC_USE_SPI
320330
/* Must do this after global reset to set SPI data packet size. */
321331
nm_spi_init();

src/wifi_task.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ static void wifi_state_init(void * ctx)
355355
tstrWifiInitParam wifi_paramaters;
356356

357357
/* Wait until the device has been "provisioned" or is configured to run */
358-
if(!config_ready())
358+
if(!config_ready() || !wifi_counter_finished())
359359
{
360360
return;
361361
}
@@ -370,7 +370,8 @@ static void wifi_state_init(void * ctx)
370370
/* Initialize the WINC1500 WIFI module */
371371
if(M2M_SUCCESS != m2m_wifi_init(&wifi_paramaters))
372372
{
373-
WIFI_PRINTF("m2m_wifi_init failed\n");
373+
WIFI_PRINTF("m2m_wifi_init failed\r\n");
374+
wifi_counter_set(WIFI_COUNTER_CONNECT_WAIT);
374375
return;
375376
}
376377

0 commit comments

Comments
 (0)