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

NACK from i2c slave

Hello Everyone,

          I am Using Nrf51822 module and s130_nrf51_2.0.1_softdevice . my actual function nrf51822 twi interface with stc3115 Gas gauge IC .read the battery voltage .i upload the twi_scanner . 

my output is TWI device detected at address 0x70  and then i read stc3115 id (address = 0x18 ) . i received err_code = 0x8021(Nack).

please help to correct my error

This is my code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include "boards.h"
#include "app_util_platform.h"
#include "app_error.h"
#include "nrf_drv_twi.h"
#include "stc3115_Driver.h"
#define NRF_LOG_MODULE_NAME "APP"
#include "nrf_delay.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_internal.h"
#include "SEGGER_RTT.h"
//#include "nrf_drv_timer.h"
/* TWI instance ID. */
#define TWI_INSTANCE_ID 0
#define DEBUG
/* Number of possible TWI addresses. */
#define TWI_ADDRESSES 127
/* TWI instance. */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX