Huzzah MQTT Exception on mqtt.connect()

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
dr_greg
 
Posts: 4
Joined: Wed May 18, 2016 2:48 pm

Huzzah MQTT Exception on mqtt.connect()

Post by dr_greg »

I'm trying to get this sketch ..

https://learn.adafruit.com/adafruit-io- ... ut/esp8266

.. working on a Huzzah Feather.

It compiles fine, and everything looks normal when it runs up until it
tries to do: mqtt.connect()

The following is printed on the console:

Connecting to guest
..
WiFi connected
IP address:
192.168.10.134
Connecting to Adafruit IO...
Exception (3):
epc1=0x4000bee5 epc2=0x00000000 epc3=0x00000000 excvaddr=0x40230285 depc=0x00000000

ctx: cont
sp: 3ffef3e0 end: 3ffef620 offset: 01a0

>>>stack>>>
3ffef580: 48372328 00000001 3ffe867d 40203c74
3ffef590: 5e61662a 3ffee3e8 3ffee3e8 40202fee
3ffef5a0: 40230214 0000000e 3ffee5c8 40203429
3ffef5b0: 3ffe867c 0000001c 402301ec 3ffee5f4
3ffef5c0: 40230214 3ffee3e8 3ffee5c8 40201e9c
3ffef5d0: 860aa8c0 00ffffff fe0aa8c0 3ffee5f4
3ffef5e0: 40230214 3ffee4d4 3ffee5c8 40201f92
3ffef5f0: 3ffe8678 860aa8c0 feefeffe feefeffe
3ffef600: 3fffdad0 00000000 3ffee5ec 4020371c
3ffef610: feefeffe feefeffe 3ffee600 40100718
<<<stack<<<

Any ideas? I've tried the same sketch on two different Huzzah Feathers with the same result.

User avatar
adafruit_support_jarek
 
Posts: 324
Joined: Tue Nov 08, 2016 11:48 am

Re: Huzzah MQTT Exception on mqtt.connect()

Post by adafruit_support_jarek »

Hi there! Can you please copy and paste the entire code/sketch you are uploading in a reply?

User avatar
dr_greg
 
Posts: 4
Joined: Wed May 18, 2016 2:48 pm

Re: Huzzah MQTT Exception on mqtt.connect()

Post by dr_greg »

I'm trying to get working the "digital_out" sketch from https://github.com/adafruit/adafruit-io-basics (for the Huzzah). The only lines I changed were the WLAN and AIO definitions.

I've installed the Exception trace tool from https://github.com/me-no-dev/EspExceptionDecoder with resulting output:

Exception 3: LoadStoreError: Processor internal physical address or data error during load or store
Decoding 13 results
0x40230285: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40203c74: Print::write(unsigned char const*, unsigned int) at /Users/.../Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 84
0x40202fee: Adafruit_MQTT::connect() at /Users/.../Documents/Arduino/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.cpp line 804
0x40230214: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40203429: Print::write(char const*) at /Users/.../Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 84
0x402301ec: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40230214: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40201e9c: connect() at /Users/.../Documents/Arduino/adafruit-io-basics/esp8266/digital_out/digital_out.ino line 140 (discriminator 1)
0x40230214: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40201f92: setup at /Users/.../Documents/Arduino/adafruit-io-basics/esp8266/digital_out/digital_out.ino line 99
0x4020371c: loop_wrapper at /Users/.../Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at /Users/.../Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/cont.S line 109

User avatar
adafruit_support_jarek
 
Posts: 324
Joined: Tue Nov 08, 2016 11:48 am

Re: Huzzah MQTT Exception on mqtt.connect()

Post by adafruit_support_jarek »

Hmmm, the code on the page you linked seems to be incomplete; there's supposed to be a bunch more definitions and initializers that I'm surprised the compiler didn't catch. Can you please download the Adafruit IO Basics Sketches archive ( https://github.com/adafruit/adafruit-io ... master.zip ) and try to use the "digital_out" example in that folder?

User avatar
dr_greg
 
Posts: 4
Joined: Wed May 18, 2016 2:48 pm

Re: Huzzah MQTT Exception on mqtt.connect()

Post by dr_greg »

The same result:

Connecting to MyWiFi
..
WiFi connected
IP address:
192.168.10.134
Connecting to Adafruit IO...
Exception (3):
epc1=0x4000bee5 epc2=0x00000000 epc3=0x00000000 excvaddr=0x40230285 depc=0x00000000

ctx: cont
sp: 3ffef3e0 end: 3ffef620 offset: 01a0

>>>stack>>>
3ffef580: 48372328 00000001 3ffe867d 40203c74
3ffef590: 5e61662a 3ffee3e8 3ffee3e8 40202fee
3ffef5a0: 40230214 0000000e 3ffee5c8 40203429
3ffef5b0: 3ffe867c 0000001c 402301ec 3ffee5f4
3ffef5c0: 40230214 3ffee3e8 3ffee5c8 40201e9c
3ffef5d0: 860aa8c0 00ffffff fe0aa8c0 3ffee5f4
3ffef5e0: 40230214 3ffee4d4 3ffee5c8 40201f92
3ffef5f0: 3ffe8678 860aa8c0 feefeffe feefeffe
3ffef600: 3fffdad0 00000000 3ffee5ec 4020371c
3ffef610: feefeffe feefeffe 3ffee600 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,6)


ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

User avatar
dr_greg
 
Posts: 4
Joined: Wed May 18, 2016 2:48 pm

Re: Huzzah MQTT Exception on mqtt.connect()

Post by dr_greg »

It appears that SEGFAULT is related to using "PROGMEM" hence commenting it out fixes the problem:

const char MQTT_SERVER[] = /* PROGMEM */ AIO_SERVER;
const char MQTT_CLIENTID[] /* PROGMEM */ = __TIME__ AIO_USERNAME;
const char MQTT_USERNAME[] /* PROGMEM */ = AIO_USERNAME;
const char MQTT_PASSWORD[] /* PROGMEM */ = AIO_KEY;
const char LAMP_FEED[] /* PROGMEM */ = AIO_USERNAME "/feeds/lamp";

Googling around on http://www.esp8266.com/viewtopic.php?f=28&t=5549 martinayotte posts:

"Unfortunately, we can't use PROGMEM with println() directly on ESPs. Why it is working on AVR ? simply because the Flash is directly accessible in the memory map of the AVR, which is not the case of ESPs since the Flash is external and connected by SPI bus, Flash content is accessible by cache mechanism. If you really wish to use PROGMEM, you will need to write a println_P() wrapper function which would be similar to the send_P() or sendContent_P() from ESP8266WebServer which use a memccpy_P() to copy PROGMEM into a RAM buffer with limited buffer size and looping until the end of string."

User avatar
adafruit_support_jarek
 
Posts: 324
Joined: Tue Nov 08, 2016 11:48 am

Re: Huzzah MQTT Exception on mqtt.connect()

Post by adafruit_support_jarek »

Great, thank you for sharing your findings! We'll update our guides with this info :)

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”