NRF52832 EEPROM使用总结
协议栈版本:nRF5_SDK_15.2.0
根据项目需要,最近使用了M24512作为存储设备,将eeprom操作记录以便提醒。
众所周知EEPROM为IIC通信,在52832中被叫为TWI。
1.初始化:
1.首先要进行通道选择:NRF_DRV_TWI_INSTANCE(sdk_config.h)
2.再进行参数配置
const nrf_drv_twi_t eep_twi = NRF_DRV_TWI_INSTANCE(0); //For EEP
void twi_eepinit (void)
{
ret_code_t err_code;
const nrf_drv_twi_config_t twi_eep_config = {
.scl = 11,//EEP_SCL_PIN
.sda = 12,//EEP_SDA_PIN
.frequency = NRF_DRV_TWI_FREQ_100K,
.interrupt_priority = APP_IRQ_PRIORITY_HIGH,
.clear_bus_init = false
};
err_code = nrf_drv_twi_init(&eep_twi, &twi_eep_config, twieep_handler, NULL);
APP_ERROR_CHECK(err_code);
nrf_drv_twi_enable(<