3 Replies Latest reply on Sep 10, 2015 11:04 AM by MichaelF_56 Branched from an earlier discussion.

    BCM20736S NVRAM functions for External I2C EEPROM Device (con't)

    rajeshwisilica

      Hi Arvinds and ehoffman

       

      Per this thread: BCM20736S NVRAM functions for External I2C EEPROM Device

                We are trying to have our own OTA update scheme. For the purpose am trying to read/write a SS as well as DS area of the i2c EEPROM using APIs serEepromRead() and serEepromWrite(). In both cases the rAPI call returns fail. Do we need to do any initialization or where am wrong in calling the APIs. The shortage of documentation of the APIs make it hard to debug the issue.

       

      Sample code with which i was trying to access i2c EEPROM:

      Write operation:

       

            wv = 0xad;

            if(serEepromWrite((UINT16)0x001a, (UINT16)1, &wv, (UINT8)0x00))

            ble_trace0("EEPROM Write Fails!!!");

            else

            ble_trace0("EEPROM Write Succes");

       

      Read operation:

      if(serEepromRead((UINT16)0x0140, (UINT16)20, buf, (UINT8)0x00))

              ble_trace0("EEPROM Read Fails!!!");

       

      We are working with SDK 2.2.1.7

      In both cases it returns "failed".

      Any help is highly appreciable.

       

      Thanks and regards

       

      Rajesh Kumar V

        • 1. Re: BCM20736S NVRAM functions for External I2C EEPROM Device (con't)
          ehoffman

          Some initial thoughts: Is there a Write Protect line that needs to be turned of?  We had difficulty with some of the higher level API and went to using the CFA and I2C.h functions which work, but unfortunately are limited to 14 bytes per transaction. No support for page-write, so we have to write 10 times to output one page of data that should go in a single write.  90% waste.  Also, you may need to do your reads and writes in a loop and exit the loop only after the SUCCESS return code is received.  We have observed that the writes frequently do not return success on the first try.  It may be that the device just needs time to complete the write after it goes into it’s internally timed page write sequence.  I found in one case 20 writes in a loop failed but when I put a 1 msec delay between the writes, it succeeded after two or three tries.  I think this area of SDK could use some improvements but I think you should be able to get it to work.  Keep trying.

          • 2. Re: BCM20736S NVRAM functions for External I2C EEPROM Device (con't)
            MichaelF_56

            Thanks you for sharing your first hand experience with Rajesh Eric.

            • 3. Re: BCM20736S NVRAM functions for External I2C EEPROM Device (con't)
              MichaelF_56

              We spoke to the developers this afternoon and confirmed that the APIs serEepromRead() and serEepromWrite() are internal APIs and not designed to be used by customers.

               

              If you go to the sample OTA app /WICED-Smart-SDK/Apps/ota_secure_firmware_upgrade, focus on using the APIs described within  bleappfwu.h

               

               

              NOTE: Reading and writing to hex 140 is very dangerous.