1 Reply Latest reply on Apr 26, 2018 2:26 AM by SampathS_11

    Receiving NAK when writing block to EEPROM CY8C9560A / CY8C9540A / CY8C9520A

      I'm a bit stuck programming the "save to eeprom" functionality of the CY8C9560A. Since the command value 0x01 is broken (per datasheet errata), I am trying to replicate that functionality with commands 0x06 (read device configuration) and 0x03 (write configuration to EEPROM). Here's my status so far:

       

      - I have two I2C objects (addresses 0x20 and 0x50 for the volatile and EEPROM device functions, respectively). I am able to connect to the EEPROM I2C address after enabling it using the enable register (0x2D).

       

      - I have successfully read out the 146-byte configuration information by reading the command register 0x30, setting command 0x06 to read the device configuration, then reading the 146 byte payload and checking the CRC. That works fine, and I get the configuration values that I expect to get. In fact, all single-register reads and writes are working great, so this "save" functionality is the only missing piece.

       

      - When I try to write this data back to EEPROM, the device doesn't ACK, which indicates the packet is malformed or the CRC check failed. But I don't see what the issue is. The packet I'm sending is the following, and I'm writing it to the volatile I2C device (address 0x20). I have also tried writing it to the EEPROM address (0x50), but that doesn't work either.

       

      COMMAND = 0x30

      COMMAND_VAL_WRITE_EEPROM_CONFIG = 0x03

      PAYLOAD = <146 bytes read out from device>

      CRC = 0x00 ^ PAYLOAD[0] ^ PAYLOAD[1] ^ ... ^ PAYLOAD[145]

       

      COMMAND, COMMAND_VAL_WRITE_EEPROM_CONFIG, PAYLOAD, CRC