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

fatfs causes ble_app_uart code to reset

Hi, 

I'm using the ble_app_uart example as a starting point for my project. Basically I want to program the nRF52 DK to receive data from another device via UART, store them in an SD card every few seconds and then send the data via BLE every minute or so. I successfully wrote data to the SD card whenever the uart_event_handle is called. I created an app_timer_handler so that I can read data from SD card every 60th second and send it via BLE. I used a variable toggle_index and printed that variable at every app_timer ticks and I realised that the variable value resets to my initial value which is 1 after 43. I commented out the function that I used to write data to the SD card (fatfs_send_data()) and the toggle_index value did not reset, seems like the issue is with my fatfs_send_data() function. I realised that the code resets itself after toggle_index = 43. I'm wondering why calling fatfs will somehow cause the code to reset. 

I'm using SoftDevice 140. The main code and the results are shown below. 

Thanks

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdint.h>
#include <string.h>
#include "nordic_common.h"
#include "nrf.h"
#include "ff.h"
#include "diskio_blkdev.h"
#include "nrf_block_dev_sdc.h"
#include "ble_hci.h"
#include "ble_advdata.h"
#include "ble_advertising.h"
#include "ble_conn_params.h"
#include "nrf_sdh.h"
#include "nrf_sdh_soc.h"
#include "nrf_sdh_ble.h"
#include "nrf_ble_gatt.h"
#include "nrf_ble_qwr.h"
#include "app_timer.h"
#include "nrf_drv_rtc.h"
#include "nrf_drv_clock.h"
#include "ble_nus.h"
#include "app_uart.h"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX