Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish example throws LoadStoreAlignmentCause exception #22

Open
rpgit12 opened this issue Jul 27, 2021 · 2 comments
Open

publish example throws LoadStoreAlignmentCause exception #22

rpgit12 opened this issue Jul 27, 2021 · 2 comments

Comments

@rpgit12
Copy link

rpgit12 commented Jul 27, 2021

Hi,

I've successfully got WiFi to work on an Feather Huzzah ESP8266, but am unable to get MQTT to work. The publish example consistently throws an LoadStoreAlignmentCause error.

The stacktrace is

Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
PC: 0x4020269a: WiFiClient::WiFiClient() at ./Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/Print.h line 46
EXCVADDR: 0x00000017

Decoding stack results
0x40203424: HardwareSerial::write(unsigned char const*, unsigned int) at ./Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/HardwareSerial.h line 193
0x40203a3c: Print::write(char const*) at ./Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/Print.h line 59
0x40201634: Ubidots::Ubidots(char*) at ./Documents/Arduino/libraries/ubidots-mqtt-esp-master/src/UbidotsESPMQTT.cpp line 39
0x402010c0: setup() at ./Documents/Arduino/sketch_wifi/sketch_wifi.ino line 48
0x40204d54: loop_wrapper() at ./Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_main.cpp line 198

Here's the console output, with debug for WIFI enabled. Any thoughts much appreciated!!!

.....scandone
state: 0 -> 2 (b0)
.state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt 

connected with paustian-huey, channel 11
dhcp client start...
wifi evt: 0
....ip:192.168.86.20,mask:255.255.255.0,gw:192.168.86.1
wifi evt: 3
.WiFi connected
IP address: 
192.168.86.20
Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x4020269a, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000017, depc=0x00000000

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (9):
epc1=0x4020269a epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000017 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffdb0 end: 3fffffc0 offset: 0190
3fffff40:  40203424 3ffe8985 3ffee7f0 40203a3c  
3fffff50:  3fffdad0 0000000d 3ffee7f0 1c4466df  
3fffff60:  3fffdad0 1456a8c0 00ffffff 3ffee880  
3fffff70:  3fffdad0 3ffee7b4 3ffee7f0 40201634  
3fffff80:  feefeffe feefeffe 402081cc 1456a8c0  
3fffff90:  3fffdad0 00000000 3ffee728 402010c0  
3fffffa0:  feefeffe feefeffe 3ffee86c 40204d54  
3fffffb0:  feefeffe feefeffe 3ffe85dc 40100ef9  
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

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

load 0x4010f000, len 3460, room 16 
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4 
tail 4
chksum 0xc9
csum 0xc9
v000526a0
~ld

SDK:2.2.2-dev(38a443e)/Core:3.0.1=30001000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-48-g7421258/BearSSL:c0b69df

@Julius97
Copy link

Hello, i had this exact problem since 4 days ago, i thought the problem was from my code but when i try this example code : https://help.ubidots.com/en/articles/513312-connect-a-nodemcu-esp8266-to-ubidots-over-http ,the problem persist. I try connecting my nodemcu via HTTP but still no luck. Please help

@rpgit12
Copy link
Author

rpgit12 commented Jul 27, 2021

I switched to the ubidots-esp8266 client yesterday, and finally managed to get it to work. However I also had to downgrade the board to 2.7.4 (due to issues on the mac with the 3.0.0 and later version.) Connecting via HTTP still resulted in an exception, but switching to TCP in the client finally worked.

Per the README for ubidots-esp8266 client, using TCP will switch to the ESP8266's native secure client, so I wonder if there's a bug in the WiFi or TCP/IP stack related modules. You may want to look at downgrading those modules if that's possible.

One area that looked odd to me is the initialization of the class in the ubidots-mqtt-esp module; in the constructor Ubidots::Ubidots(char* token), the byte array returned by macAddress() is copied using strcopy. The returned 6 bytes are binary and not necessarily zero-terminated, so using strcopy can cause problems. (Assuming memory layout isn't too different on the arduino from other systems, you're likely to hit a zero somewhere on the heap before an invalid address.) However changing that code didn't make a difference. I do think that ought to be fixed though - there's a few examples with a mac2String() function being used in other code for arduino that convert that same binary mac address to a valid string - typically octets separated by ':'.

Btw, I can't figure out what the difference between the two clients ubidots-esp8266 and ubidots-mqtt-esp is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants