Hello all,
I am using the latest SDK 15 and softdevice v5 (downgraded from v6 thought it was causing issues) on the NRF52 DK. When I build my application it states:
Compiling ‘nrf_sdh_soc.c’
Compiling ‘nrf_sdh_ble.c’
Compiling ‘nrf_sdh.c’
Output/Release/Exe/ble_app_uart_pca10040_s132.elf does not exist.
Linking ble_app_uart_pca10040_s132.elf
Output/ble_app_uart_pca10040_s132 Release/Obj/main.o: In function `saadc_sampling_event_init':
undefined reference to `nrfx_ppi_channel_alloc'
undefined reference to `nrfx_ppi_channel_assign'
Output/ble_app_uart_pca10040_s132 Release/Obj/main.o: In function `saadc_sampling_event_enable':
undefined reference to `nrfx_ppi_channel_enable'
Build failed
I brought over into the nRF drivers folder on Segger the same files that are in the SAADC example e.g. nrf_drv_ppi.c , etc.I enabled PPI in both places in the sdk_config.h file, but I can't seem to fix the issue. Any ideas would be appreciated. For context I'm going to be storing the SAADC values in a circular buffer on flash, so if the user disconnects from the BLE device when they reconnect it will dump the values out to them via UART. When they are connected it will simply use characteristic to send them the latest ADC values.
Here is the top of my code with import statements:
#include <stdint.h> #include <string.h> // saadc #include <stdbool.h> #include <stdio.h> #include "nrf_drv_saadc.h" #include "nrf_drv_ppi.h" #include "nrf_drv_timer.h" #include "boards.h" #include "app_error.h" #include "nrf_delay.h" #include "nordic_common.h" #include "nrf.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 "ble_nus.h" #include "app_uart.h" #include "app_util_platform.h" #include "bsp_btn_ble.h" #include "nrf_pwr_mgmt.h" #if defined (UART_PRESENT) #include "nrf_uart.h" #endif #if defined (UARTE_PRESENT) #include "nrf_uarte.h" #endif #include "nrf_log.h" #include "nrf_log_ctrl.h" #include "nrf_log_default_backends.h" #define APP_BLE_CONN_CFG_TAG 1 /**< A tag identifying the SoftDevice BLE configuration. */ #define DEVICE_NAME "Nordic_UART" /**< Name of device. Will be included in the advertising data. */ #define NUS_SERVICE_UUID_TYPE BLE_UUID_TYPE_VENDOR_BEGIN /**< UUID type for the Nordic UART Service (vendor specific). */ #define APP_BLE_OBSERVER_PRIO 3 /**< Application's BLE observer priority. You shouldn't need to modify this value. */ #define APP_ADV_INTERVAL 256 /**< The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */ #define APP_ADV_DURATION 0 /**< The advertising duration (180 seconds) in units of 10 milliseconds. */ #define MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */ #define MAX_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */ #define SLAVE_LATENCY 0 /**< Slave latency. */ #define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */ #define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */ #define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(30000) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */ #define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */ #define DEAD_BEEF 0xDEADBEEF /**< Value used as error code on stack dump, can be used to identify stack location on stack unwind. */ #define UART_TX_BUF_SIZE 256 /**< UART TX buffer size. */ #define UART_RX_BUF_SIZE 256 /**< UART RX buffer size. */ #define TX_POWER_LEVEL -8 /**< TX Power Level value. This will be set both in the TX Power service, in the advertising data, and also used to set the radio transmit power. */ BLE_NUS_DEF(m_nus, NRF_SDH_BLE_TOTAL_LINK_COUNT); /**< BLE NUS service instance. */ NRF_BLE_GATT_DEF(m_gatt); /**< GATT module instance. */ NRF_BLE_QWR_DEF(m_qwr); /**< Context for the Queued Write module.*/ BLE_ADVERTISING_DEF(m_advertising); /**< Advertising module instance. */ static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */ static uint16_t m_ble_nus_max_data_len = BLE_GATT_ATT_MTU_DEFAULT - 3; /**< Maximum length of data (in bytes) that can be transmitted to the peer by the Nordic UART service module. */ static ble_uuid_t m_adv_uuids[] = /**< Universally unique service identifier. */ { {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE} }; #define SAMPLES_IN_BUFFER 5 volatile uint8_t state = 1; static const nrf_drv_timer_t m_timer = NRF_DRV_TIMER_INSTANCE(1); static nrf_saadc_value_t m_buffer_pool[2][SAMPLES_IN_BUFFER]; static nrf_ppi_channel_t m_ppi_channel; static uint32_t m_adc_evt_counter;
Main code:
/**@brief Application main function. */ int main(void) { bool erase_bonds; // Initialize. uart_init(); log_init(); timers_init(); buttons_leds_init( & erase_bonds); power_management_init(); ble_stack_init(); sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); //sd_power_mode_set(NRF_POWER_MODE_LOWPWR); gap_params_init(); gatt_init(); services_init(); advertising_init(); conn_params_init(); // Start execution. printf("\r\nUART started.\r\n"); NRF_LOG_INFO("Debug logging for UART over RTT started."); advertising_start(); tx_power_set(); // bring online saadc saadc_init(); saadc_sampling_event_init(); saadc_sampling_event_enable(); // Enter main loop. for (;;) { NRF_UART0 -> TASKS_STARTRX = 1; NRF_UART0 -> TASKS_STARTTX = 1; NRF_UART0 -> ENABLE = 1; ret_code_t err_code; err_code = ble_nus_data_send( & m_nus, 0x08, 0x01, m_conn_handle); if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY) && (err_code != NRF_ERROR_NOT_FOUND)) { APP_ERROR_CHECK(err_code); } NRF_UART0 -> TASKS_STOPTX = 1; NRF_UART0 -> TASKS_STOPRX = 1; NRF_UART0 -> ENABLE = 0; idle_state_handle(); } }
Functions are the same as the SAADC example.