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
from this code,
err_code = eeprom_write(addr, &clear_val, 1);
if (NRF_SUCCESS != err_code)
{
NRF_LOG_INFO("communication error 24C16.\r\n");
return;
}
how can I print out err_code ?
NRF_LOG_INFO("%u",err_code); ?
I got
nfo> app: Error code 33281
what's the meaning ?
The error code corresponds to NRF_ERROR_DRV_TWI_ERR_ANACK, which indicates that it received a NACK when it tried to address the sensor. There can be several reasons for this to happen. You should probably verify the communcation with the TWI scanner example first, as Awneil suggested.
TWI scanner result :
I can not see 24C16 address
Is it conflict between my LCD and 24C16 ?
TWI scanner result :
I can not see 24C16 address
Is it conflict between my LCD and 24C16 ?
Is it conflict
As always, it's important to start simple; solve one problem at a time - don't leap straight into a whole pile of potential problems!
https://www.avrfreaks.net/forum/help-it-doesnt-work
So start with just the EEPROM on the bus - nothing else.
#define EEPROM_SEQ_WRITE_MAX_BYTES 200 #define EEPROM_ADDR 0x50 #define EEPROM_ADDRESS_LEN_BYTES 2 #define EEPROM_SIZE (2048u) //!< 24C16 EEPROM size. #define MASTER_TWI_INST 0 //!< TWI interface used as a master accessing EEPROM memory. #define IN_LINE_PRINT_CNT (16u) //!< Number of data bytes printed in a single line.