WINC1500 Connecting to Wifi disconnects immediately with error code 1

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

Hallo

 

I have a phenomena that I don't know to resolve.

With the WINC1500 I can connect to all AP's, but not to a LinkSys WAP300N.
The WAP300N is configured 2.4G Mixed (bgn) with securitye WPA/WPA2 mixed mode.

With the smartphone I can connect to the WAP300N without any warnings or error message.
I remarked one anomaly, when I start the app wifi explorer on the smartphone it reclaims that it has no 2.4G network, but the access points are shown any way.
When I power off the WAP300N this message disappears.

 

I use an Atmel WINC1500 for my project.
The call m2m_wifi_connect(parameters) is disconnected (M2M_WIFI_RESP_CON_STATE_CHANGED) with the error 1 (can not scan)

The connection parameters are the ssid, psk with auth type WPA and CH_ALL.

The hardware and firmware information of the Atmel Modul is.

Chip ID 1503a0
Firmware ver   : 19.5.4 Svnrev 15567
Firmware Build Oct  4 2017 Time 14:59:09
Firmware Min driver ver : 19.3.0
Driver ver: 19.5.4

The problem comes from the LinkSys. I don't know what it is and could not find any information about it.
 

I would appreciate if someone could help me.
1. What may be the base of the problem.
2 A way to get connected after the disconnect. (sane as the smartphone)

 

Many thanks

Benny

This topic has a solution.
Last Edited: Fri. Jul 12, 2019 - 12:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try upgrading your WINC1500 firmware to 19.6.3. One of fixes in 19.6.3 is 

 

Allow 4-way handshake to work when AP sends
EAPOL frames with extra unexpected data.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

Many thanks for the hint.
Maybe but EAP? is not activated on the access point.

 

The last time I updated the Winc1500 was over OTA.

Upgrading is a mess and not transparent.
I didn't look inside it for a while.

 

Do you know a way without Atmel Studio?
I work on linux, setting up a working Atmel Studio is a big work.
The simplest way would be to have a memory map and a description of the content with the binaries.
A memory map is defined in the documentation but I would be surprised if it is still valid (regarding the version mapping of firmware/driver)
The output of the windows tool that packs the binary is nowhere described.

 

Many thanks

Regards

Benny

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bernhard Schmidt wrote:
The call m2m_wifi_connect(parameters) is disconnected (M2M_WIFI_RESP_CON_STATE_CHANGED) with the error 1 (can not scan)

If the WiFi callback event is M2M_WIFI_RESP_CON_STATE_CHANGED and the state is 1, it means WiFi is connected.

 

@brief
	Wi-Fi Connection State.
*/
typedef enum {
	M2M_WIFI_DISCONNECTED = 0,
	/*!< Wi-Fi state is disconnected.
	*/
	M2M_WIFI_CONNECTED,
	/*!< Wi-Fi state is connected.
	*/
	M2M_WIFI_ROAMED,
	/*!< Wi-Fi state is roamed to new AP.
	*/
	M2M_WIFI_UNDEF = 0xff
	/*!< Undefined Wi-Fi State.
	*/
}tenuM2mConnState;

Bernhard Schmidt wrote:

Upgrading is a mess and not transparent.

The OTA upgrade of the WINC15x0 firmware is very easy. The WINC1500 Software Design Guide Chapter 11 describes the whole process. It can be either HTTP or HTTPS (if you provide the server certificate). You'll basically send the download url to the WINC and it would finish the job on its own. 

 

AFAIK, there is no way to upgrade the WINC1500 firmware directly from the host MCU via the SPI interface.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Wifi is not connected. The currState is M2M_WIFI_DISCONNECTED.

 

Are you sure that a never driver returns CONNECTED?

 

For using OTA upgrade, I still need the binary and the windows tools to build the firmware.
The only way I know to get all the tools and binaries is using the Atmel Studio.
If you know another way I would be happy if you can share this knowledge.

 

For updating one device using OTA may work.
But if you have hundreds of modules it is not the preferred way!

 

Many thanks

Benny
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bernhard Schmidt wrote:

