Allows for some basic control of the application-side DFU module. More...
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_SUCCESS The DFU-module was successfully initialized. NRF_ERROR_NOT_SUPPORTED The 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_SUCCESS The DFU app successfully sent a msg to bootloader to enable DFU. NRF_ERROR_NOT_SUPPORTED The 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_FORBIDDEN The 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_packet A pointer to a DFU packet. [in] length The length of the DFU packet. [in] p_metadata Metadata attached to the packet that came in.
- Return values
-
NRF_SUCCESS The packet was successfully handled by the DFU module. NRF_ERROR_BUSY The DFU module can't accept the request at the moment. NRF_ERROR_INVALID_ADDR The packet isn't a known DFU packet. NRF_ERROR_NOT_SUPPORTED The 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:
- NRF_MESH_EVT_DFU_BANK_AVAILABLE: The DFU transfer is finished, and is available for flashing.
- NRF_MESH_EVT_DFU_START: The DFU module got a response to the DFU request, and started receiving the transfer.
- NRF_MESH_EVT_DFU_END: The DFU module finished its transfer.
- Parameters
-
[in] type DFU type to request. [in] p_fwid Firmware ID to request. [in] p_bank_addr Address in which to store the banked data. Any existing data in this location will be erased.
- Return values
-
NRF_SUCCESS The DFU module has started requesting the given transfer. NRF_ERROR_NULL One of the parameters provided was null. NRF_ERROR_NOT_SUPPORTED The DFU functionality is not available. NRF_ERROR_INVALID_PARAM The given DFU type is not available. NRF_ERROR_INVALID_STATE The 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:
- NRF_MESH_EVT_DFU_START: The transfer has started, and the device is actively relaying data packets.
- NRF_MESH_EVT_DFU_END: The DFU module finished its transfer.
- Parameters
-
[in] type DFU type to request. [in] p_fwid Firmware ID to request.
- Return values
-
NRF_SUCCESS The DFU module has started advertising its intention to relay the given transfer. NRF_ERROR_NULL The FWID pointer provided was NULL. NRF_ERROR_NOT_SUPPORTED The DFU functionality is not available. NRF_ERROR_INVALID_PARAM The given DFU type is not available. NRF_ERROR_INVALID_STATE The 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_SUCCES The ongoing DFU operation was successfully stopped, and the DFU module went back to the idle state. NRF_ERROR_NOT_SUPPORTED The DFU functionality is not available. NRF_ERROR_INVALID_STATE The 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] type Type of the bank to get info on. [out] p_bank_info Pointer to a structure which the function will put information on the bank in.
- Return values
-
NRF_SUCCESS The bank was found, and the p_bank_infoparameter was filled with the correct paramters.NRF_ERROR_NULL The bank info pointer provided was NULL. NRF_ERROR_NOT_SUPPORTED The DFU functionality is not available. NRF_ERROR_NOT_FOUND No bank of the given type was found. NRF_ERROR_INVALID_STATE The 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_type The DFU type of the bank to be flashed. There can only be one bank of each DFU type.
- Return values
-
NRF_ERROR_NOT_FOUND No bank of the given type is available. NRF_ERROR_NOT_SUPPORTED The DFU functionality is not available. NRF_ERROR_INVALID_STATE The 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_state A 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_SUCCESS The DFU state was successfully retrieved. NRF_ERROR_NULL The transfer state pointer provided was NULL. NRF_ERROR_NOT_SUPPORTED The DFU functionality is not available. NRF_ERROR_INVALID_STATE The DFU module has not been initialized.