Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Node
  3. Arduino C Code OUT_OF_MEMORY Error:260 Issue When Using Cipher

Arduino C code OUT_OF_MEMORY Error:260 Issue when using Cipher

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By mightyChamp , 10 July, 2021
Forums
Gurux.DLMS

Hello,

When Reading meter with NO Authentication, It reads some obis, I read Invocation counter from it, then increment t. Then Use Chiper as given in example. But In initialization, it fail to connect and give this error of 260 out of memory.

I am using this for setup:

Client.init(true, 16, 1, DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
int ret = com_initializeConnection();
if (ret != DLMS_ERROR_CODE_OK)
{
com_close();
delay(1000);
ret = com_initializeConnection();
if (ret != DLMS_ERROR_CODE_OK)
{
printf("com failed:%d\r\n",ret);
return;
}
}

gxData d;
cosem_init(BASE(d), DLMS_OBJECT_TYPE_DATA, "0.0.43.1.2.255");
com_read(BASE(d), 2);
Serial.printf("\r\nIncovation Counter Old: %d, New: %d\r\n",d.value.ulVal,Client.settings.cipher.invocationCounter);

Client.settings.cipher.invocationCounter = (1 +(d.value.ulVal));
Serial.printf("\r\nIncovation Counter Old: %d, New: %d\r\n",d.value.ulVal,Client.settings.cipher.invocationCounter);

//Close the connection.
Client.ReleaseObjects();
com_close();

Client.init(true, 32, 1, DLMS_AUTHENTICATION_LOW, "lnt1", DLMS_INTERFACE_TYPE_HDLC);
//Un-comment this if you want to set system title, block cipher key or authentication key.
Client.settings.cipher.security=DLMS_SECURITY_AUTHENTICATION_ENCRYPTION;
printf("maxPduSize:%d\r\n",Client.settings.maxPduSize);
printf("maxServerPDUSize:%d\r\n",Client.settings.maxServerPDUSize);
gxByteBuffer bb;
bb_Init(&bb);
bb_addHexString(&bb, "1122334455667788");
Client.SetSystemTitle(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "01 02 03 04 05 06 07 08 09 00 0A 0B 0C 0D 0E 0F");
Client.SetAuthenticationKey(&bb);
bb_clear(&bb);
bb_addHexString(&bb, "01 02 03 04 05 06 07 08 09 00 0A 0B 0C 0D 0E 0F");
Client.SetBlockCipherKey(&bb);
bb_clear(&bb);

int ret = com_initializeConnection();
if (ret != DLMS_ERROR_CODE_OK)
{
com_close();
delay(1000);
ret = com_initializeConnection();
if (ret != DLMS_ERROR_CODE_OK)
{
printf("com failed:%d\r\n",ret);
}
}

delay(2000);
com_close();

In last I get error: com failed: 260.

Please help me to resolve this error.

Thank You

Profile picture for user Kurumi

Kurumi

5 years 2 months ago

Hi,

Hi,

Try to make the connection with GXDLMSDirector first. Check your block cipher and authentication keys.

BR,
Mikko

mightyChamp

5 years 2 months ago

I test with GXDLMSDirector

I test with GXDLMSDirector it Connect with Meter. So cipher and authentication are correct. But with Arduino, it gives Out of memory 260, error.
Please help me resolve this issue.

Profile picture for user Kurumi

Kurumi

5 years 2 months ago

Hi,

Hi,

Can you send the block cipher key and authentication key by email. I also need GXDLMSDirector log to check what is the problem.

BR,
Mikko

mightyChamp

5 years 2 months ago

GXDLMSDirector works fine,

GXDLMSDirector works fine, with cipher key and authentication key.
Issue is from arduino code side, not from GXDLMSDirector Side. and I am using IS15959 Part 2 LNT meter.

On which email address should I contact you ?

Thank You

Profile picture for user Kurumi

Kurumi

5 years 2 months ago

Hi,

Hi,

You can find my email address from here:
https://www.gurux.fi/AboutUs

BR,
Mikko

mightyChamp

5 years 2 months ago

Keys are confidential, So I

Keys are confidential, So I can't share.
Could you help without them?

Profile picture for user Kurumi

Kurumi

5 years 2 months ago

Hi,

Hi,

I can't decrypt the data. Check that you are using the same authentication and block cipher keys in GXDLMSDirector and in your app.

BR,
Mikko

mightyChamp

5 years 2 months ago

Authentication keys are same,

Authentication keys are same, I think it may be some buffer Size issue, but can't figure out.
Could you list out Error reasons for 260 (out of memory), So it will easy to find root cause for this error.

Is my posted code have any problem?

Profile picture for user Kurumi

Kurumi

5 years 2 months ago

Hi,

Hi,

There are multiple locations where error 260 is returned and it's not easy to find without trace.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 08/26/2026 - 09:04
    Gurux.DLMS.Python 1.0.203
  • Mon, 08/17/2026 - 11:28
    Gurux.DLMS.Python 1.0.202
  • Mon, 08/17/2026 - 09:47
    gurux.dlms.cpp 9.0.2608.1701
  • Mon, 08/17/2026 - 09:25
    gurux.dlms.c 9.0.2608.1701
  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701

New forum topics

  • Security vulnerability report — request for a private contact (GuruxDLMS.c / ANSI C)
  • Topic: Insufficient Memory Error When Reading Class 7 Profile Generic Objects
  • SN ReadResponse returns all-null values when response spans multiple HDLC frames
  • Gurux.Serial.Android 3.0.6 – CH340 (HL-340) USB-Serial Adapter Not Working,
  • Trying to talk to a L&G E360 meter (Using Python Gurux)
More

Who's new

  • Anaglyfos Trading CC
  • cyby
  • Metin Onan
  • ssv007
  • 3nzol3dur
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin