ATWINC1500 WiFi Breakout firmware

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
drp1
 
Posts: 6
Joined: Wed Mar 15, 2023 11:25 am

ATWINC1500 WiFi Breakout firmware

Post by drp1 »

I have just purchased the breakout board. No issue with it working. I tried the firmware version sketch, with the current yifi101 library (0.16.1)
It reports that the installed firmware is 19.5.2 and latest firmware is 19.6.1.
Obviously the lady ada how to update firmware page at https://learn.adafruit.com/adafruit-atw ... g-firmware is now out of date. I did carefully follow the instructions and ran into a major problem after selecting Tools/ Wifi101 firmware updater:
The Updater response is No supported board connected.
A similar result occurs with Tools/upload ssl root certificates.
My IDE is 2.04 and device is an Arduino mega (not a copy).
Any advice?

User avatar
mikeysklar
 
Posts: 14194
Joined: Mon Aug 01, 2016 8:10 pm

Re: ATWINC1500 WiFi Breakout firmware

Post by mikeysklar »

Can you try your setup with the 1.8.19 legacy IDE? Some things are just not 2.x compatible as of yet.

User avatar
drp1
 
Posts: 6
Joined: Wed Mar 15, 2023 11:25 am

Re: ATWINC1500 WiFi Breakout firmware

Post by drp1 »

I installed IDE 1.8.19 on an arduino-free machine.
Following upload of the firmware updater sketch I get the following response from Tools/Firmware updater:
Connection error
Programmer not responding
Make sure Firmware updater sketch is loaded on the board

All machines are windows 11, fully updated.
The mega pin connections are default.

The board connects to local network using wep and will act as a server.

David

User avatar
mikeysklar
 
Posts: 14194
Joined: Mon Aug 01, 2016 8:10 pm

Re: ATWINC1500 WiFi Breakout firmware

Post by mikeysklar »

David,

Did you modify the WiFi.setPins() values?

https://learn.adafruit.com/adafruit-atw ... g-firmware

I scanned through the issues open/closed for the Arduino FW Updater. I didn't see anything directly related.

User avatar
drp1
 
Posts: 6
Joined: Wed Mar 15, 2023 11:25 am

Re: ATWINC1500 WiFi Breakout firmware

Post by drp1 »

I used the pins specified in the ladyada tutorial and physically connected to match.
"If you are using a WiFi101 or WINC1500 shield, you do not have to add setPins() code"

David

User avatar
mikeysklar
 
Posts: 14194
Joined: Mon Aug 01, 2016 8:10 pm

Re: ATWINC1500 WiFi Breakout firmware

Post by mikeysklar »

I think the wording is confusing. You are using a WINC1500 breakout so you do need to do the setPins adjustment.

There is such thing as a WiFi101 shield you are just using the WiFi101 library.

User avatar
drp1
 
Posts: 6
Joined: Wed Mar 15, 2023 11:25 am

Re: ATWINC1500 WiFi Breakout firmware

Post by drp1 »

This is what I have tried in FirmwareUpdater:
WiFi.setPins(8,7,4,2);
WiFi.setPins(8,7,4);
//WiFi.setPins(8,7,4);
None of these options work.
I have no idea what the 2 in the 1st option is intended to do.
In each case, Tools/ FirmwareUpdater/ Test connection in results in "Programmer not responding"
It is worth mentioning that after these tests, I opened a Serial monitor on the Firmware update sketch:
The following section of code was not printing:

Code: Select all

  nm_bsp_init();
  if (m2m_wifi_download_mode() != M2M_SUCCESS) {
    Serial.println(F("Failed to put the WiFi module in download mode"));
    while (true)
      ;
  }
Output
Output
problem.jpg (197.55 KiB) Viewed 309 times
David

User avatar
drp1
 
Posts: 6
Joined: Wed Mar 15, 2023 11:25 am

Re: ATWINC1500 WiFi Breakout firmware

Post by drp1 »

I now have a working updated unit.
However, no thanks to the system that should be in place!
I am using a mega and windows 11.
First of all, I can not get anything to work with the latest windows IDE. I can get it work with IDE 1.8.19 and a lot of sytem bypass:

1) This post explains that the Arduino restarts after a comport begins. This messes up Tools / Firmware updater
https://stackoverflow.com/questions/614 ... re-updater

2) So you have to install a null modem utility to handle the com port messup:
https://sourceforge.net/projects/com0com/

3) Then configure it:
1st port COM13, 2nd port COM14,
Nothing else needs ticking.
I deleted port pair 1, just to keep things tidy.
Then Apply.

4) Windows does not like the driver signing:
https://sourceforge.net/p/com0com/discu ... /82d2cbeb/
So you need to update the driver via windows update as per the link.

5) Now a small modification to YiFi101 examples FirmWareUpdater:

Note:
a) that I added an optional resistor and led across pins 15(gnd) and 14.
to signal that the setup works.
b) MAX_PAYLOAD_SIZE = 256; // not 1024

Code: Select all

#include <WiFi101.h>
#include <spi_flash/include/spi_flash.h>

typedef struct __attribute__((__packed__)) {
  uint8_t command;
  uint32_t address;
  uint32_t arg1;
  uint16_t payloadLength;

  // payloadLength bytes of data follows...
} UartPacket;

static const int MAX_PAYLOAD_SIZE = 256;        //was 1024! Now 256

