AST-CAN485 Wifi Shield - Can't get it working

I just got a AST-CAN485 Wifi Shield and following the following guide:

https://learn.sparkfun.com/tutorials/as … okup-guide

I choose the “Sparkfun ESP8266 Thing” board and when I upload any program from the examples, it will work once in a while right after the upload, but after a reset it never works.

It’s very inconsistent and I’m not sure what I’m doing wrong.

I’ve tried to upload the following sketch:

https://github.com/Atlantis-Specialist- … al-ESP.ino

This is the upload output:

Executable segment sizes:

ICACHE : 32768 - flash instruction cache

IROM : 236004 - code in flash (default or ICACHE_FLASH_ATTR)

IRAM : 27277 / 32768 - code in IRAM (IRAM_ATTR, ISRs…)

DATA : 1496 ) - initialized variables (global, static) in RAM/HEAP

RODATA : 880 ) / 81920 - constants (global, static) in RAM/HEAP

BSS : 25680 ) - zeroed variables (global, static) in RAM/HEAP

Sketch uses 265657 bytes (56%) of program storage space. Maximum is 466928 bytes.

Global variables use 28056 bytes (34%) of dynamic memory, leaving 53864 bytes for local variables. Maximum is 81920 bytes.

esptool.py v3.0

Serial port COM5

Connecting…

Chip is ESP8266EX

Features: WiFi

Crystal is 26MHz

MAC: 80:7d:3a:3c:dc:64

Uploading stub…

Running stub…

Stub running…

Configuring flash size…

Warning: Could not auto-detect Flash size (FlashID=0x1841f, SizeID=0x1), defaulting to 4MB

Flash params set to 0x0040

Compressed 269808 bytes to 198085…

Writing at 0x00000000… (7 %)

Writing at 0x00004000… (15 %)

Writing at 0x00008000… (23 %)

Writing at 0x0000c000… (30 %)

Writing at 0x00010000… (38 %)

Writing at 0x00014000… (46 %)

Writing at 0x00018000… (53 %)

Writing at 0x0001c000… (61 %)

Writing at 0x00020000… (69 %)

Writing at 0x00024000… (76 %)

Writing at 0x00028000… (84 %)

Writing at 0x0002c000… (92 %)

Writing at 0x00030000… (100 %)

Wrote 269808 bytes (198085 compressed) at 0x00000000 in 17.8 seconds (effective 121.1 kbit/s)…

Hash of data verified.

Leaving…

Soft resetting…

After the upload is done and verified I get garbage in the Serial Monitor and the program doesn’t run most of the time.

Sometimes it will work, but only right after the upload. If I disconnect the FTDI and reconnect it again and try and send any character, I get the following exception:

Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException

at processing.app.Serial.write(Serial.java:254)

at processing.app.Serial.write(Serial.java:274)

at processing.app.SerialMonitor.send(SerialMonitor.java:122)

at processing.app.SerialMonitor.lambda$new$1(SerialMonitor.java:66)

at javax.swing.JTextField.fireActionPerformed(JTextField.java:508)

at javax.swing.JTextField.postActionEvent(JTextField.java:721)

at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:836)

at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1668)

at javax.swing.JComponent.processKeyBinding(JComponent.java:2882)

at javax.swing.JComponent.processKeyBindings(JComponent.java:2929)

at javax.swing.JComponent.processKeyEvent(JComponent.java:2845)

at java.awt.Component.processEvent(Component.java:6316)

at java.awt.Container.processEvent(Container.java:2239)

at java.awt.Component.dispatchEventImpl(Component.java:4889)

at java.awt.Container.dispatchEventImpl(Container.java:2297)

at java.awt.Component.dispatchEvent(Component.java:4711)

at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)

at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:835)

at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1103)

at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:974)

at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:800)

at java.awt.Component.dispatchEventImpl(Component.java:4760)

at java.awt.Container.dispatchEventImpl(Container.java:2297)

