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

UART DFU for nRF52833

HW setup is my boart connected to a windows10 PC with an uart link.

I tried secure_bootloader_pca10100_uart_ses_nRF5SDKThreadv4.1.0.zip example, with some modification for my board, es UART pins in custom_board.h

#define RX_PIN_NUMBER 7
#define TX_PIN_NUMBER 6
//#define TX_PIN_NUMBER 35
#define CTS_PIN_NUMBER 8
#define RTS_PIN_NUMBER 40
#define HWFC true

To validate uart pins changes I tested the uart example in examples\peripheral\uart\pca10100\blank\ses and it works fine both without HW flow control and with HW flow control.

When I send 

nrfutil dfu serial -pkg blinky_pca10100_mbr.zip -p COM5 -b 115200

it seems all freezed: RTS signal from PC goes low, but nRF52833 RTS pin remains high. If I force low that signal PC starts transmitting.

A second question

The DFU example uses (in sdk_config.h) Button for entering DFU mode and set NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN to 25: in my board I cannot access to that pin and I want to use PIN0.2.

I set in custom_board.h

#define BUTTON_4       2

and in sdk_config.h

#define NRF_BL_DFU_ENTER_METHOD_PINRESET 1

I add Enter DFU mode on pin reset

Is it correct ?

How can I debug the DFU example ?

Best Regards

Parents
  • Now  interface chip works !

    With PCA10100 board connected to PC with a usb cable on j2 connector, I programmed fw with MSD functionality, then I tried to use virtual com with nrfutil but it didn't work.

    All changes if I program the board with 

    nrfjprog -f NRF52 --sectorerase --program NORDIK_SDK_v4\examples\dfu\secure_bootloader\pca10100_uart\ses\Output\Release\Exe\secure_bootloader_uart_mbr_pca10100.hex --reset
    Now nrfutil is able to program the chip
    nrfutil dfu serial -pkg blinky_pca10100_mbr.zip -p COM6 -b 115200
      [####################################]  100%
    Device programmed.

    I want to perform another test with the PCA10100 board:

    move nRF52833 UART on other pins, using pins P1.01/02/03/04, and connect the UART to the PC with an external USB-UART serial bridge.

  • With nrfjprog I've programmed a DFU that uses an UART on P1 pins, and then dowloaded a program

    nrfutil dfu serial -pkg blinky_pca10100_mbr.zip -p COM5 -b 115200
    [####################################] 100%
    Device programmed.

    Three questions:

    1) PC UART waits 30 seconds before to lower RTS signal and start download, is it correct ?

    2) I tried to download heart_rate_demo.hex, 

    nrfutil dfu serial -pkg heart_rate_demo.zip -p COM5 -b 115200
    [####################################] 100%
    Device programmed.

    but the program seems not work because LED1 and LED3 are lit on the DK (the DK has bootloader mode active). 

    When I copy heart_rate_demo on the disk of interface MCU, the  heart_rate_demo works fine and the DK connects to the smartphone.

    What's wrong ?

    3) it is not clear for me the use of mbr: is it necessary include it with DFU bootloader ?

    Best Regards

  • 1) I've seen reports of this when other non-Jlink serial bridges are being used. Please try the workaround suggested in this thread: https://devzone.nordicsemi.com/f/nordic-q-a/55803/nrfutil-takes-34-seconds-before-starting-dfu

    2) The heart_rate_demo.hex is merged with a Softdevice, and the problem with that is that you must specify the Softdevice and Application image separately when you generate the dfu packages (Memory layout). Othwerwise the bootloader will treat the merged softdevice+app image as one application image.

    rcerati said:
    When I copy heart_rate_demo on the disk of interface MCU, the  heart_rate_demo works fine and the DK connects to the smartphone.

     Then it's programmed directly through the debug interface and not through the bootloader.

    3) Yes, it's required. You can read more about its function here: Master boot record and bootloader.