The Wifi is not connected. The currState is M2M_WIFI_DISCONNECTED.

 

Are you sure that a never driver returns CONNECTED?

This is an example WiFi callback function from Atmel's AP scan example project

 

/**
* \brief Callback to get the Wi-Fi status update.
*
* \param[in] u8MsgType Type of Wi-Fi notification.
* \param[in] pvMsg A pointer to a buffer containing the notification parameters.
*
* \return None.
*/
static void wifi_cb(uint8_t u8MsgType, void *pvMsg)
{
	switch (u8MsgType) {
		case M2M_WIFI_RESP_CON_STATE_CHANGED:
		{
			tstrM2mWifiStateChanged *pstrWifiState = (tstrM2mWifiStateChanged *)pvMsg;
			if (pstrWifiState->u8CurrState == M2M_WIFI_CONNECTED) 
			{
				#if 1 //!AP_CONNECTION_TOGGLE
					printf("wifi_cb: M2M_WIFI_RESP_CON_STATE_CHANGED: CONNECTED\r\n");
				#endif	
			} 
			else if (pstrWifiState->u8CurrState == M2M_WIFI_DISCONNECTED) 
			{
				printf("wifi_cb: M2M_WIFI_RESP_CON_STATE_CHANGED: DISCONNECTED\r\n");
				printf("Disconnected:%d",pstrWifiState->u8ErrCode);
				wifi_connected = M2M_WIFI_DISCONNECTED;
				/*If we get disconnected we close any socket that is open*/
				if(tcp_client_socket >= 0)
				{
					close(tcp_client_socket);
					tcp_client_socket = -1;
				}
				if(udp_client_socket >= 0)
				{
					close(udp_client_socket);
					udp_client_socket = -1;
				}
				if(udp_server_socket >= 0)
				{
					close(udp_server_socket);
					udp_server_socket = -1;
				}
				tcp_connected = false;
			}
			break;
		}

		case M2M_WIFI_REQ_DHCP_CONF:
		{
			#if AP_CONNECTION_TOGGLE
				port_pin_toggle_output_level(LED0_GPIO);
			#endif //AP_CONNECTION_TOGGLE
			set_state(WIFI_CONNECTION_STATE);
			wifi_connected = M2M_WIFI_CONNECTED;
			uint8_t *pu8IPAddress = (uint8_t *)pvMsg;
			tstrM2MIPConfig *connInfo = (tstrM2MIPConfig*)pvMsg;
			gateway_ip = connInfo->u32Gateway; 
			#if 1 //!AP_CONNECTION_TOGGLE			
				printf("wifi_cb: M2M_WIFI_REQ_DHCP_CONF: IP is %u.%u.%u.%u\r\n",
				pu8IPAddress[0], pu8IPAddress[1], pu8IPAddress[2], pu8IPAddress[3]);
			#endif //AP_CONNECTION_TOGGLE 
			break;
		}
		
		case M2M_WIFI_RESP_PROVISION_INFO:
		{
			tstrM2MProvisionInfo *pstrProvInfo = (tstrM2MProvisionInfo *)pvMsg;

			if (pstrProvInfo->u8Status == M2M_SUCCESS) {
				printf("wifi_cb: Provision Success\r\n");
			} 
			else 
			{
				printf("wifi_cb: Provision failed.\r\n");
			}
		}

		default:
		{
			break;
		}
	}
}

So, yes, when the callback event is M2M_WIFI_RESP_CON_STATE_CHANGED, you can check u8CurrState for M2M_WIFI_CONNECTED or M2M_WIFI_DISCONNECTED. This has always been the case.

 

Bernhard Schmidt wrote:
For using OTA upgrade, I still need the binary and the windows tools to build the firmware.
The only way I know to get all the tools and binaries is using the Atmel Studio.
If you know another way I would be happy if you can share this knowledge.

You get the new WINC1500 firmware, the binary, from ASF. You don't need Atmel Studio. I am not sure what "tools" you are referring to and why you need to "build the firmware".

 

Bernhard Schmidt wrote:
For updating one device using OTA may work.
But if you have hundreds of modules it is not the preferred way!

