nRF5 SDK for Mesh v5.0.0
Modules | Functions
DFU API

Allows for some basic control of the application-side DFU module. More...

Modules

 Types
 DFU type definitions.
 
 Defines
 DFU definitions.
 

Functions

uint32_t nrf_mesh_dfu_init (void)
 Initialize the DFU module. More...
 
uint32_t nrf_mesh_dfu_enable (void)
 Enable the DFU module in the Bootloader. More...
 
uint32_t nrf_mesh_dfu_jump_to_bootloader (void)
 Manually trigger the bootloader. More...
 
uint32_t nrf_mesh_dfu_rx (const uint8_t *p_packet, uint32_t length, const nrf_mesh_rx_metadata_t *p_metadata)
 Pass a DFU packet to the DFU module. More...
 
uint32_t nrf_mesh_dfu_request (nrf_mesh_dfu_type_t type, const nrf_mesh_fwid_t *p_fwid, const uint32_t *p_bank_addr)
 Request a DFU transfer. More...
 
uint32_t nrf_mesh_dfu_relay (nrf_mesh_dfu_type_t type, const nrf_mesh_fwid_t *p_fwid)
 Relay an ongoing transfer. More...
 
uint32_t nrf_mesh_dfu_abort (void)
 Abort the ongoing DFU operation. More...
 
uint32_t nrf_mesh_dfu_bank_info_get (nrf_mesh_dfu_type_t type, nrf_mesh_dfu_bank_info_t *p_bank_info)
 Get info on the bank of the given type. More...
 
uint32_t nrf_mesh_dfu_bank_flash (nrf_mesh_dfu_type_t bank_type)
 Flash the bank of the given type. More...
 
uint32_t nrf_mesh_dfu_state_get (nrf_mesh_dfu_transfer_state_t *p_dfu_transfer_state)
 Get the current state of the DFU module. More...
 

Detailed Description

Allows for some basic control of the application-side DFU module.

All DFU related events are defined in the main API-header.

Function Documentation

◆ nrf_mesh_dfu_init()

uint32_t nrf_mesh_dfu_init ( void  )

Initialize the DFU module.

Return values
NRF_SUCCESSThe DFU-module was successfully initialized.
NRF_ERROR_NOT_SUPPORTEDThe DFU-module was unable to find the bootloader or the bootloader device page.

◆ nrf_mesh_dfu_enable()

uint32_t nrf_mesh_dfu_enable ( void  )

Enable the DFU module in the Bootloader.

Note
This function is called from nrf_mesh_enable()
Return values
NRF_SUCCESSThe DFU app successfully sent a msg to bootloader to enable DFU.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.
NRF_ERROR_*The given command did not succeed. The meaning of each error code depends on the command.

◆ nrf_mesh_dfu_jump_to_bootloader()

uint32_t nrf_mesh_dfu_jump_to_bootloader ( void  )

Manually trigger the bootloader.

The device will be reset immediately, and may not be available for regular operation for several minutes. If successful, this function does not return.

Return values
NRF_ERROR_FORBIDDENThe NRF_UICR->BOOTLOADERADDR persistent register has not been set, and the bootloader could not start.

◆ nrf_mesh_dfu_rx()

uint32_t nrf_mesh_dfu_rx ( const uint8_t *  p_packet,
uint32_t  length,
const nrf_mesh_rx_metadata_t p_metadata 
)

Pass a DFU packet to the DFU module.

Parameters
[in]p_packetA pointer to a DFU packet.
[in]lengthThe length of the DFU packet.
[in]p_metadataMetadata attached to the packet that came in.
Return values
NRF_SUCCESSThe packet was successfully handled by the DFU module.
NRF_ERROR_BUSYThe DFU module can't accept the request at the moment.
NRF_ERROR_INVALID_ADDRThe packet isn't a known DFU packet.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.

◆ nrf_mesh_dfu_request()

uint32_t nrf_mesh_dfu_request ( nrf_mesh_dfu_type_t  type,
const nrf_mesh_fwid_t p_fwid,
const uint32_t *  p_bank_addr 
)

Request a DFU transfer.

The DFU transfer will run alongside the application, and store the firmware in the given bank.