at java.awt.Window.dispatchEventImpl(Window.java:2746)

at java.awt.Component.dispatchEvent(Component.java:4711)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)

at java.awt.EventQueue.access$500(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:709)

at java.awt.EventQueue$3.run(EventQueue.java:703)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)

at java.awt.EventQueue$4.run(EventQueue.java:733)

at java.awt.EventQueue$4.run(EventQueue.java:731)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Anyone?

How do I get technical support if not here? I don’t know if it’s hardware related of something I’m doing wrong.

Unfortunately there are no other videos or guides on this product other than the one mentioned above and promotional videos without any technical content, only sales pitches.

Java errors usually indicate some sort of problem with the Arduino IDE. It’s not ideal, but you should try removing the IDE and reinstalling the IDE and boards package. Let us know if you still have issues after trying that.

First thing I did, but still have that issue.

I’m not too worried about that issue, I’m more worried that I can load the code and it works until I reset the device. Doesn’t matter if I hold the ESP button down or not.

OK, we’re sending a replacement WiFi Shield, see if that fixes things when it arrives. :slight_smile:

Awesome, thanks Chris.

I will actually get another one in the mail today. I wanted to see if it was hardware related. I’ll report back here.

So the new Wifi Shield just arrived and I tried it. It behaves like the other one.

Here is what I see when I upload the AdvancedWebServer example:

If I reset the Shield, it doesn’t start the web server again and nothing on the serial output.

Just to be clear on a couple things.

  1. It should only be used with a 3.3V FTDI correct? Not the 5V FTDI?

  2. I use the “SparkFun ESP8266 Thing” Board correct?

  3. After I place the Program switch in PRG mode, I hold down the ESP button while it’s uploading the new code correct?

  4. I return the Program switch to RUN and everything should work even after reboot?

The garbage at the beginning of the serial usually indicates issues with the selected board, could there be a problem with the selected board. I did try a couple of other ones on the first Wifi Shield, but I didn’t see a difference.

OK, the garbage characters at the beginning is a status message the ESP8266 sends at bootup and some odd baud rate. It’s normal and nothing to worry about.

You should only use a 3.3 volt FTDI board, a board that supplies 5 volts to VCC or has 5 volt data lines will damage the shield.

“SparkFun ESP8266 Thing Dev” is the board type you want to use in Arduino.

PRG needs to be held down before and during programming.

The PRG/RUN switch connects the ESP8266 to either your FTDI for programming or to the AST board the shield is connected too. It needs to be in PRG to upload code to the ESP8266 on the shield but once you’ve uploaded code to the shield it needs to be switched back to RUN to connect it to the AST-CAN485.

Your AST-CAN485 then needs it’s own code to communicate through the WiFi shield.

Ok, thanks Chris.

I still can’t get this working. The “SparkFun ESP8266 Thing Dev” does a hard reset at the end vs a soft reset on the other board and the code will not work.

I can get the code working on the board “SparkFun ESP8266 Thing” because it does a soft reset, but if I hard reset it, the code is gone. I think there is some major issue with this board.

Do you have a video of this working?

I understand the AST-CAN485 has to be programmed separately and I have that working great. I just can’t seem to get anything programmed on the Wifi Shield that will stick on the board and work after a hard reset. Sorry, but I have now tried two different boards.

I have tried these example too : https://github.com/Atlantis-Specialist- … asicSerial

The AST-CAN485 work great, bit the Wifi Shield won’t work with this either.

Here is an example of what I’m talking about.

  1. If I use “SparkFun ESP8266 Thing Dev” it does a hard reset after upload and the board doesn’t work at all.

  1. If I use “SparkFun ESP8266 Thing” it does a soft reset after upload and the board works until I reset it.

@TS-Chris could the programming button be broken on these boards? I now have two boards that acts the exact same way.

Have anyone else used these boards successfully? I can’t find anything online with someone actually using them.

Could someone from Technical Support please get on this forum and help a customer? It’s very frustrating that I cannot contact you directly.

