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

Can I use NUS service without having the UART pins configured/connected?

Hello,

I want to use the NUS service on my BLE communication. I don't have pins connected for UART, do I need to have them? When I try to run the device, my program initializes all the blocks being used (bsp, uart, spi, ble_stack, etc) and when it tries to print after all the initialization it goes to the app_error. Which is weird because before I also have some prints that are passed by.

Hope someone can help me, using nrf51 on a custom board with SD130v2.1.

edit1: I tried to debug the error, and it's saying that the error is the 0x0000000C caused on line 690 (function : uart_event_handle, case : APP_UART_COMMUNICATION_ERROR) which has the following code:

APP_ERROR_HANDLER(p_event->data.error_communication);

Thank you, Jorge

Parents
  • Generally This problem comes when you use any printf() or app_uart_put() before calling uart_init() one try to check is there any such statements either in main or in other source files

  • my main :

    int main(void)
    {
    	bool erase_bonds;
    
        // Initialize.
    	APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    	
    	init_all(erase_bonds);
    

    and the init_all function:

    static void init_all(bool bonds)
    {
    	uart_init();
    	//printf("[MAIN : INIT] uart_init() -> ok\r\n");
    	buttons_leds_init(&bonds);
    	//printf("[MAIN : INIT] buttons_led_init() -> ok\r\n");
    	ble_stack_init();
    	//printf("[MAIN : INIT] ble_stack_init() -> ok\r\n");
    	gap_params_init();
    	//printf("[MAIN : INIT] gap_params_init() -> ok\r\n");
    	conn_params_init();
    	//printf("[MAIN : INIT] conn_params_init() -> ok \r\n");
    	services_init();
    	//printf("[MAIN : INIT] services_init() -> ok \r\n");
    	advertising_init();
    	//printf("[MAIN : INIT] advertising_init() - > ok\r\n");
    	spi_init();
    	//printf("[MAIN : INIT] spi_init() -> ok\r\n");
    	nrf_delay_ms(500);
    	//printf("[MAIN : INIT] Every module ok.\r\n");	
    		
    }
    

    so the first initialization is the uart module. And I even comented all the printf from my software, because they were only for debug purposes.

Reply
  • my main :

    int main(void)
    {
    	bool erase_bonds;
    
        // Initialize.
    	APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    	
    	init_all(erase_bonds);
    

    and the init_all function:

    static void init_all(bool bonds)
    {
    	uart_init();
    	//printf("[MAIN : INIT] uart_init() -> ok\r\n");
    	buttons_leds_init(&bonds);
    	//printf("[MAIN : INIT] buttons_led_init() -> ok\r\n");
    	ble_stack_init();
    	//printf("[MAIN : INIT] ble_stack_init() -> ok\r\n");
    	gap_params_init();
    	//printf("[MAIN : INIT] gap_params_init() -> ok\r\n");
    	conn_params_init();
    	//printf("[MAIN : INIT] conn_params_init() -> ok \r\n");
    	services_init();
    	//printf("[MAIN : INIT] services_init() -> ok \r\n");
    	advertising_init();
    	//printf("[MAIN : INIT] advertising_init() - > ok\r\n");
    	spi_init();
    	//printf("[MAIN : INIT] spi_init() -> ok\r\n");
    	nrf_delay_ms(500);
    	//printf("[MAIN : INIT] Every module ok.\r\n");	
    		
    }
    

    so the first initialization is the uart module. And I even comented all the printf from my software, because they were only for debug purposes.

Children
No Data
Related