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

Combine SAADC with ble_app_uart_c

I combined SAADC into the ble_app_uart_c example and got error once it got to scan_start();

"ble_scan: sd_ble_gap_scan_start returned 0x9"

If I put the scan_start() in comment, the SAADC is working periodically as it should.

I am using TIMER1=1 and TIMER0=0 based on previous posts.

Should I stop the scan before doing the SAADC?

If yes, how?

Parents
  • You can't use TIMER0 as it is required by the SoftDevice, use TIMER2 instead. 


  • It is still crashing

    If I remove the scan_init and scan_start, the SAADC works

    If I remove the SAADC - the scan works

    Here is my main:

    int main(void)
    {
    // Initialize.
    log_init();
    timer_init();
    uart_init();
    buttons_leds_init();
    db_discovery_init();
    power_management_init();


    // Start ADC sampling
    saadc_init();
    saadc_sampling_event_init();
    saadc_sampling_event_enable();


    ble_stack_init();
    gatt_init();
    nus_c_init();
    ble_conn_state_init();
    scan_init();

    // Start execution.
    printf("BLE UART central example started.\r\n");
    NRF_LOG_INFO("BLE UART central example started.");
    scan_start();

    // Enter main loop.
    for (;;)
    {
    idle_state_handle();
    }

Reply
  • It is still crashing

    If I remove the scan_init and scan_start, the SAADC works

    If I remove the SAADC - the scan works

    Here is my main:

    int main(void)
    {
    // Initialize.
    log_init();
    timer_init();
    uart_init();
    buttons_leds_init();
    db_discovery_init();
    power_management_init();


    // Start ADC sampling
    saadc_init();
    saadc_sampling_event_init();
    saadc_sampling_event_enable();


    ble_stack_init();
    gatt_init();
    nus_c_init();
    ble_conn_state_init();
    scan_init();

    // Start execution.
    printf("BLE UART central example started.\r\n");
    NRF_LOG_INFO("BLE UART central example started.");
    scan_start();

    // Enter main loop.
    for (;;)
    {
    idle_state_handle();
    }

Children
Related