Hello!
I’m implementing a DLMS server on a c2000 Texas Instruments microcontroller based on the ANSI C server examples. Communication is established via PLC, and i have alredy implemented a serialization of the PRIME API on the c2000. The interface I'm using for the DLMS server is "TYPE_PDU".
After making some small modifications, I’m attempting to connect to the server from GXDLMS Director running on a PC, with Microchip’s Prime Manager software handling DLMS over TCP (Prime manager also has a serialization of PRIME API).
However, when I try to connect from GXDLMS Director to the server, I receive the following error message:
ServiceError Initiate Error exception. Initiate Other
The PDU message sent from the base node (GXDLMS Director) is:
60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 30 30 30 30 30 30 30 30 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 10 54 00 F7
Decoded with the DLMS Translator:
<AssociationRequest>
<ApplicationContextName Value="LN" />
<SenderACSERequirements Value="1" />
<MechanismName Value="Low" />
<CallingAuthentication Value="3030303030303030" />
<InitiateRequest>
<ProposedDlmsVersionNumber Value="06" />
<ProposedConformance>
<ConformanceBit Name="SelectiveAccess" />
<ConformanceBit Name="Get" />
<ConformanceBit Name="Access" />
<ConformanceBit Name="BlockTransferWithGetOrRead" />
</ProposedConformance>
<ProposedMaxPduSize Value="00F7" />
</InitiateRequest>
</AssociationRequest>
The server (service node) responds with the following PDU:
61 1F A1 09 06 07 60 85 74 05 08 01 01 42 03 02 01 01 A3 05 A1 03 02 01 01 BE 06 04 04 0E 01 06
Decoded with the DLMS Translator:
<!--Error: Invalid data size.-->
<AssociationResponse>
<ApplicationContextName Value="LN" />
<!--NO_REASON_GIVEN-->
<ACSEServiceUser Value="01" />
</ResultSourceDiagnostic>
<!--Error: Invalid data size.-->
<!--Error: Invalid data size.-->
<ConfirmedServiceError>
<Service Value="01" />
<ServiceError>
</AssociationResponse>
I'm not an expert in DLMS, so I'm struggling to understand what's going wrong. I understand that the client is trying to associate but the server is rejecting this request.
Any ideas that might help me debug this issue would be greatly appreciated.
Thanks!
Pablo
Hi Pablo, Use framing if…
Hi Pablo,
Use framing if possible. Plain PDU works only if all the bytes can be read at the same time. Try to change PDU to e.g. WRAPPER. Plain PDU doesn't tell how many bytes there should be or if the data is corrupted. There is no checksum, etc.
Let me know if that is not possible and I'll check what might cause this.
BR,
Mikko
Hello Kurumi, Thank you so…
Hello Kurumi,
Thank you so much for your response. The error was caused by an incorrect initialization of the COSEM objects. I had forgotten to call the createObjects() function that initialize them.
After fixing this, I was able to connect using GXDLMS Director and successfully read values from several objects.
Regarding the communication setup, I can't use standard HDLC framing. My DLMS server runs over PLC, and the only way the PLC manufacturer allows communication is by serializing the PRIME_API through a USI interface. I establish a 4-32 connection and encapsulate DLMS traffic inside the PDU of this connection.
This approach is currently working for me. I managed to make it work by slightly modifying the svr_handleRequest functions, passing the entire DLMS PDU in each call (I realized this was necessary after stepping through the code and analyzing how it processes requests).
That said, I haven’t yet studied all the inner workings of the Gurux library, so I'm not entirely sure if this solution is reliable or compliant.
Do you reccommend this modifications?
Thanks!
Pablo
Hi, Sending plain PDUs…
Hi,
Sending plain PDUs usually works without problems if your PLC can handle large PDUs.
I believe that everything works smoothly with a small PDU size. You need to try to implement a larger association view or read profile generic to check how well it works with a bigger PDU.
BR,
Mikko
Hello, My PLC can handle…
Hello,
My PLC can handle large PDUs, as it supports fragmentation. The only limitation is whether my microprocessor has enough memory to store large PDUs (RX or TX). For now, it does, but in the future, if the association view grows larger, it might not. I’ll keep this in mind for any future changes.
Thank you!
Pablo