According to IEC 61375-2-3 (A6.5, Table A.3) the datasetLength is set to the actual length of the dataset without any padding bytes. The length of the dataset within the PD-PDU must be a multiple of 4 octect. If the user data length is not a multiple of 4 octets, octets with a value of 0 (zero) should be appended until a multiple of 4 octets is reached (padding bytes).
Currently the dataset is transmitted without any padding bytes.
Solution:
The return value of trdp_packetSizePD must be calculated by the PD_HEADER + datasize + padding_bytes. The datasetLength remains the same (datasize).
Padding was removed when the data FCS was discarded. Actually padding at the end of a payload makes no sense anymore.
But because it is in the standard, we re-introduced it...