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
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.
I can write it,
but it's not complete , is it related with timing ?
The output when reading
nfo> app: 7E0:
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: 07
nfo> app: AD
I want to write al 0xAD but only the end is AD ??
Code :
* Function uses the TWI interface to write data into EEPROM memory. * * @param addr Start address to write. * @param[in] pdata Pointer to data to send. * @param size Byte count of data to send. * @attention Maximum number of bytes that may be written is @ref EEPROM_SEQ_WRITE_MAX. * In sequential write, all data must be in the same page * (higher address bits do not change). * * @return NRF_SUCCESS or reason of error. * * @attention If you wish to communicate with real EEPROM memory chip, check its readiness * after writing the data. */ static ret_code_t eeprom_write(uint16_t addr, uint8_t const * pdata, size_t size) { ret_code_t ret; /* Memory device supports only a limited number of bytes written in sequence */ if (size > (EEPROM_SEQ_WRITE_MAX_BYTES)) { return NRF_ERROR_INVALID_LENGTH; } /* All written data must be in the same page */ if ((addr / (EEPROM_SEQ_WRITE_MAX_BYTES)) != ((addr + size - 1) / (EEPROM_SEQ_WRITE_MAX_BYTES))) { return NRF_ERROR_INVALID_ADDR; } do { nrf_delay_ms(25); uint8_t buffer[EEPROM_ADDRESS_LEN_BYTES + EEPROM_SEQ_WRITE_MAX_BYTES]; /* Addr + data */ memcpy(buffer, &addr, EEPROM_ADDRESS_LEN_BYTES); memcpy(buffer + EEPROM_ADDRESS_LEN_BYTES, pdata, size); ret = nrf_drv_twi_tx(&m_twi_master, EEPROM_ADDR, buffer, size + EEPROM_ADDRESS_LEN_BYTES, false); }while (0); return ret; } void eeprom_cmd_clear() { uint8_t clear_val = 0xAD; size_t addr; for (addr = 0; addr <EEPROM_SIZE; ++addr) { ret_code_t err_code; err_code = eeprom_write(addr, &clear_val, 1); if (NRF_SUCCESS != err_code) { NRF_LOG_INFO("communication error 24C16 By Rixtronix LAB.\r\n"); NRF_LOG_INFO("Error code %u",err_code); return; } NRF_LOG_INFO("CLEARING 24C16 By Rixtronix LAB...\r\n"); } NRF_LOG_INFO("FINISHED CLEARING 24C16 By Rixtronix LAB.\r\n"); }
What do I miss here ?
Thanks
#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.
i am also facing this issue now how would i solve
i am also facing this issue now how would i solve