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

iic error NRF_ERROR_NO_MEM with app_sched_event_put

hi 

i want to use iic in my project ,and i add iic func to my project refrence project twi_sensor.

the code of iic like this:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
i2c_config_t iic_config=
{
.scl_pin = I2C_CLK_PIN,
.sda_pin = I2C_SDA_PIN,
.freq = I2C_SPEED_400K,
};
void am_app_i2c_init (i2c_config_t i2c_config)
{
ret_code_t err_code;
nrf_drv_twi_frequency_t fre_table[]=
{
NRF_DRV_TWI_FREQ_100K,
NRF_DRV_TWI_FREQ_250K,
NRF_DRV_TWI_FREQ_400K,
};
const nrf_drv_twi_config_t twi_config = {
.scl = i2c_config.scl_pin,
.sda = i2c_config.sda_pin,
.frequency = fre_table[i2c_config.freq],
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I call the api in the main 

Fullscreen
1
2
3
port_i2c_init();
port_i2c_send(0xaa , data, 10);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

then compile and download the hex to the chip,but the log show like this:

Fullscreen
1
2
3
00> <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at ..\..\..\..\..\..\components\libraries\timer\app_timer2.c:181
00>
00> PC at: 0x0003817F
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

the code of app_timer2.c:181 is 

uint32_t err_code = app_sched_event_put(&timer_event,
sizeof(timer_event),
scheduled_timeout_handler);

some para like this:

#define NRF_QUEUE_ENABLED 1

#define SCHED_QUEUE_SIZE                    20                                         /**< Maximum number of events in the scheduler queue. */

i try change the  SCHED_QUEUE_SIZE   to 40 and change the ram ,it is  no effect. so what should i do to solve this problem ?