2:14 pm
Hi community,
i try to develop an arduino (uno, nano, mini) sketch with the ESP-8266 (ESP-01) Wifi modul. at the end it would be a Wifi data logging system and an actor controler. (TCP Server with Errorhandling maybe with web server if i have enough flash space)
For the UART communication i have two global variables. The first one is for data writing ("string") and the other for data reading (uint8-array).
When i will use the read Data in the following SUBvis, the arduino have some different problems.
I wrote a string-parse function to analyse the data (each line) from ESP8266 modul in a while loop and set special flags. This string-parse-function was stored a a SUBvi. When i request the data outside of the while loop in this VI and convert to string, the string is empty inside the while loop. So the Match Pattern Function can not find anything. Sometime the Arduino will crash as well.
When i only connect the uint8 array line to the while loop and convert to string inside the loop, the string is empty too. On this case the arduino will crash very often.
When i request the global uint8 array and convert to string inside of the loop, it will work. The Match Pattern Function works correctly. But at this case i have sometimes the problem that the SUBvi did not work correctly. A new string was collected and the Match Pattern Function did not find anything and i don't know why.
My free SRAM space is about 800b and all other function after that works correctly.
I hope you understand my problem. It is a bit difficult to describe.
Hardewareinformations: Arduino Uno SMD R3, Wifi modul ESP8266/ version 01 with AT command 0.9.5, UART speed = 115200, 4x20 character LCD i2C Display, 4x ADC inputs and an I2C temperature sensor
the hole sketch use arround 25kb flash and arround 650byte global SRAMspace.
3:03 pm
March 12, 2015
This sounds like a memory issue. When you have fragmented or low RAM things will act strange. But can you post your VI and I will try to take a look to see if that's the case? Be aware that strings and arrays use dynamic memory allocation from the heap so that space is not allocated til runtime and is suceptable to fragmentation.
11:06 pm
hello,
thank you for your fast answer.
i had found the first issue. the global variable for wifi data (uint8 array) had no size. at every cycle the array had an other size from 5 to 50 bytes. now i initialize this array at every cycle to 40 bytes. the arduino didn't crash.
But i can not understand the problem with my UART data global. This array is initialized with a 100 byte array. this is the maximum UART packet size too.
The string-parse-function only work fine, when the global request is inside the loop. But i can not see the difference between the request inside and outside of the loop.
maybe you can see it in my VI. some variables have german names. i hope that is not a problem...:)
11:16 pm
March 12, 2015
Can you zip and send the whole project? This is calling many subVIs that were not included. Also, please specify exactly where you are having the global issue with the UART data global. It could be an issue with the German variable names. There are characters in here that the Compiler doesn't support and it is quite possible that is an issue. We recommend using the Compiler with Windows set to English as there are limitations to what can be interpreted in non-English languages without translations.
4:59 am
Hi Steffan,
okay...that is a good information. But the compiler comes with no error after compilation...?? Is that right?
I will check all global names and all VI names for non english characters.
Do you have a list of non allowed characters?
I think in one of my globals i use the name "byte"....i will check out...i think there is my error.
Many thanks
Adrian
10:59 pm
March 12, 2015
Ok good. Not sure exactly why it compiles unless we decompile the VIs. But lets focus on your second issue. Can you zip and send your whole project so I can look into it further? If you dont want to post you can also send to support@geverywhere.com.
6:10 pm
Hi Steffan,
sorry for my late answer. now i have two projects. the first one is in ok.zip and works fine. The global "UART read" is inside of the loop in "suche in UART.vi".
The secound ZIP "error.zip" is the other project with the global "UART read" outside of the loop in "suche in UART.vi".
I hope you can analyse my projects. I have tested both on my Arduino UNO SMD R3.
If you have questions please ask me. I hope you can find the issue.
Many thanks
Adrian
5:06 am
Hi Steffan,
i took a look too. in my project (the both zips) i have found the references......??....but you are right. when i search all references from the global variable in the project there is no result. When i open the vi "suche in UART.vi" and search references from "UART read" i got the result below.
may be this will be the issue.....but the "ok" project works fine on Arduino.......??
2:29 pm
March 12, 2015
Adrian said
sorry for my late answer. now i have two projects. the first one is in ok.zip and works fine. The global "UART read" is inside of the loop in "suche in UART.vi".
Are you referring to the variable "UART read" or "UART data"? Above you said "UART read", which I can't find a reference to. But your image shows you are searching "UART data". Which variable is it you are concerned about? Please send a screenshot of the exact piece of code from the error project that is causing a problem.
5:13 pm
oh sorry....that was my fault.
you are right....i mean "UART data"! this variable is declared in the vi "global UART read.vi"
i took three screenshots. first one from project explorer, the second from vi "suche in UART.vi" with the issue (there is a note inside the vi) and the third from the same vi with no error (there is a information note too).
i hope you see what i mean.
8:18 pm
March 12, 2015
Adrian,
We identified this as an issue with how optimization is handled in certain cases involving loops and strings. We have opened Case 127 for your reference. As you found, a workaround is to pull the Global Read inside the loop. It appears you can actually leave the global outside the loop and pull just the Byte Array to String inside the loop before your Match Pattern and that should also work. Sorry for the inconvenience.
Steffan
18
1 Guest(s)