How to cleanly shutdown WINC1500 during m2m_wifi_connect()

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using ASF4 to drive a WINC1500 in STA mode.

 

I have code that times out if the call to m2m_wifi_connect() doesn't return soon enough (i.e. the AP hasn't responded).  At that point, I try to shut down the WINC even though it's still waiting for the AP to respond.  I've tried a bunch of things to shut down the transaction cleanly, including things like:

  m2m_wifi_deinit(NULL);
  nm_bsp_init();

... but I end up with a bunch of errors of the form:

 

(APP)(ERR)[spi_data_read][747][nmi spi]: Failed data response read...(20)
(APP)(ERR)[spi_read_reg][1018][nmi spi]: Failed data read...
(APP)(ERR)[spi_read_reg][1038]Reset and retry 10 1400

...

(APP)(ERR)[chip_deinit[523]failed to de-initialize

(APP)(ERR)[nm_drv_deinit][356][nmi stop]: chip_deinit fail

 

What's the approved way to shut down the WINC1500 from inside a call to m2m_wifi_connect()?

Last Edited: Thu. Feb 4, 2021 - 11:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to clarify, m2m_wifi_connect() should return pretty quickly. It simply posts the connection details to the WINC1500 firmware. You then need to wait for an interrupt and callback with the M2M_WIFI_RESP_CON_STATE_CHANGED event.

 

As far as I'm aware, there's no API to cancel the m2m_wifi_connect() if the callback doesn't happen within a reasonable time.

 

On possible work-around would be to continue to invoke m2m_wifi_deinit(), ignoring any errors, then reset the WINC1500 module using its reset and chip-enable pins before reinitialising the driver and SDK. Though I suspect you may run into further issues where the SDK hasn't fully cleaned up its internal state - such is the mess that is its implementation - when you try to bring it back up again.

 

Steve

Maverick Embedded Technologies Ltd. Home of Maven and wAVR.

Maven: WiFi ARM Cortex-M Debugger/Programmer

wAVR: WiFi AVR ISP/PDI/uPDI Programmer

https://www.maverick-embedded.co...