CH Tech EM405D User Manual

Page 24

Advertising
background image

18

Successful (0x00): The command completed successfully without error.

Invalid Command (0x01): The first byte received was not a valid command-id value from the
list in Table I.

Invalid Parameter (0x02): The EM405D received a valid command however the command could
not be completed because one of the command parameters was invalid or out of range. Refer to
the description of each individual command for parameter details.

Module Did Not Respond (0x03): The EM405D received a valid command with valid
parameters; however, the specified module did not respond to the access. This error code applies
to M-module accesses only. The error code could result from the specified M-module being
absent, the specified address being outside the range of addresses supported by the particular M-
module, or more serious hardware problems with the M-module itself.

Once any of the above status codes are returned, the EM405D will set the Reset Error (RERR)
status bit in the EM405D Reset Error and Manufacturer ID register (refer to section 4.3.5 for
details on this register) and cease responding to further commands except the Read Data and
Write Data commands to the Reset Error and Manufacturer ID register. To recover from this
condition, the user must clear the RERR bit by writing a ‘1’ to that bit location in the Reset Error
and Manufacturer ID
register.

This functionality is implemented so that when the EM405D recognizes an error at the beginning
of a command, it can search the buffer for the next command without having to send a status
code response for each byte remaining in the buffer. For example, assume this functionality
didn’t exist and the user wanted to perform a block write with a 1024 byte block. The full
command for this action, including data, requires 1033 bytes to be placed into the EM405D’s
buffer. If the third byte in the command is an invalid parameter, the EM405D would return an
Invalid Parameter (0x02) status code followed by one thousand and thirty Invalid Command
(0x01) status codes, one for each byte in the buffer after the invalid parameter. By implementing
this functionality, the EM405D will ignore the one thousand and thirty bytes and any following
bytes in the buffer unless the command is a Read Data or Write Data of the Reset Error and
Manufacturer ID
register or until the RERR bit is reset to ‘0’.

The software must be written such that it checks for error conditions and performs the
appropriate action to reset the RERR bit. In most cases error conditions are generated by
errors in the software source code, therefore, once the software has been debugged and
verified, error codes will rarely, if ever be received.

Advertising