Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Assert in function nrfx_saadc_abort() in nRF5_SDK_15.3.0_59ac345

Dear Nordic Support,

I follow this SAADC example to calibrate the SAADC every SAADC_CALIBRATION_INTERVAL.

However, whenever the function nrfx_saadc_abort() is called, it always asserts at these lines of code: 

Fullscreen
1
2
3
4
// Wait for ADC being stopped.
bool result;
NRFX_WAIT_FOR((m_cb.adc_state == NRF_SAADC_STATE_IDLE), HW_TIMEOUT, 0, result);
NRFX_ASSERT(result);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

I tried debugging and I found that the m_cb.adc_state only in NRF_SAADC_STATE_IDLE after the initialization and then it is always busy.

I have 2 SAADC channels they are working with the PPI and TIMER. Every 10ms, the TIMER triggers the SAADC event. I am using nRF5_SDK_15.3.0_59ac345 with my nRF52840-DK.

For more details, I attached my code in following file: main.cperipherals.h and peripherals.c.

Fullscreen
1
2
3
<error> app: ERROR 3735928559 [Unknown error code] at D:\Projects\torquevault_torquedevicesfw\torque_wrench\nRF5_SDK_15.3.0_59ac345\modules\nrfx\drivers\src\nrfx_saadc.c:594
PC at: 0x0002647F
<error> app: End of error report
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thank you and best regards,

            Duy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* Copyright (c) 2014 - 2019, 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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "peripherals.h"
#include "boards.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "TT_Config.h"
/* DEFINES */
#define SAADC_TIMER_INSTANCE 1
#define EEPROM_TWI_INSTANCE 1
#define OLED_SPI_INSTANCE 0
/* TIMER instances */
static const nrf_drv_timer_t SAADC_TIMER = NRF_DRV_TIMER_INSTANCE(SAADC_TIMER_INSTANCE); /**< ADC timer. */
static const nrf_drv_timer_t BATTERY_TIMER = NRF_DRV_TIMER_INSTANCE(2); /**< Battery timer. */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5428.peripherals.h