This board has issues that I would like to get resolved asap.

I have now tried a third board with the same issues. I have tried contacting your support through email as that is the only option I have, but I have heard from no one at Spark-Fun yet.

What are you using to program the ESP8266?

I just can’t seem to get anything programmed on the Wifi Shield that will stick on the board and work after a hard reset.

I can get the code working on the board “SparkFun ESP8266 Thing” because it does a soft reset, but if I hard reset it, the code is gone

The code gets written to the EEPROM, so if it’s working after a soft reset, it will still be there after a hard reset but it sounds like the ESP8266 is not executing it.

I successfully uploaded both the BasicSerial-ESP and AdvancedWebServer examples which also worked even after a dozen hard resets.

@TS-Chris could the programming button be broken on these boards?

It’s unlikely, but possible. The failures I’ve need with momentary switches is they fail to close the switch and stay open, even when they’re pressed. There are two buttons that can be used for programming. The “RST” pulls the reset pin low, and “0” is connected to GPIO-0, which needs to be low when the board comes out of reset to enter the bootloader. If GPIO-0 was low after coming out of a hard reset, it would be entering the bootloader, and not running your code.

The reset signal is broken out to a pin near the U.FL connector. It should be 3.3V normally, and 0V when the RST button is pressed. GPIO-0 is a little harder to measure but the two pins on the same side as the ESP8266 are connected to to GPIO-0 and should also measure 3.3V normally, and 0V when pressed.

AST WiFi Shield GPIO-0.PNG

What are you using to program the ESP8266?

I've tried both the Arduino IDE and Visual Studio 2019 Community edition.

The code gets written to the EEPROM, so if it’s working after a soft reset, it will still be there after a hard reset but it sounds like the ESP8266 is not executing it.

I successfully uploaded both the BasicSerial-ESP and AdvancedWebServer examples which also worked even after a dozen hard resets.

I must be doing something wrong then. Just not sure what I could be doing different than you. I've programmed the CAN485 and that seems to work fine.

I’ve tried again on the latest board I got. This one actually looks to hold the program after reboot, however, it will not communicate on the serial port. I loaded the BasicSerial-ESP and when I restart the light is on. However, as soon as I try and open the serial connection it turns off and the serial doesn’t work.

If I connect using putty, I get constant garbage out on the serial.

Hi alex,

Here is what I’m trying to convey:

I’m using this code as an example:

https://raw.githubusercontent.com/Atlan … al-ESP.ino

I upload the code without pressing the programming button, having the switch turned to programming.

I can get the unit working by sending a character h to turn the light on and sending any other character to turn the light off.

If I power off the unit and power it back on it doesn’t work anymore. This is expected as I didn’t hold down the programming button.

However, if I hold down the programming button, nothing works. It uploads the code, but it won’t respond to anything, either before or after rebooting the device. The debugger never attaches to the main, so this leads me to believe there is something going on with the programming logic.

This happens the same on two of the units I have.

The third one is acting differently and will not let me upload without pushing the programming button.

I get this error if I don’t hold down the programming button:

Serial port COM5

Connecting……_____

Traceback (most recent call last):

File “F:\Arduino\hardware\esp8266com\esp8266/tools/upload.py”, line 66, in

esptool.main(cmdline)

File “F:/Arduino/hardware/esp8266com/esp8266/tools/esptool\esptool.py”, line 3552, in main

esp.connect(args.before, args.connect_attempts)

File “F:/Arduino/hardware/esp8266com/esp8266/tools/esptool\esptool.py”, line 529, in connect

raise FatalError(‘Failed to connect to %s: %s’ % (self.CHIP_NAME, last_error))

esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0x89)

The uploader process failed

However, if I hold down the programming button it uploads, but then it acts like the other two boards. Nothing will work and the debugger will not attach.

Any help would be appreciated.

I guess it’s time to move on to a different vendor with the lack of support here…these will go in the garbage. Great concept if it had worked.