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

unable to write to and read from a FRAM using i2c in nrf52 sdk 11

Hi,

I am a beginner in ble and I am trying to understand the technology. I am trying to write to and read from FM24W256 FRAM through I2C. The reference I have considered is the example of TWI_sensor from sdk11.

The configuration is NRF_DRV_TWI_DEFAULT_CONFIG(0) and I have disabled TWI_handler. I am receiving error code 3 every time I try to write to FRAM. I will paste the major part my code here. Kindly suggest to me where are am I going wrong.

/* written in main. code to write to FRAM device*/

#define ADDR_24LC02 0xA0

.

.

FRAM_Address_LSB = addr & 0x00FF;
FRAM_Address_MSB = addr>>8;
FRAM_data[0] = FRAM_Address_MSB;
FRAM_data[1] = FRAM_Address_LSB;
FRAM_data[2]=data;

err_code=nrf_drv_twi_tx(&m_twi_fram_i2c,ADDR_24LC02,FRAM_data,sizeof(FRAM_data),true); /*writes data to FRAM*/
APP_ERROR_CHECK(err_code);
rxd_data = Read_Test_FRAM_I2C(addr);

////*Function to read data from FRAM*////

uint8_t Read_Test_FRAM_I2C(uint8_t FRAM_Address)
{
uint8_t rd_data;
ret_code_t err_code;

ADDR_24LC02_read = (ADDR_24LC02|0x01);


err_code = nrf_drv_twi_tx(&m_twi_fram_i2c,ADDR_24LC02,&FRAM_Address,2,true);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_twi_rx(&m_twi_fram_i2c,ADDR_24LC02_read,&rd_data,1);
APP_ERROR_CHECK(err_code);
return rd_data;

}

Parents Reply Children
No Data
Related