ESP32 Crashes when reading Monthly billing

9 posts / 0 new
Last post
mightyChamp
ESP32 Crashes when reading Monthly billing

Hello,

we want to read monthly billing profile generic Data using Obis Code: 1.0.98.1.0.255

We have two type of DLMS Meter.
while reading monthly billing profile generic data from 1st meter we getting 128 Obis codes in attribute 3 and in 2nd meter we getting 205 Obis code in attribyte 3.
we have checked these info in GURUX Director Software.

But in Arduino ESP32 get crashed for 2nd meter in which there are 205 obis code, and some time get Error:260( Out of memory error). and same code work for 1st meter without crash.

Crash report :

0x40104dce: oa_push at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U\src/objectarray.c line 157
0x401028d2: setCaptureObjects at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U\src/gxsetmalloc.c line 5113
0x40102b79: cosem_setProfileGeneric at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U\src/gxsetmalloc.c line 5272
0x400fe5b7: cosem_setValue at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U\src/gxset.c line 199
0x400f127b: cl_updateValue at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U\src/client.c line 1127
0x400ed837: GXDLMSClient::UpdateValue(gxObject*, unsigned char, tagdlmsVARIANT*) at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U/GXDLMSClient.cpp line 125
0x400e49c7: com_read(gxObject*, unsigned char) at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U/dlms.ino line 858
0x400e4ed9: initMonthlyBillingBuff(unsigned char) at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U/dlms.ino line 1988
0x400e525e: initialize_dlms_tag_buffer() at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U/DLCG24U.ino line 664
0x400ec3ed: loop() at c:\Users\mmswd\Documents\GitHub\ESP32\DLCG24U/DLCG24U.ino line 380
0x40114d10: loopTask(void*) at C:\Users\mmswd\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32\main.cpp line 23
0x4008aab2: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

mightyChamp

Hello,

Request to help as soon as possible.

Thank You

Kurumi
Kurumi's picture

Hi,

It seems that there is not enough memory available. Can you try to read only one row at a time? It decreases memory consumption.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

mightyChamp

I am reading profile generic attribute 3 by "com_read(BASE(pg), 3); ", it is for obis list, code get crashed in this. In gurux software meter 2 shows 205 obis list.

I also check ESP32 memory by ESP.getFreeHeap() and ESP.getMaxAllocHeap() in begin of readDLMSPacket() function.
Before crashing time it reports:
ESP.getFreeHeap() = 142972
ESP.getMaxAllocHeap()= 62912

So, by this data it shows that it has free memory.

can I read it by row, if yes how?, and if it is memory allocation issue, can I do something about it, so I can read meter data using ESP32.

I need starting 120 obis codes and their data out of 205, can I get them So there would be no memory issue.

Thank You

Kurumi
Kurumi's picture

Hi,

You have enough memory. Maybe the reason is somewhere else.
Can you Select profile generic 1.0.98.1.0.255 and then select "File" and "Refresh"? It will read the capture objects. Then send a log from the sent and received bytes to me by email or share it with textbin.net.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

mightyChamp

I have sent you log by mail. request to check it.
Thank You

mightyChamp

Hello,

Have you look up at my mail, waiting for your response.

Thank You

Kurumi
Kurumi's picture

Hi,

I'm sorry for the slow reply. Our clients have kept us busy. This is checked with Arduino IDE and ESP8266 and it worked without problems.

In your first post, you said that this is happening randomly. If this is true, are you sure that you have released capture objects after reading? You can do this example by calling obj_clear-method.
If you don't release objects, the amount of the memory is increased with every reading.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

mightyChamp

Hello,

Thanks for response. I have checked, I have cleared object and release client each time. I print memory in start of loop(), some time there is down in memory, but next time it returns to its same value as when loop() start first time.

I have made another code to only read billing data, and I get success in this. at this time ESP32 memory is about 240000 bytes.
But, With with my application code, in which ESP32 have
ESP.getFreeHeap() = 142972
ESP.getMaxAllocHeap()= 62912
memory. I can't read billing data. It happens always, Some time I get 260 out of memory error, and other time ESP32 get crashed.

Thank You