Dear Members,
Where can I find from software development kit the example for writing and reading from I2C EEPROM ?
Thanks
Dear Members,
Where can I find from software development kit the example for writing and reading from I2C EEPROM ?
Thanks
An I2C EEPROM neither knows nor cares what microcontroller you use; all it sees is the transactions on the I2C bus - Start Conditions, Addressing, Stop Conditions; ACK/NAK, etc.
The Nordic SDK examples show you how to use the I2C (aka "TWI") hardware in the nRF52 - ie how to address a Slave, Read, and Write.
So you use the basic functions, together with the datasheet of your EEPROM, to generate the I2C transactions that the EEPROM requires.
For examples, see:
There are 4 TWI examples
which one is the closest application with I2C EEPROM ?
This one
nRF5_SDK_17.0.2_d674dde\examples\peripheral\twi_master_with_twis_slave\pca10056\blank\arm5_no_packs ?
thanks
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.
do i need pull up resistor on SCL and SDA on 24C16 ? thanks
do i need pull up resistor on SCL and SDA on 24C16 ? thanks
You need pullups somewhere on the I2C bus - this is a basic requirement for any I2C bus.
still can not see 24C16 address on TWI scanner, is my supply to low ? I checked, VCC=2.4V ?
Have you used an oscilloscope or analyser to see what's happening on the wires?
Ok, I'll see with analyzer and posted, thanks
I reckon, I have insufficient power for this 24C16 PU27, I will try with external 3.3V, I keep posted, thanks