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

BLE_App_Uart + ADC + PWM

Hi everyone.

I know this is gonna be a long story, thank you for your patience...

I have successfully utilized a few examples in the SDK15.3 directory on my PCA10056 including the PWM driver, BLE_APP_UART and SAADC.

Also I could merge the PWM driver example and the BLE_APP_Uart.

now that I have tried to add the SAADC example to my code, everything stops working, e.g. all the LEDs that are controlled by the buttons and the PWM driver and the UART output on my terminal... only a blank line is added on each loop. (neither log or printf work).

the code is built and flashed on the core successfully without any errors.

when I try to debug my code using Keil5 it shows that the program stops somewhere like "NRF_BREAKPOINT_COND", I am not aware what it is for. Here it is:

The code is quite large in the main.c file but as its built without any error I only add main function here:

int main(void)
{
    bool erase_bonds;
uint32_t err_code;

    // Initialize.
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();
			//mig//
			printf("\r\n  .UART + PWM Periph \r\n");
	    printf("\r\nUART started.\r\n");

//	    uint32_t err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_DEFAULT_BACKENDS_INIT();

    ret_code_t ret_code = nrf_pwr_mgmt_init();
    APP_ERROR_CHECK(ret_code);

    saadc_init();
    saadc_sampling_event_init();
    saadc_sampling_event_enable();
    NRF_LOG_INFO("SAADC HAL simple example started.");

	
	   //init app_button module, 50ms detection delay (button debouncing)
    err_code = app_button_init((app_button_cfg_t *)app_buttons,
                                   NUM_OF_BUTTONS,
                                   APP_TIMER_TICKS(50));//, APP_TIMER_PRESCALER));
    APP_ERROR_CHECK(err_code);

    err_code = app_button_enable();
    APP_ERROR_CHECK(err_code);
	
    // Start execution.
  
    NRF_LOG_INFO("Debug logging for UART over RTT started.");
    advertising_start();
		    pwm_init();

    pwm_update_duty_cycle(DS);
    //demo2();
    // Enter main loop.
    for (;;)
    {
				nrf_delay_ms(300);
			  printf("\r\nLoop.\r\n");
	  		NRF_LOG_FLUSH();

        nrf_pwr_mgmt_run();
        
    }
}

Related