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

ERROR 4 [NRF_ERROR_NO_MEM] after few twi sensor readings

Project Zip: beacon_lis2dh.zip

Following is my setup:

  • Board : NRF52832 by Sparkfun(Link) - Added pull-up resistor for TWI
  • Sensor: LIS2DH12(Custom breakout)
  • IDE: Segger Studio
  • Power Supply: 3.3V 1A

Project Goal:

  • Beacon mode that switches between predefined UUIDs at regular interval or at an event
  • Interface with LIS2DH and pass the x, y, z values in MAJOR, MINOR for the specified advertising UUID

Problem:  The device can read lis2dh sensor (I am not sure if the readings are correct. I would like to request for help here). The Beacon advertisement is also working as the way as it should. After running for few seconds, advertisement stops and sensor reading also stops with ERROR 4. Given below is the debug log.

Note: LIS2DH library used is the default one that comes with SDK_17.0.2 found at ../components/drivers_ext/lis2dh12

Debug Terminal Log:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<info> app_timer: RTC: initialized.
<error> app: Major: 1, 2
<error> app: Minor: 3, 4
<info> app: Beacon example started.
<info> app: update_maj_min_timer_handler
<info> app: update_major_minor(); Major: 1, 2
<info> app: update_major_minor(); Minor: 3, 4
<info> app: Update Accl Timer
<info> app: 0 0 0
<info> app: 0 0 0
<info> app: 17392 3 3
<info> app: 6 22 0
<info> app: 255 0 0
<info> app: update_maj_min_timer_handler
<info> app: update_major_minor(); Major: 1, 3
<info> app: update_major_minor(); Minor: 3, 4
<info> app: Update Accl Timer
<info> app: 0 0 0
<info> app: 0 0 0
<info> app: 17392 3 3
<info> app: 6 59 0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Main.c

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Copyright (c) 2014 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX