I am trying to read ProfileGeneric 1.0.99.1.0.255:3 using DLMS C library. I get Not enough memory available. error.
Following is the communication log for your reference. (TX is data sent from C Application to meter, RX is response received from meter)
Meter is being read using TCP. HDLC Wrapper is enabled.
I am using the example app which is in the library. It works fine when meter with serial interface is read. But when meter with Wrapper is read over TCP, it gives above error.
Source of this error is in communication.c
int readData(connection* connection, gxByteBuffer* data, int* index)
Following block of code causes out of memory error code to be returned.
uint32_t cnt = connection->data.capacity - connection->data.size;
if (cnt < 1)
{
return DLMS_ERROR_CODE_OUTOFMEMORY;
}
When this error occurs connection->data.capacity and connection->data.size both are same so cnt=0.
Problem is that the meter tells that maximum PDU size is 256 bytes and the meter is sending 384 bytes. You need to ask the meter manufacturer to fix this.
In the mean time you can read your meter if you change this line in communication.c:
//Allocate 50 bytes more because some meters count this wrong and send few bytes too many.
con_initializeBuffers(connection, 50 + connection->settings.maxPduSize);
Hi,
Hi,
You haven't read all the data yet. Meter says that the PDU size is 384 bytes and you have read only 298 bytes. Read data until reply->complete != 0.
BR,
Mikko
I am using the example app
I am using the example app which is in the library. It works fine when meter with serial interface is read. But when meter with Wrapper is read over TCP, it gives above error.
Source of this error is in
Source of this error is in communication.c
int readData(connection* connection, gxByteBuffer* data, int* index)
Following block of code causes out of memory error code to be returned.
uint32_t cnt = connection->data.capacity - connection->data.size;
if (cnt < 1)
{
return DLMS_ERROR_CODE_OUTOFMEMORY;
}
When this error occurs connection->data.capacity and connection->data.size both are same so cnt=0.
Hi,
Hi,
Problem is that the meter tells that maximum PDU size is 256 bytes and the meter is sending 384 bytes. You need to ask the meter manufacturer to fix this.
In the mean time you can read your meter if you change this line in communication.c:
//Allocate 50 bytes more because some meters count this wrong and send few bytes too many.
con_initializeBuffers(connection, 50 + connection->settings.maxPduSize);
Change 50 to 200.
BR,
Mikko
Thanks, it worked.
Thanks, it worked.