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();
        
    }
}

Parents Reply
  • Neuro_Rouh said:
    I have posted the main.c in my previous replies, here is the code around line 1074, its actually an error process call function and before that, we have conn_param_init()

    But what function assigned the error code that was sent to APP_ERROR_CHECK()?
     

    Neuro_Rouh said:
    And something more, I have checked the link You sent about hardware restrictions when utilizing softdevice, it says even "NVIC"  module is not available! that may be the root of my problem, because I didnt change anything about it when adding the "SAADC" example to the BLE example. seems like there are many issues for joining non-BLE examples to a BLE example...

    That won't be a problem as long as the SAADC driver is configured with an interrupt priority of 6 or 7 (default is 6 I think). So if you've just merged the SAADC example, with the same sdk_config.h settings then you're fine. 

Children
Related