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

UART issue after BOOTLOADER JUMP

we wrote a small application to jump to a desired address of our application from bootloader , but UART does not seem to work(i cannot see any transmitted values on terminal) once the application is started by the bootloader ,

is it something to do with transferring the vector table from bootloader to main application?

  • Are you referring to the Nordic UART Service or the hardware UART peripheral? If its the latter, did you initialized the UART peripheral in the minimal bootloader(small application) before you jumped to the main application? If you debug the application, do you get any error codes from the function calls (app_uart_put(), app_uart_get() nrf_drv_uart_tx etc)?

  • i have initialized UART peripheral in bootloader application.Then i checked error code for uart_fifo_init(0,app_uart_put().I received error code as 0.But still program dose not transmit anything as i get nothing on terminal window. It seems UART interrupt is not working .what do you say? I think probably it is problem of interrupt vector table transfer.If yes, how can we transfer it to the application?

  • Make sure that you, uninitialize the UART peripheral using app_uart_close() before you call nrf_bootloader_app_start, see below, which will enable the SoftDevice and forward interrupts to the application.

    void nrf_bootloader_app_start(uint32_t start_addr)
    {
        NRF_LOG_INFO("Running nrf_bootloader_app_start with address: 0x%08x\r\n", start_addr);
    
    #if defined(BLE_STACK_SUPPORT_REQD))
        uint32_t err_code;
    
        //NRF_LOG_INFO("Initializing SD in mbr\r\n");
        err_code = nrf_dfu_mbr_init_sd();
        if(err_code != NRF_SUCCESS)
        {
            NRF_LOG_INFO("Failed running nrf_dfu_mbr_init_sd\r\n");
            return;
        }
    
    #endif
    
        // Disable interrupts
        NRF_LOG_INFO("Disabling interrupts\r\n");
    
        NVIC->ICER[0]=0xFFFFFFFF;
    #if defined(__NRF_NVIC_ISER_COUNT) && __NRF_NVIC_ISER_COUNT == 2
        NVIC->ICER[1]=0xFFFFFFFF;
    #endif
    
    #if defined(BLE_STACK_SUPPORT_REQD))
        // Set the sd softdevice vector table base address
        NRF_LOG_INFO("Setting SD vector table base: 0x%08x\r\n", start_addr);
        err_code = sd_softdevice_vector_table_base_set(start_addr);
        if(err_code != NRF_SUCCESS)
        {
            NRF_LOG_INFO("Failed running sd_softdevice_vector_table_base_set\r\n");
            return;
        }
    #endif
    
        // Run application
        nrf_bootloader_app_start_impl(start_addr);
    }
    
  • Thanks the above code works like a charm .although due to some other issues i could not try the uart_close() option , hence still need to try that out

Related