Why not? You put the new WINC1500 binary in, for example, AWS S3 bucket, then send the URL to WINC1500.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You search on wrong places.
My code is based on the example of Atmel too, and is therefore similar to the one posted.
It worked fine until the reported case with the WAP300N.
     


static void WifiCallback(uint8_t u8MsgType, void *pvMsg)
{
    switch (u8MsgType)
    {
        case M2M_WIFI_RESP_CON_STATE_CHANGED:
        {
           tstrM2mWifiStateChanged *pstrWifiState = (tstrM2mWifiStateChanged *)pvMsg;
           if (pstrWifiState->u8CurrState == M2M_WIFI_CONNECTED)
           {
                 DEBUG_PRINTF("Wi-Fi connected\n");
                 SendWifiEvent(WINC_WifiConnectedEvent);
           }
           else if (pstrWifiState->u8CurrState == M2M_WIFI_DISCONNECTED)
           {
                 DEBUG_PRINTF("Wi-Fi disconnected %i\n", pstrWifiState->u8ErrCode);
                 SendWifiEvent(WINC_WifiDisconnectedEvent);
           }
        }
        break;
        case M2M_WIFI_RESP_GET_SYS_TIME :
        {

         ....


As I worte the driver returns for currState  M2M_WIFI_DISCONNECTED and not M2M_WIFI_CONNECTED.
The problem must be a special case of the protocol that is not fully supported by the Winc.
My aim is to connect to the AP, so the device can be used.

 

The additional tools you need is to replace the default certificates and/or the provisioning web page.

I downloaded the latest ASF library from the Microchip side and examined the changes of the WINC firmware version 19.5.4 and 19.6.1.
The most important changes is regarding enterprise WPA. As I wrote I do not use Enterprise WPA.

Anyway I will update the firmware to see what happens.

 

And sure you can update the firmware over the air, that is a no brainer, but it requires a more complex setup and takes more time.
It is far away from a good method for the roll-out.

 

Thanks

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After upgrading to the latest firmware winc1500 connects to the access point without any problem.

 

My opinion regarding updating the Winc1500.
OTA is a catastrophe, you need a matching driver/firmware for updating the device. Afterwards the driver is no longer compatible!.
The driver is not downward compatible!

 

Alternative procedures are

- Directly over the serial interface.

- With Serial Bridge if the WINC module is integrated in a custom design and you have not enough flash for the firmware.
- With Programmer example if Winc module is integrated in a custom design and you have enough flash. (fastest way without any dependencies)

 

The tools to build the firmware binary are windows tools only.
All people working on linux or mac can not use the tools directly.

Why is the format of the firmware bin not specified?
It is not a great secret, the bin file can be reverse engineered!

With this knowledge everybody could build own tools that match his environment.

 

Thanks
 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bernhard Schmidt wrote:
OTA is a catastrophe, you need a matching driver/firmware for updating the device. Afterwards the driver is no longer compatible!.
The driver is not downward compatible!

The host driver version can't be higher than the WINC firmware version. I am not sure exactly your definition of "matching". One of my projects started out with the host driver 19.3.3 and WINC1500 firmware 19.4.4. The host driver remains the same but the WINC1500 firmware has gone through several OTA updates. It is currently at 19.6.3. If you plan to upgrade the WINC firmware in the field, OTA is only way to go. The serial download protocol itself has never been published.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I got a similar issue.

With the WINC1500 I can connect to all AP's, but not to my house network.
My house network has 2,4G and 5G with the same ssid, security type WPA/WPA2 with the same password.

With the smartphone I can connect to winc and send the credentials via tcp my device (SAMD21 + WINC1500), it saves these credentials but when it tries to connect it goes on a loop almost as if this network doesn't existes or like it's disconnected.

So I also tried to create a hotspot from another mobile, and the winc successfully connect.

I use an Atmel SAMd21 + WINC1500 for my project.

 

It there a way to config winc1500 to choose to go to the 2,4G connection.

 

Thanks.

Last Edited: Wed. Apr 22, 2020 - 03:58 PM