Secure bootloader ble with UART

HI currently  i am utilizing sdk ver 17.1.10  nrf52840 s140 we are using dfu/secure_bootloader/pca10056_ble app and i need to add UART app to it so that so we need both bootloader ble  advertiser and with UART added to it   currently we have added UART to it but whenever we call app_uart_put() function it was unable to advertise if we comment this function it is advertising as dfuTarg can you suggest me any steps to add uart to the secure bootloader /ble so that both peripheral can be utilized f it is possible NOTE: We referred secure bootloader /pca10056_uart  example but in this sdk it will not advertise so we need both advertiser + Uart 

Parents
  • Hello,

    It should be possible to add uart to the BLE bootloader. But the way it is added in the bootloader is a bit strange.

    If you look at nrf_dfu_serial_uart.c, line 86:

    DFU_TRANSPORT_REGISTER(nrf_dfu_transport_t const uart_dfu_transport) =
    {
        .init_func  = uart_dfu_transport_init,
        .close_func = uart_dfu_transport_close,
    };

    So simply by including this file, uart will be added as a DFU transport layer. This is then fetched by nrf_dfu_transports_init() in nrf_dfu_transport.c.

    So it should be a matter of adding nrf_dfu_serial_uart.c (and including the folder that contains nrf_dfu_serial.h), and try to build. If it complains about lacking functions/files, then keep adding until it builds without warnings/errors.

    Best regards,

    Edvin

  • Oh, you may also need these in your sdk_config.h:

    // <h> nrf_dfu_serial_uart - UART DFU transport
    
    //==========================================================
    // <q> NRF_DFU_SERIAL_UART_USES_HWFC  - HWFC configuration
     
    
    #ifndef NRF_DFU_SERIAL_UART_USES_HWFC
    #define NRF_DFU_SERIAL_UART_USES_HWFC 1
    #endif
    
    // <o> NRF_DFU_SERIAL_UART_RX_BUFFERS - Number of RX buffers. 
    // <i> Number of buffers depends on flash access vs.
    // <i> transport throughtput. If value is too low it may lead
    // <i> to received packets being dropped.
    
    #ifndef NRF_DFU_SERIAL_UART_RX_BUFFERS
    #define NRF_DFU_SERIAL_UART_RX_BUFFERS 3
    #endif
    
    // </h> 
    //==========================================================
    
    // </h> 
    //==========================================================
    

    If it complains about other things that are lacking, look for it in the uart bootloader, and include it in your current bootloader.

    BR,
    Edvin

  • Hi i have updated the requirement can please go through it 

  • 1. Hi currently i am using nrf52840 sdk ver 17.1.0 s140 sd we have added UART in the secure bootloader/ Bootloader_ble_debug  

    2. we can able to send multiple bytes once  ie 53 46 30 04 02 01 00 FF 00 00 45 46 on reset of device 

    3. we have sending through the func  ret_code_t ret = nrf_drv_uart_tx(&m_uart, data, sizeof(data));

    4. while we tried to connect from mobile app but we are unable to connect to dfuTarg 

    Logs

    <info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <info> app: Boot validation failed. No valid app to boot.
    <debug> app: DFU mode because app is not valid.
    <info> nrf_bootloader_wdt: WDT is not enabled
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: timer_stop (0x200059BC)
    <debug> app: timer_activate (0x200059BC)
    <info> app: Entering DFU mode.
    <debug> app: Initializing transports (found: 2)
    <debug> nrf_dfu_ble: Initializing BLE DFU transport
    <debug> nrf_dfu_ble: Setting up vector table: 0x000E8000
    <debug> nrf_dfu_ble: Enabling SoftDevice.
    <debug> nrf_dfu_ble: Configuring BLE stack.
    <debug> nrf_dfu_ble: Enabling the BLE stack.
    <debug> nrf_dfu_ble: No advertising name found
    <debug> nrf_dfu_ble: Using default advertising name
    <debug> nrf_dfu_ble: Advertising...
    <debug> nrf_dfu_ble: BLE DFU transport initialized.
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init()
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init() completed
    <info> nrf_dfu_serial_uart: Sending initial byte 0x24
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
    <debug> app: Enter main loop

    our settings as follows

  • Hi AP1,

    You have created a new ticket for this BLE connection issue, so let's try to fix the issue over there.

    Regarding the requirement you have listed here, what kind of help do you expect from the community and Nordic here? I am a little unclear.

    There is one part in your requirement that says that the image is only saved to flash if the image is for the current device.

    Whether this is possible or not depends on what you mean by saved to flash. The image itself is always downloaded to flash memory. It is just first downloaded to the unused spare space, and then copied over to the application region when confirmed. Refer to: nRF5 SDK v17.1.0: Dual-bank and single-bank updates (nordicsemi.com).

    As for transferring the image to another device over UART, you will want to take a look at the experimental NRF_DFU_SUPPORTS_EXTERNAL_APP feature.
    It is discussed in this DevZone case:  OTA from application layer .

    I do not think you will want to enable UART as a DFU transport if you are doing this. If I understand correctly, the DFU libraries and bootloader just trigger a user implemented callback to start sending the image and does not itself take part in the sending. You will only need to enable UART functionality like you do in a regular app. I am not 100% certain about this last part, please go over the resources mentioned in the linked DevZone case.

  • 1. Hi thanks for your reply let me explain in simple way in booloader_ble_debug sdk after while performing dfu the new firmware is going to write in the flash instead of writing the data in flash the same should be sent in the uart 

    2. flash -> replace with UART transfer 

    3. So whenever it is required we will write in flash or we will send same data in UART only one at a time 

    4. we need to achieve this in booloader_ble_debug app

    New_firmware_write_func

    if(cond)

    {

    uart_tx(data)

    }

    else

    {

     rc = nrf_fstorage_write(&m_fs, dest, p_src, len, (void *)callback);

    }

  • I really sorry, but I am still unclear what the problem or question is, or if there is any. 

    Could you please use shorter sentences and more punctuations?

Reply Children
No Data
Related