Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: lib: nrf_cloud_coap: Various cleanups / fixes #17300

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

simensrostad
Copy link
Contributor

@simensrostad simensrostad commented Sep 12, 2024

Various fixes / cleanups needed for the Thingy91x Out of Box firmware.
Mostly small stuff found during testing of Full Modem FOTA.

@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Sep 12, 2024
@simensrostad simensrostad changed the title Variousfixesfota net: lib: nrf_cloud_coap: Various cleanups / fixes Sep 12, 2024
@NordicBuilder
Copy link
Contributor

You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds.

Note: This comment is automatically posted by the Documentation Publishing GitHub Action.

@NordicBuilder
Copy link
Contributor

NordicBuilder commented Sep 12, 2024

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 15

Inputs:

Sources:

sdk-nrf: PR head: 2c58526c6fbf311065aa818db9f7869f8f0d1ae9

more details

sdk-nrf:

PR head: 2c58526c6fbf311065aa818db9f7869f8f0d1ae9
merge base: f1e956e1d2ea0d2acac7bbfb4a7cd03a9e629e28
target head (main): 66f9b23d37ebff1e69db8a85e2b222463ca760e1
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (7)
doc
│  ├── nrf
│  │  ├── releases_and_maturity
│  │  │  ├── releases
│  │  │  │  │ release-notes-changelog.rst
include
│  ├── net
│  │  ├── nrf_cloud.h
│  │  │ nrf_cloud_fota_poll.h
modules
│  ├── memfault-firmware-sdk
│  │  │ memfault_lte_metrics.c
subsys
│  ├── net
│  │  ├── lib
│  │  │  ├── nrf_cloud
│  │  │  │  ├── Kconfig.nrf_cloud_coap
│  │  │  │  ├── coap
│  │  │  │  │  ├── src
│  │  │  │  │  │  │ nrf_cloud_coap_transport.c
│  │  │  │  ├── src
│  │  │  │  │  │ nrf_cloud_fota_poll.c

Outputs:

Toolchain

Version:
Build docker image:

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain
  • ◻️ Build twister
  • ◻️ Integration tests
    • ◻️ test-fw-nrfconnect-boot
    • ◻️ test-fw-nrfconnect-nrf-iot_cloud
    • ◻️ test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • ◻️ test-fw-nrfconnect-nrf-iot_thingy91
    • ◻️ test-fw-nrfconnect-nrf-iot_mosh
    • ◻️ test-fw-nrfconnect-nrf-iot_positioning
    • ◻️ test-sdk-mcuboot
    • ⚠️ test-fw-nrfconnect-fw-update
Disabled integration tests
    • desktop52_verification
    • doc-internal
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_nrf_provisioning
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-proprietary_esb
    • test-fw-nrfconnect-ps
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread
    • test-fw-nrfconnect-zigbee
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-pmic-samples
    • test-sdk-sidewalk
    • test-sdk-wifi

Note: This message is automatically posted and updated by the CI

@simensrostad simensrostad force-pushed the variousfixesfota branch 3 times, most recently from e8f3492 to 67febe5 Compare September 12, 2024 12:10
include/net/nrf_cloud_fota_poll.h Outdated Show resolved Hide resolved
include/net/nrf_cloud.h Outdated Show resolved Hide resolved
include/net/nrf_cloud_fota_poll.h Outdated Show resolved Hide resolved
* download when doing a full modem FOTA, which does not currently work.
*/
if (ctx_ptr->img_type == DFU_TARGET_IMAGE_TYPE_FULL_MODEM) {
int err = fota_download_util_image_reset(DFU_TARGET_IMAGE_TYPE_FULL_MODEM);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea... seems like this should be done in fota_download since it knows more about the specific failure mode and if it is possible to resume.

but if not, i believe it makes sense to do this only when evt->cause is one of these values:

	/** The update is invalid and was rejected. Retry will not help. */
	FOTA_DOWNLOAD_ERROR_CAUSE_INVALID_UPDATE,
	/** Actual firmware type does not match expected. Retry will not help. */
	FOTA_DOWNLOAD_ERROR_CAUSE_TYPE_MISMATCH,
	/** Generic error on device side. */
	FOTA_DOWNLOAD_ERROR_CAUSE_INTERNAL,

FOTA_DOWNLOAD_ERROR_CAUSE_INTERNAL seems to be a catch-all cause... it is possible there are cases when resuming might still work, but would take some investigation in fota_download.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the error code I get when it fails is FOTA_DOWNLOAD_ERROR_CAUSE_DOWNLOAD_FAILED.
I don't think resumption works at all for full modem fota atm. Sure, resumption does happen. But the hash is wrong after the image is downloaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subsys/net/lib/nrf_cloud/src/nrf_cloud_fota_poll.c Outdated Show resolved Hide resolved
subsys/net/lib/nrf_cloud/src/nrf_cloud_fota_poll.c Outdated Show resolved Hide resolved
subsys/net/lib/nrf_cloud/src/nrf_cloud_fota_poll.c Outdated Show resolved Hide resolved
@simensrostad simensrostad force-pushed the variousfixesfota branch 4 times, most recently from e86842a to 92c9aa3 Compare September 16, 2024 10:49
Copy link
Contributor

@plskeggs plskeggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK.

You need a change log though.

@simensrostad
Copy link
Contributor Author

Looks OK.

You need a change log though.

Will add!

@github-actions github-actions bot added doc-required PR must not be merged without tech writer approval. and removed changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Sep 18, 2024
Convert error callback to include general status notifications from
the FOTA library as well as error events.

This gives the application the opportunity
to block network related operations during FOTA updates.

Add image type to reboot function to allow the application to
reinitialize the modem after a firmware update. Its not nessecary to
reboot the device after modem FOTA.

Signed-off-by: Simen S. Røstad <[email protected]>
 - Use nrf modem library CFUN callback to prevent modem info
   calls in offline and powered off states. This is needed instead of
   fetching the func mode due to the modem being shutdown when
   a lte handler notification is received.

 - Ease up on the logging when modem info API are called.
   Its expected that they fail in certain scenarios, and logging an
   error in those instances is not necessary.

Signed-off-by: Simen S. Røstad <[email protected]>
Add option, CONFIG_NRF_CLOUD_COAP_DISCONNECT_ON_FAILED_REQUEST, that
disconnects the CoAP client on a failed request. Disabled by default.

Signed-off-by: Simen S. Røstad <[email protected]>
@rlubos rlubos merged commit c1f2ff6 into nrfconnect:main Sep 19, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-required PR must not be merged without tech writer approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants