download_client: Unexpected HTTP response: 400 bad request when CONFIG_MCUBOOT_IMG_MANAGER=n

If we enable MCUBOOT_IMG_MANAGER, SECURE_BOOT and BUILD_S1_VARIANT, FOTA works fine. However,

there is a constant 150mA power draw. If we disable them, power draw is normal but we then get "400 bad request" error.

Any idea why just enabling those three options causing the power draw or why not configuring them causes the bad request?

[00:00:18.082,580] <inf> download_client: Connecting to www.website.com
[00:00:18.339,508] <err> download_client: Unexpected HTTP response: 400 bad request
[00:00:18.339,996] <err> fota_download: Download client error
Received error from fota_download

# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y #
#CONFIG_MCUBOOT_IMG_MANAGER=y
#CONFIG_SECURE_BOOT=y
#CONFIG_BUILD_S1_VARIANT=y
CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=n

  • Hi,

     

    If we enable MCUBOOT_IMG_MANAGER, SECURE_BOOT and BUILD_S1_VARIANT, FOTA works fine.

    Is there a specific reason why you are disabling these options?

     I assume you want MCUBOOT_IMG_MANAGER selected, to make the application "FOTA aware".

    Any idea why just enabling those three options causing the power draw or why not configuring them causes the bad request?

    [00:00:18.082,580] <inf> download_client: Connecting to www.website.com
    [00:00:18.339,508] <err> download_client: Unexpected HTTP response: 400 bad request
    [00:00:18.339,996] <err> fota_download: Download client error

    What is the full path of your download URL?

     

    Kind regards,

    Håkon

  • Because if we enable them, the board is drawing 150mA! If we disable them, we are at 30uA. 

    Full path is /firmware/AT-1.0.1.bin

    The only difference between the two are the changes to prj.conf.

  • Hi

    Sorry about the late reply, but we are short on staff during the Easter week in Norway. How are you measuring the power consumption exactly on your end, as 150mA sounds very high. Most likely the MCUBoot is keeping something very power hungry awake. I would suggest comparing your build/zephyr/zephyr.dts and build/mcuboot/zephyr/zephyr.dts to verify if they are the same. 

    Best regards,

    Simon

  • Power Profiler II is being used to measure power consumption. Thank you, that did help us find some inconsistencies. We are now able to get power down to 100uA but that is still triple the 30uA without it. Here is the difference between the two files you mentioned. Any red flags?

    $ diff zephyr/zephyr.dts mcuboot/zephyr/zephyr.dts
    9c9
    <               zephyr,entropy = &psa_rng;
    ---
    >               zephyr,entropy = &cryptocell;
    13a14
    >               zephyr,sram = &sram0_s;
    15,16c16,18
    <               zephyr,sram = &sram0_ns;
    <               zephyr,code-partition = &slot0_ns_partition;
    ---
    >               zephyr,code-partition = &slot0_partition;
    >               zephyr,sram-secure-partition = &sram0_s;
    >               zephyr,sram-non-secure-partition = &sram0_ns;
    34d35
    <               ext-flash = &mx25r16;
    60c61
    <               peripheral@40000000 {
    ---
    >               peripheral@50000000 {
    63c64
    <                       ranges = < 0x0 0x40000000 0x10000000 >;
    ---
    >                       ranges = < 0x0 0x50000000 0x10000000 >;
    102a104,107
    >                                               storage_partition: partition@fa000 {
    >                                                       label = "storage";
    >                                                       reg = < 0xfa000 0x6000 >;
    >                                               };
    195c200
    <                               status = "disabled";
    ---
    >                               status = "okay";
    326,335c331
    <                                       status = "ok";
    <                                       partitions {
    <                                               compatible = "fixed-partitions";
    <                                               #address-cells = < 0x1 >;
    <                                               #size-cells = < 0x1 >;
    <                                               storage_partition: partition@0 {
    <                                                       label = "external-flash";
    <                                                       reg = < 0x0 0x1000000 >;
    <                                               };
    <                                       };
    ---
    >                                       status = "okay";
    475c471,488
    <               gpiote: gpiote@40031000 {
    ---
    >               cryptocell: crypto@50840000 {
    >                       compatible = "nordic,nrf-cc310";
    >                       reg = < 0x50840000 0x1000 >;
    >                       status = "okay";
    >                       #address-cells = < 0x1 >;
    >                       #size-cells = < 0x1 >;
    >                       cryptocell310: crypto@50841000 {
    >                               compatible = "arm,cryptocell-310";
    >                               reg = < 0x50841000 0x1000 >;
    >                               interrupts = < 0x40 0x1 >;
    >                       };
    >               };
    >               ctrlap: ctrlap@50006000 {
    >                       compatible = "nordic,nrf-ctrlapperi";
    >                       reg = < 0x50006000 0x1000 >;
    >                       status = "okay";
    >               };
    >               gpiote: gpiote@5000d000 {
    477,478c490,507
    <                       reg = < 0x40031000 0x1000 >;
    <                       interrupts = < 0x31 0x5 >;
    ---
    >                       reg = < 0x5000d000 0x1000 >;
    >                       interrupts = < 0xd 0x5 >;
    >                       status = "okay";
    >               };
    >               spu: spu@50003000 {
    >                       compatible = "nordic,nrf-spu";
    >                       reg = < 0x50003000 0x1000 >;
    >                       interrupts = < 0x3 0x1 >;
    >                       status = "okay";
    >               };
    >               ficr: ficr@ff0000 {
    >                       compatible = "nordic,nrf-ficr";
    >                       reg = < 0xff0000 0x1000 >;
    >                       status = "okay";
    >               };
    >               uicr: uicr@ff8000 {
    >                       compatible = "nordic,nrf-uicr";
    >                       reg = < 0xff8000 0x1000 >;
    576,579d604
    <       };
    <       psa_rng: psa-rng {
    <               compatible = "zephyr,psa-crypto-rng";
    <               status = "okay";
    

  • Hi

    Thank you for sharing. No particular red flags, no. But I did some digging on my end, and this power could point to an issue we've seen where the MCUBoot enables UART instances, so you could make sure that the DT overlay file for MCUBoot that sets the status of all UART nodes to "disabled" so we know that the UART pins aren't configured. I think that's worth giving a try.

    Best regards,

    Simon

Related