[SOLVED] Arduino + ESP8266 as Shield problems upgrading to V 0.3.3 Library

I’m experiencing problems trying to upgrade to 0.3.3, compiling:OK, Blynk.run(): OK, all is OK until I use Blynk.virtualWrite, almost all Vpin update fails, this is the log:

[6403738] >msg 0,1,200
[6403738] Ready (ping: 59ms).
[6413688] <msg 6,560,0
[6414880] >msg 0,560,200
[6424834] <msg 6,561,0
[6425912] >msg 0,561,200
[6435888] <msg 6,562,0
[6436398] >msg 0,562,200
[6436822] <msg 20,563,11

vw 0 17.010
[6441848] Cmd error
[6446871] <msg 20,564,11
[6446871] Cmd skipped
[6446872] <msg 20,565,11
[6446882] Cmd skipped
[6446906] <msg 20,566,10
[6446934] Cmd skipped
[6446957] <msg 20,567,11
[6446984] Cmd skipped
[6459506] <msg 2,1,32

Blynk.connected() returns 1 and results are the same with “blynk-cloud.com” or “cloud.blynk.cc”

When recompile with V 0.3.1 all works fine again.

Thank you

Could you please try with latest 0.3.4?

Thx for your quick response!

Yes I tried with this version too, and the result is the same.

@vshymanskyy should help you here.

Same fail with V 0.3.5-beta

I think your ESP8266 firmware may be wrong. You need v1.0.0 (AT V22), AFAIK…

@ianturo make sure you Completely clear out the blynk folder (and removing the esphard/soft serial folders) before installing/dropping in the new library files.

Thank you @vshymanskyy, you’re right the ESP had the “AI Thinker” version, but after reflash it to:

AT+GMR

AT version:0.22.0.0(Mar 20 2015 10:04:26)
SDK version:1.0.0
compile time:Mar 20 2015 11:00:32

(I don’t know if that version is the correct)

The result was quite similar, widgets were not updated:
[45312] <msg 20,5,11
<vw037.000
[50337] Cmd error
[55360] <msg 20,6,11
[55360] Cmd skipped
[55361] <msg 20,7,10
[55361] Cmd skipped
[55383] <msg 20,8,10
[55405] Cmd skipped
[55428] <msg 20,9,11
[55450] Cmd skipped
[55755] <msg 2,1,32
<013be5c324e244ffb06e29c3cb832f28
[56065] <msg 20,10,6
[56065] Cmd skipped
[56127] >msg 20,1283,4

vr1
[56138] >msg 20,1284,4
vr4
[56150] >msg 20,1285,4
vr0
[56166] >msg 20,1286,4
vr2
[56803] >msg 20,1291,4
vr1
[56814] >msg 20,1293,4
vr0
[56825] >msg 20,1294,4
vr2
[57791] >msg 20,1295,4
vr1
[57972] Login timeout
[58667] <msg 20,11,11

Thank you @zeeko, actually I delete all the old library folders before to copying the new library

This is a bit of a stab in the dark (guess), as there is not a lot of info to go on here, but have you checked your SRAM usage? I was getting these same type of errors when I was running my code on an Uno. With just 2K of SRAM it can be tight.

How much free SRAM are you starting out with? (The Arduino IDE tells you this after compiling your sketch). I was hitting this error with about 650 bytes of SRAM to start. If you’re in the same ballpark, try inserting some calls to check if the stack & heap have collided (see the Arduino MemoryFree library). The 8266 WiFi library uses a fair amount of stack space.

RD7

Thank you @Rom3oDelta7, the script use 1,330 bytes of SRAM (718 bytes free), but the problem only happen with the V0.3.3 or above

You are implying that versions after 0.3.1 added a bug, which is not necessarily the case. If it is a free memory problem then it is certainly possible that versions after 0.3.1 use more stack.

Unless someone has a better idea, it seems to be worth checking. At a minimum all you need are three calls to freeMemory(): one before calling Blynk.connect(), one in the Blynk.connect() wait loop, and one in loop().

At least it is something proactive you can do. At 718 free to start I would definitely suspect a stack overrun could be causing your problem.

RD7

Thanks, I’ll make a small script for testing

Thanks @Rom3oDelta7 I think you’re right, testing with a small script and the behavior has improved, although the Virtual Pin are updating regularly, in the log appears several times “Buffer overflow”.
And the worst of all is the increase of the SRAM is because my project uses: OneWire, Wire, LiquidCrystal_I2C and DallasTemperature.
With these evidence i think now you are right, and sorry, but I must insist that the fails doesn’t happen even one time in the V0.3.1
Sorry if my post seems rude, It is not my intention, english is my second language

No worries. I am often faced with the same issue - the libraries use up so much space that there is little left over for your own code.

Regarding your code working on an earlier version, you need to consider that if you are just on the brink of the stack and heap colliding (see https://learn.adafruit.com/memories-of-an-arduino/optimizing-sram) then a change in the library that uses more stack (for example more function nesting, more local variables, etc) may just push you over the limit. There’s only 2K, after all. One very easy way to test this is to try running the same code on a Mega board if you have one. I’ve got a lot of code that works great on a Mega but fails to run on an Uno at all.

I’m increasingly using the ESP8266 MCU instead of the AVR stuff - same IDE but much more powerful (and cheap!) hardware.

RD7

@Rom3oDelta7 Thanks, after to do several tests, even with the V 0.3.1, the problem is the free amount of SDRAM, when it is lower than 1000 Bytes as you mention the connection is turning very unstable.
I had to copy locally the libraries and remove all unnecessary code to left more SRAM abalilable.