#define CMD_READ_FLASH        0x01
#define CMD_WRITE_FLASH       0x02
#define CMD_ERASE_FLASH       0x03
#define CMD_MAX_PAYLOAD_SIZE  0x50
#define CMD_HELLO             0x99

void setup() {
WiFi.setPins(8,7,4);					// Assuming you used default pins!
pinMode(14,OUTPUT); pinMode(15,OUTPUT); digitalWrite(14,HIGH);
nm_bsp_init();
  if (m2m_wifi_download_mode() != M2M_SUCCESS) {
  Serial.println(F("Failed to put the WiFi module in download mode"));
  digitalWrite(14,LOW);
    while (true){;}
  }
Serial.begin(115200);
}

void receivePacket(UartPacket *pkt, uint8_t *payload) {
  // Read command
  uint8_t *p = reinterpret_cast<uint8_t *>(pkt);
  uint16_t l = sizeof(UartPacket);
  while (l > 0) {
    int c = Serial.read();
    if (c == -1)
      continue;
    *p++ = c;
    l--;
  }

  // Convert parameters from network byte order to cpu byte order
  pkt->address = fromNetwork32(pkt->address);
  pkt->arg1 = fromNetwork32(pkt->arg1);
  pkt->payloadLength = fromNetwork16(pkt->payloadLength);

  // Read payload
  l = pkt->payloadLength;
  while (l > 0) {
    int c = Serial.read();
    if (c == -1)
      continue;
    *payload++ = c;
    l--;
  }
}

// Allocated statically so the compiler can tell us
// about the amount of used RAM
static UartPacket pkt;
static uint8_t payload[MAX_PAYLOAD_SIZE];

void loop() {
  receivePacket(&pkt, payload);

  if (pkt.command == CMD_HELLO) {
    if (pkt.address == 0x11223344 && pkt.arg1 == 0x55667788)
      Serial.print("v10000");
  }

  if (pkt.command == CMD_MAX_PAYLOAD_SIZE) {
    uint16_t res = toNetwork16(MAX_PAYLOAD_SIZE);
    Serial.write(reinterpret_cast<uint8_t *>(&res), sizeof(res));
  }

  if (pkt.command == CMD_READ_FLASH) {
    uint32_t address = pkt.address;
    uint32_t len = pkt.arg1;
    if (spi_flash_read(payload, address, len) != M2M_SUCCESS) {
      Serial.println("ER");
    } else {
      Serial.write(payload, len);
      Serial.print("OK");
    }
  }

  if (pkt.command == CMD_WRITE_FLASH) {
    uint32_t address = pkt.address;
    uint32_t len = pkt.payloadLength;
    if (spi_flash_write(payload, address, len) != M2M_SUCCESS) {
      Serial.print("ER");
    } else {
      Serial.print("OK");
    }
  }

  if (pkt.command == CMD_ERASE_FLASH) {
    uint32_t address = pkt.address;
    uint32_t len = pkt.arg1;
    if (spi_flash_erase(address, len) != M2M_SUCCESS) {
      Serial.print("ER");
    } else {
      Serial.print("OK");
    }
  }
}
6) Now you need Python to create a software bridge between the arduino and firmware programmer
Install python
From an elevated command prompt, pip install pyserial
Copy this sketch into the python editor:
The 1st comport must be the arduino port in use!

Code: Select all

import serial
import time

# enabling printout causes problems

with serial.Serial('COM4', 115200, timeout=2) as serUno:
    with serial.Serial('COM13', 115200, timeout=2) as serVirtual:
        time.sleep(2)  # wait for serial ports to initialise
        
        while (True):
        
            # Now read from each and send to the other
            while serVirtual.in_waiting > 0:
                b = serVirtual.read()
                serUno.write(b)  
                #print("PC-U:" + str(b))
            
            while serUno.in_waiting > 0:
                b = serUno.read()
                serVirtual.write(b)
                #print("U-PC:" + str(b))
NB if you un-comment the print statements the firmware upload fails!

7) Make sure any arduino Serial port Monitors are closed.
If you added an led in section 5) it should be on if all is ok
Run the python sketch- if it runs ok without error:

8) In arduino IDE, Tools, ..Firmware Updater.
Assuming the comOcom works and you configured it as per section 3, select port14
Try Test Connection
If ok, breathe a huge sigh of relief and
Select the latest firmware and Update Firmware.

Wouldn't it be nice if we did not have to do this,
Arduino hardware/software developers please note.

David

User avatar
mikeysklar
 
Posts: 14194
Joined: Mon Aug 01, 2016 8:10 pm

Re: ATWINC1500 WiFi Breakout firmware

Post by mikeysklar »

David,

This is an excellent summary about the maximum complexity that has been created to upgrade the ATWINC1500 firmware through the Arduino IDE.

Would you like to open a post with the github repo that manages some of this code? I think you can cut and paste your last post.

https://github.com/arduino/arduino-fwuploader/issues

User avatar
drp1
 
Posts: 6
Joined: Wed Mar 15, 2023 11:25 am

Re: ATWINC1500 WiFi Breakout firmware

Post by drp1 »

I strongly suspect that this is not a one off, individual issue.
There are enough references to the same problem, after a quick internet search, to warrent further and immediate action.
I will not be opening a new issue on the github repositry, as I suspect this is a long term problem.
Should Adafruit feel the need to pursue this and I believe they should, they have my permission to use this post in any way they see fit.

David

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”