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. Forums
  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

4 years 11 months ago

Hi,

Hi,

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

BR,
Mikko

mightyChamp

4 years 11 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

4 years 11 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

4 years 11 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

4 years 11 months ago

Hi,

Hi,

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

BR,
Mikko

mightyChamp

4 years 11 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

4 years 11 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

4 years 11 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

4 years 11 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

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin