By Bill , 23 September, 2021 Forums DLMSDirector Hello, I use Gurux to get token gateway code and it works. Now I`m trying to use Arduino IDE to get token data,but I got something error. Here is my Arduino code: gxTokenGateway objToken; unsigned char token[20] = {0x31, 0x37, 0x36, 0x32, 0x32, 0x34, 0x34, 0x39, 0x37, 0x30, 0x36, 0x31, 0x31, 0x35, 0x30, 0x34, 0x39, 0x32, 0x35, 0x30}; gxByteBuffer bb; BYTE_BUFFER_INIT(&bb); if ((ret = bb_setUInt8(&bb, DLMS_DATA_TYPE_OCTET_STRING)) == 0 && (ret = hlp_setObjectCount(sizeof(token), &bb)) == 0 && (ret = bb_set(&bb, token, sizeof(token))) == 0) { } dlmsVARIANT params; var_init(¶ms); var_setInt8(¶ms, 0); var_addOctetString(¶ms, &bb); var_addBytes(¶ms, token, sizeof(token)); cosem_init(BASE(objToken), DLMS_OBJECT_TYPE_TOKEN_GATEWAY, "0.0.19.40.0.255"); com_method(BASE(objToken), 1, ¶ms); data = bb_toHexString(&objToken.token); obj_toString(BASE(objToken), &data); GXTRACE(PSTR("Ori token : "), data); obj_clear(BASE(objToken)); free(data); Response: :com_method section2 failed. 12 :Ori token : Index: 2 Value: What`s wrong with my code? My Arduino IC specification is Mega2560 Bill Image Hi, Hi, Try to remove this line: var_setInt8(¶ms, 0); BR, Mikko Hi Mikko: Hi Mikko: It still not work. :com_method section2 failed. 12 Bill Hi, Hi, Your code looks correct. Can you get a trace from the bytes send so I can check what might be the problem? BR, Mikko Hi Mikko: Hi Mikko: I sent an email to you. Please help me to check my collected data. Bill Hi, Hi, I was not receiving it. Can you share it on textbin.net? BR, Mikko Hi Mikko, Hi Mikko, I also have the same problem with Bill. Can you help me with this problem ? Ferdinand Hi Ferdinand, Hi Ferdinand, Can you create a new topic and share sent bytes, so I can check what is the problem. BR, Mikko
Hi, Hi, Your code looks correct. Can you get a trace from the bytes send so I can check what might be the problem? BR, Mikko
Hi Mikko, Hi Mikko, I also have the same problem with Bill. Can you help me with this problem ? Ferdinand
Hi Ferdinand, Hi Ferdinand, Can you create a new topic and share sent bytes, so I can check what is the problem. BR, Mikko
Hi,
Hi,
Try to remove this line:
var_setInt8(¶ms, 0);
BR,
Mikko
Hi Mikko:
Hi Mikko:
It still not work.
:com_method section2 failed. 12
Bill
Hi,
Hi,
Your code looks correct. Can you get a trace from the bytes send so I can check what might be the problem?
BR,
Mikko
Hi Mikko:
Hi Mikko:
I sent an email to you.
Please help me to check my collected data.
Bill
Hi,
Hi,
I was not receiving it. Can you share it on textbin.net?
BR,
Mikko
Hi Mikko,
Hi Mikko,
I also have the same problem with Bill.
Can you help me with this problem ?
Ferdinand
Hi Ferdinand,
Hi Ferdinand,
Can you create a new topic and share sent bytes, so I can check what is the problem.
BR,
Mikko