Reply Children
  • About point 3,

    I want to modify the examples\peripheral\blinky_freertos\pca10100 in order to download it by DFU update:

    Which are the needed steps ?

  • It should be sufficient to adjust the linker settings as shown below:

  • It works, thank you

    What is preprocessor definition MBR_PRESENT for ?

    I want to go in deep with sections definition:

    with

    FLASH_START=0x1000

    MBR section is preserved

    but with

    FLASH_SIZE=0x7F000

    are Bootloader settings and MBR parameter storage sections preserved ?

  • You can search the project for "MBR_PRESENT" to see where it's used.

    rcerati said:

    FLASH_SIZE=0x7F000

    are Bootloader settings and MBR parameter storage sections preserved ?

    They are supposed to be preserved, but due to a problem with the way the SES project is set up in SDK 16,  the linker will not actually prevent you from letting your code  grow into the reserved MBR and bootloader settings page. However, you can easily fix this potential problem by replacing  the flash_placement.xml file in your project folder with the one below which I copied from nRF5 SDK 17.

    <!DOCTYPE Linker_Placement_File>
    <Root name="Flash Section Placement">
      <MemorySegment name="FLASH" start="$(FLASH_PH_START)" size="$(FLASH_PH_SIZE)">
        <ProgramSection load="no" name=".reserved_flash" start="$(FLASH_PH_START)" size="$(FLASH_START)-$(FLASH_PH_START)" />
        <ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START)" />
        <ProgramSection alignment="4" load="Yes" name=".init" />
        <ProgramSection alignment="4" load="Yes" name=".init_rodata" />
        <ProgramSection alignment="4" load="Yes" name=".text" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".crypto_data" inputsections="*(SORT(.crypto_data*))" address_symbol="__start_crypto_data" end_symbol="__stop_crypto_data" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_queue" inputsections="*(.nrf_queue*)" address_symbol="__start_nrf_queue" end_symbol="__stop_nrf_queue" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".dfu_trans" inputsections="*(SORT(.dfu_trans*))" address_symbol="__start_dfu_trans" end_symbol="__stop_dfu_trans" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".svc_data" inputsections="*(.svc_data*)" address_symbol="__start_svc_data" end_symbol="__stop_svc_data" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_const_data" inputsections="*(SORT(.log_const_data*))" address_symbol="__start_log_const_data" end_symbol="__stop_log_const_data" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_balloc" inputsections="*(.nrf_balloc*)" address_symbol="__start_nrf_balloc" end_symbol="__stop_nrf_balloc" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_backends" inputsections="*(SORT(.log_backends*))" address_symbol="__start_log_backends" end_symbol="__stop_log_backends" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_ble_observers" inputsections="*(SORT(.sdh_ble_observers*))" address_symbol="__start_sdh_ble_observers" end_symbol="__stop_sdh_ble_observers" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_req_observers" inputsections="*(SORT(.sdh_req_observers*))" address_symbol="__start_sdh_req_observers" end_symbol="__stop_sdh_req_observers" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_state_observers" inputsections="*(SORT(.sdh_state_observers*))" address_symbol="__start_sdh_state_observers" end_symbol="__stop_sdh_state_observers" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_stack_observers" inputsections="*(SORT(.sdh_stack_observers*))" address_symbol="__start_sdh_stack_observers" end_symbol="__stop_sdh_stack_observers" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_soc_observers" inputsections="*(SORT(.sdh_soc_observers*))" address_symbol="__start_sdh_soc_observers" end_symbol="__stop_sdh_soc_observers" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections" address_symbol="__start_nrf_sections" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_dynamic_data"  inputsections="*(SORT(.log_dynamic_data*))" runin=".log_dynamic_data_run"/>
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_filter_data"  inputsections="*(SORT(.log_filter_data*))" runin=".log_filter_data_run"/>
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".fs_data"  inputsections="*(.fs_data*)" runin=".fs_data_run"/>
        <ProgramSection alignment="4" load="Yes" name=".dtors" />
        <ProgramSection alignment="4" load="Yes" name=".ctors" />
        <ProgramSection alignment="4" load="Yes" name=".rodata" />
        <ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end" />
        <ProgramSection alignment="4" load="Yes" runin=".fast_run" name=".fast" />
        <ProgramSection alignment="4" load="Yes" runin=".data_run" name=".data" />
        <ProgramSection alignment="4" load="Yes" runin=".tdata_run" name=".tdata" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".mbr_params_page" address_symbol="__start_mbr_params_page" end_symbol="__stop_mbr_params_page" start = "0x000FE000" size="0x1000" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".bootloader_settings_page" address_symbol="__start_bootloader_settings_page" end_symbol="__stop_bootloader_settings_page" start = "0x000FF000" size="0x1000" />
      </MemorySegment>
      <MemorySegment name="RAM" start="$(RAM_PH_START)" size="$(RAM_PH_SIZE)">
        <ProgramSection load="no" name=".reserved_ram" start="$(RAM_PH_START)" size="$(RAM_START)-$(RAM_PH_START)" />
        <ProgramSection alignment="0x100" load="No" name=".vectors_ram" start="$(RAM_START)" address_symbol="__app_ram_start__"/>
        <ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections_run" address_symbol="__start_nrf_sections_run" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".log_dynamic_data_run" address_symbol="__start_log_dynamic_data" end_symbol="__stop_log_dynamic_data" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".log_filter_data_run" address_symbol="__start_log_filter_data" end_symbol="__stop_log_filter_data" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".fs_data_run" address_symbol="__start_fs_data" end_symbol="__stop_fs_data" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections_run_end" address_symbol="__end_nrf_sections_run" />
        <ProgramSection alignment="4" load="No" name=".fast_run" />
        <ProgramSection alignment="4" load="No" name=".data_run" />
        <ProgramSection alignment="4" load="No" name=".tdata_run" />
        <ProgramSection alignment="4" load="No" name=".bss" />
        <ProgramSection alignment="4" load="No" name=".tbss" />
        <ProgramSection alignment="4" load="No" name=".non_init" />
        <ProgramSection alignment="4" size="__HEAPSIZE__" load="No" name=".heap" />
        <ProgramSection alignment="8" size="__STACKSIZE__" load="No" place_from_segment_end="Yes" name=".stack"  address_symbol="__StackLimit" end_symbol="__StackTop"/>
        <ProgramSection alignment="8" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
      </MemorySegment>
      <MemorySegment name="uicr_bootloader_start_address" start="0x10001014" size="0x4">
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_bootloader_start_address" address_symbol="__start_uicr_bootloader_start_address" end_symbol="__stop_uicr_bootloader_start_address" start = "0x10001014" size="0x4" />
      </MemorySegment>
      <MemorySegment name="uicr_mbr_params_page" start="0x10001018" size="0x4">
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_mbr_params_page" address_symbol="__start_uicr_mbr_params_page" end_symbol="__stop_uicr_mbr_params_page" start = "0x10001018" size="0x4" />
      </MemorySegment>
    </Root>
    

  • Is MBR_PRESENT for DFU program or for application program ?

    > flash_placement.xml file ... from nRF5 SDK 17.

    From which project was flash_placement.xml copied ?

    Thanks

Related