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

  • 1. Hi thanks for the reply our requirements is we will use uart to transport the bin file which will receive in the dfu ota Ie through mobile instead of storing in the flash after uploading the bin from mobile

    2. It should check some condition whether it should perform dfu ble for nordic or just take the bin to uart via uart we will transfer the data to other device so main thing is we should perform dfu via mobile app and the data should transfer in uart  

    3. one more thing is there any checks for the size for uploading zip file via mobile app if it is there where should i check in secure bootloader/pca10056_ble sdk

    4. we added uart to the secure bootloader /pca10056_ble  whenever we call func   app_uart_put(data[i]) in main func device unable to advertise 

Reply
  • 1. Hi thanks for the reply our requirements is we will use uart to transport the bin file which will receive in the dfu ota Ie through mobile instead of storing in the flash after uploading the bin from mobile

    2. It should check some condition whether it should perform dfu ble for nordic or just take the bin to uart via uart we will transfer the data to other device so main thing is we should perform dfu via mobile app and the data should transfer in uart  

    3. one more thing is there any checks for the size for uploading zip file via mobile app if it is there where should i check in secure bootloader/pca10056_ble sdk

    4. we added uart to the secure bootloader /pca10056_ble  whenever we call func   app_uart_put(data[i]) in main func device unable to advertise 

Children
  • Oh, sorry. I misunderstood. 

    The init packet is sent first, and is used by the bootloader to determine whether or not to store the rest of the image. This protocol isn't very good documented. But do you want to do this test locally before forwarding the packet over UART, or do you want to check it on the device that receives the UART messages? Because the signature of the init packet and DFU image itself needs to be checked on the device that actually holds the keys for the bootloader/image.

    AP1 said:
    4. we added uart to the secure bootloader /pca10056_ble  whenever we call func   app_uart_put(data[i]) in main func device unable to advertise 

    So what do you observe? Do you just don't see the advertisements, or did you actually try to debug the bootloader? In cases like these, when you are modifying the bootloader, I suggest you use the pca10056_ble_debug bootloader, so that you can check the logs from the bootloader. This way it is easier to check where things don't go as planned.

    When it is unable to advertise, what does the log say?

    Best regards,

    Edvin

  • Hi thanks for the reply what about this point 

    3. one more thing is there any checks for the size for uploading zip file via mobile app if it is there where should i check in secure bootloader/pca10056_ble sdk

    Beacuse we already tried with other than nordic bin in which we observe that if the size of the bin is more than 1 MB than it was unable to perform DFU OTA but for less than 1 MB it is ok to perform DFU OTA 

    It is possible to perform dfu ota  and transfer those bytes via UART Transport layer ?

  • Hello,

    The length (and the signature of the image) is checked after the init packet is sent. 

    From what I understand you have this setup:

    [Mobile device (or other BLE device)] <--- BLE ---> [nRF device running a modified BLE bootloader] <--- UART ---> [nRF running a UART bootloader]

    right?

    So where do you want to check the length? On the device in the middle, or on the nRF running the UART bootloader?

    And how do you generate your DFU images? Using nrfutil? Or are you sending the raw binary files somehow?

    If you are using nrfutil to generate the DFU image (zip file), then it contains the init packet (containing information about length and signature), and the actual DFU image, containing the new application.

    The place that normally checks the init packet (and thus, the length) is the function: nrf_dfu_validation_init_cmd_execute(). But you should decide whether you need to check this on your BLE device, or if you should just forward the command that initializes this check to the UART bootloader.

    Best regards,

    Edvin

  • Hi thanks for the reply our setup 

    1. Ble bootloader without any modification in this we need to achieve accept non ble bins and TX the non ble bins in uart irrespective of size

    2. so we already able to perform non ble bins DFU OTA for any length thats working fine but we need an UART in the ble boorloader code so that we can tranfer the bin data over UART 

    requirement

    1. it can able to accept non ble bins irrespective of the length 

    2. we wiill add uart to the ble bootloader for only to transmit ,RX is not required for us

    Description :

    1. In UART bootloader sdk  it will not advertise but it has only UART RX but we need both TX and ble bootloader advertise 

    Note : so we need a sdk where it will advertise in dfu mode whenever required  and able to perform dfu ota through mobile app for both  ble bins and non ble bins and  also should TX the non ble bins which is received through ble bootloader via UART TX PIN and write the nordic ble bins to the flash area as it is with dfu process

  • Hi edvin i have provided the feature requirement anything on this one 

Related