Read memory by Address - Read more than 255 bytes

4.1k Views Asked by At

I want to read around 336 bytes of data from NVRAM using Read Memory By Address UDS service. The command I am giving is "23 22 1C 22 01 50", where

  1. 0x23 - UDS command for Read Memory By Address
  2. 0x22 - Address and Length Format Identifier (Memory address parameter - 2 and Memory size parameter 2)
  3. 0x1C 0x22 - Memory Address in 2 bytes
  4. 0x01 0x50 - Data length to read in 2 bytes (length is 336 bytes)

When I submit the command, I am getting "0x13 Incorrect Message Length or Invalid Format Error".

Can someone help me fixing this problem. Thanks in advance.

Reference: https://piembsystech.com/uds-protocol/

1

There are 1 best solutions below

0
On

What NRC 0x13 means

According to ISO 14229-1:2020: NRC 0x13

This means:

  • SID 0x23 is supported by the server otherwise you would receive NRC 0x11 serviceNotSupported
  • Your request has inproper format (it is either too long or too short), in other cases you would receive other NRC (e.g. 0x31 requestOutOfRange). I suspect that address value is not 2 bytes long. It might be 4 bytes long (it depends on the memory type and size), but it is just a guess.

How to send the request properly

Well we do not know what is the exact format that the server accepts (it depends on memory of the server), but the ISO 14229-1:2020 define SID 0x23 request format as below: request 0x23 format

I would try following request:

  • 0x22 0x44 0x00 0x00 0x1C 0x22 0x00 0x00 0x01 0x50

where:

  • 0x00 0x00 0x1C 0x22 - 4-byte memoryAddress
  • 0x00 0x00 0x01 0x50 - memorySize (it is also 4 byte to make sure that addressAndLengthFormatIdentifier is properly interpreted by the server)

Other options

Server might have defect(s) (especially if you succesfully read memory using 2-byte-long address) and incorrectly display NRC 0x13 or have only support for certain value of addressAndLenghtFormatIdentifier. It is hard to judge with 100% certainty though. You would have provide at least one request with positive response. Please do so in the comment and I am going to guide you through the problem.