This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

writing and reading from I2c eeprom ?

Dear Members,

Where can I find from software development kit the example for writing and reading from I2C EEPROM ?

Thanks

Parents Reply Children
  • I'm using :

    nRF5_SDK_17.0.2_d674dde\examples\peripheral\twi_master_with_twis_slave

    Please verify me ,

    #define EEPROM_SIM_SIZE                   (2048u) //!< 24C16 EEPROM size

    or 16384 ?

    //#define EEPROM_SIM_ADDR                   0x50    //!< Simulated EEPROM TWI slave address.
    #define EEPROM_SIM_ADDR                   0xA0    //!< AT24C16 EEPROM TWI slave address.

    //#define EEPROM_SIM_SCL_S         31   //!< Slave SCL pin. <====Originnaly
    //#define EEPROM_SIM_SDA_S         30   //!< Slave SDA pin.

    #define EEPROM_SIM_SCL_S         27   //!< Slave SCL pin.
    #define EEPROM_SIM_SDA_S         26   //!< Slave SDA pin.

    Do I need to define WP (write protect) of 24C16, if I don't want to protect it ?

    What does it mean by :

    #define EEPROM_SIM_TWIS_INST     1    //!< TWIS interface used by EEPROM simulator.

    ?

    is it possible to change it to TWI0, because port I use in my board is TWI0, I don't use TWIS

    Currently my board is using :

    // Arduino board mappings
    #define ARDUINO_SCL_PIN             27    // SCL signal pin
    //#define ARDUINO_SCL_PIN             NRF_GPIO_PIN_MAP(0,27)
    #define ARDUINO_SDA_PIN             26    // SDA signal pin
    //#define ARDUINO_SDA_PIN             NRF_GPIO_PIN_MAP(0,26)
    #define ARDUINO_AREF_PIN            2     // Aref pin

    How can I adapt it ?

    I saw 2 defines at

    eeprom_simulator_init();

    and

    err_code = twi_master_init();

    thanks

  • I got :

    [1;37m[1;32muart_cli:~$ [1;37meeprom clear
                                     
    [1;31mcommunication error
                                                        
    [1;37m[1;32muart_cli:~$ [1;37meeprom clear
                                     
    [1;31mcommunication error
                                                        
    [1;37m[1;32muart_cli:~$ [1;37m                                               
                                             

    what do I miss ? I use a real 24C16 chip

  • Is that what you're actually seeing on your terminal?

    You need to remove the escape sequences to make that legible.

    you should start with the TWI Scanner to verify your hardware connections, and Slave Address
  • on TWI scanner, I can not find 0xA0, which is 24C16, what do I miss ?


    nfo> app: TWI scanner started.
                                                   

    nfo> app: TWI device detected at address 0x3C.
                                   

    nfo> app: TWI device detected at address 0x50.
                                   

    nfo> app: TWI device detected at address 0x51.
                                   

    nfo> app: TWI device detected at address 0x52.
                                   

    nfo> app: TWI device detected at address 0x53.
                                   

    nfo> app: TWI device detected at address 0x54.
                                   

    nfo> app: TWI device detected at address 0x55.
                                   

    nfo> app: TWI device detected at address 0x56.
                                   

    nfo> app: TWI device detected at address 0x57.
              

Related