Generates events:

Parameters
[in]typeDFU type to request.
[in]p_fwidFirmware ID to request.
[in]p_bank_addrAddress in which to store the banked data. Any existing data in this location will be erased.
Return values
NRF_SUCCESSThe DFU module has started requesting the given transfer.
NRF_ERROR_NULLOne of the parameters provided was null.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.
NRF_ERROR_INVALID_PARAMThe given DFU type is not available.
NRF_ERROR_INVALID_STATEThe DFU module is not in an idle state, and the operation can't be started. This can either be because the application failed to initialize the module, or because a DFU operation is currently in progress. In the last case, stop the current operation with nrf_mesh_dfu_abort() or wait for an end-event before requesting a new transfer.

◆ nrf_mesh_dfu_relay()

uint32_t nrf_mesh_dfu_relay ( nrf_mesh_dfu_type_t  type,
const nrf_mesh_fwid_t p_fwid 
)

Relay an ongoing transfer.

Should only be used as a response to an NRF_MESH_EVT_DFU_REQ_RELAY.

Generates events:

Parameters
[in]typeDFU type to request.
[in]p_fwidFirmware ID to request.
Return values
NRF_SUCCESSThe DFU module has started advertising its intention to relay the given transfer.
NRF_ERROR_NULLThe FWID pointer provided was NULL.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.
NRF_ERROR_INVALID_PARAMThe given DFU type is not available.
NRF_ERROR_INVALID_STATEThe DFU module is not in an idle state, and the operation can't be started. This can either be because the application failed to initialize the module, or because a DFU operation is currently in progress. In the last case, stop the current operation with nrf_mesh_dfu_abort() or wait for an end-event before requesting a new transfer.

◆ nrf_mesh_dfu_abort()

uint32_t nrf_mesh_dfu_abort ( void  )

Abort the ongoing DFU operation.

Return values
NRF_SUCCESThe ongoing DFU operation was successfully stopped, and the DFU module went back to the idle state.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.
NRF_ERROR_INVALID_STATEThe DFU module was not doing any DFU operations.

◆ nrf_mesh_dfu_bank_info_get()

uint32_t nrf_mesh_dfu_bank_info_get ( nrf_mesh_dfu_type_t  type,
nrf_mesh_dfu_bank_info_t p_bank_info 
)

Get info on the bank of the given type.

Parameters
[in]typeType of the bank to get info on.
[out]p_bank_infoPointer to a structure which the function will put information on the bank in.
Return values
NRF_SUCCESSThe bank was found, and the p_bank_info parameter was filled with the correct paramters.
NRF_ERROR_NULLThe bank info pointer provided was NULL.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.
NRF_ERROR_NOT_FOUNDNo bank of the given type was found.
NRF_ERROR_INVALID_STATEThe DFU module has not been initialized.

◆ nrf_mesh_dfu_bank_flash()

uint32_t nrf_mesh_dfu_bank_flash ( nrf_mesh_dfu_type_t  bank_type)

Flash the bank of the given type.

Warning
This will trigger a restart of the chip. All non-volatile memory will be lost during this call. If successful, this never returns.
Parameters
[in]bank_typeThe DFU type of the bank to be flashed. There can only be one bank of each DFU type.
Return values
NRF_ERROR_NOT_FOUNDNo bank of the given type is available.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.
NRF_ERROR_INVALID_STATEThe DFU module has not been initialized.

◆ nrf_mesh_dfu_state_get()

uint32_t nrf_mesh_dfu_state_get ( nrf_mesh_dfu_transfer_state_t p_dfu_transfer_state)

Get the current state of the DFU module.

Parameters
[out]p_dfu_transfer_stateA pointer to a DFU transfer state variable, which the framework will fill with the current state/progress of an ongoing transfer, if any.
Return values
NRF_SUCCESSThe DFU state was successfully retrieved.
NRF_ERROR_NULLThe transfer state pointer provided was NULL.
NRF_ERROR_NOT_SUPPORTEDThe DFU functionality is not available.
NRF_ERROR_INVALID_STATEThe DFU module has not been initialized.

Documentation feedback | Developer Zone | Subscribe | Updated