nRF5 SDK is not maintained anymore
More Info: Consider nRF Connect SDK for new designs

51822 bootloader setting

Hi,

    recently I'm building dfu function on my board, using nrf51822 qfaa and softdevice s110. 


Here is the situation, I get two 51822 modules:

-one is Raytac MDBT40using nRF51822 QFAAH00, called A

-the other I'm not sure, using nRF51822 QFAAH10, called B

From Nordic documentthe x in the build code is 0..9 for production release.


At first, I run dfu_dual_bank_ble sample code on 51DK. Here is the original bootloader address:

I got B module earlier than A. I change to custom board and change address:

It works well on B.


Then, I repeat the steps on A module. The same bootloader can be loaded to A, but it can't work, even advertising.

I've checked if I only load s110 and application, it works.


Is there something I misunderstood or miss checking?


Thank you very much.

Parents
  • Hello,

    What SDK version are you using?

    Where did you get the twi different configuration from?

    How do you program the devices? Are you using a programmer for both of them? And did you make sure to delete the flash before you programmed everything? (nrfjprog --eraseall if you are using a programmer).

    Best regards,

    Edvin

  • Hi Edvin,

       I use Keil v5 and SDK 10 to build bootloader, SDK 7.2 to build application, through both Keil and nrfgo studio to download hex. 

    I'm not sure what do you mean because I don't use I2C or SPI but UART in my code.

    Where did you get the twi different configuration from?

    At the very beginning, Raytac module has bootloader inside (attached image), and the other is totally empty. I do erase the memory before download into them.

    Other questions:

    1. What does "0x0072", which is listed after QFAAH00 in the image, mean?

    2. Bootloader doesn't work without softdevice, does it?

  • Sorry, I meant "two" not "twi". I am sorry for the confusion. 

    I don't know anything about Raytac bootloader, but if you have erased it, I guess that shouldn't matter. Did you try to make sure it was erased before you start? When you hit "Erase all", does it give any errors? If you disconnect and reconnect it, does it appear as only one region, or does it still say "Bootloader" and "Application" regions?

    If it doesn't work to erase it using nRFGo studio, please try to use nRF Command Line Tools, and the command "nrfjprog --recover". The reason is that it says that the readback protection is turned on, so you may need to recover the module first. This will erase the chip, and disable the readback protection. 

    Other than that, are the two modules identical? Does both of them (or none, or only one) have a built in LFXTAL? Did you try to read out the flash after flashing the devices to check that they are the same after being programmed? You can use "nrfjprog --readcode my_flash_dump.hex" and "nrfjprog --readuicr my_uicr_dump.hex" to read out both the flash and UICR registers on both devices. Then you can use a diff tool (I use "Meld", which is a free diff tool) to see whether the content on the flash is actually the same.

    Yulien said:
    1. What does "0x0072", which is listed after QFAAH00 in the image, mean?

    I guess it is just a register it uses to identify the version of the chip. 

    Yulien said:
    2. Bootloader doesn't work without softdevice, does it?

    If it is a BLE bootloader, then no, it doesn't work without the softdevice. If it is a serial bootloader, it will work if you have either programmed the softdevice or the MBR. You would use the MBR if your application and bootloader doesn't use the softdevice. The bootloader requires the MBR. The MBR is part of the softdevice, but also exists as a standalone .hex file. If you flash the softdevice, you don't need to flash the MBR separately. 

    So check the flash after programming both devices, and check the readbacks to see that they match, and check whether the one that isn't working has an LFXTAL or not (32kHz crystal). 

    Best regards,

    Edvin

Reply
  • Sorry, I meant "two" not "twi". I am sorry for the confusion. 

    I don't know anything about Raytac bootloader, but if you have erased it, I guess that shouldn't matter. Did you try to make sure it was erased before you start? When you hit "Erase all", does it give any errors? If you disconnect and reconnect it, does it appear as only one region, or does it still say "Bootloader" and "Application" regions?

    If it doesn't work to erase it using nRFGo studio, please try to use nRF Command Line Tools, and the command "nrfjprog --recover". The reason is that it says that the readback protection is turned on, so you may need to recover the module first. This will erase the chip, and disable the readback protection. 

    Other than that, are the two modules identical? Does both of them (or none, or only one) have a built in LFXTAL? Did you try to read out the flash after flashing the devices to check that they are the same after being programmed? You can use "nrfjprog --readcode my_flash_dump.hex" and "nrfjprog --readuicr my_uicr_dump.hex" to read out both the flash and UICR registers on both devices. Then you can use a diff tool (I use "Meld", which is a free diff tool) to see whether the content on the flash is actually the same.

    Yulien said:
    1. What does "0x0072", which is listed after QFAAH00 in the image, mean?

    I guess it is just a register it uses to identify the version of the chip. 

    Yulien said:
    2. Bootloader doesn't work without softdevice, does it?

    If it is a BLE bootloader, then no, it doesn't work without the softdevice. If it is a serial bootloader, it will work if you have either programmed the softdevice or the MBR. You would use the MBR if your application and bootloader doesn't use the softdevice. The bootloader requires the MBR. The MBR is part of the softdevice, but also exists as a standalone .hex file. If you flash the softdevice, you don't need to flash the MBR separately. 

    So check the flash after programming both devices, and check the readbacks to see that they match, and check whether the one that isn't working has an LFXTAL or not (32kHz crystal). 

    Best regards,

    Edvin

Children
  • Thank you for your information.

    I forgot to say. I use legacy dfu.

    Where did you get the twi different configuration from?

    I get address from "Project" listed in Keil toolbar.

    This is from sample code, so I only change memory map and board settings to fit 51822.

    Did you try to make sure it was erased before you start? When you hit "Erase all", does it give any errors? If you disconnect and reconnect it, does it appear as only one region, or does it still say "Bootloader" and "Application" regions?

    Yes, I check every time before I download hex through either Keil or nrfgo studio. In both modules, I could see only one region if I erase all, with no error occurred.

    So check the flash after programming both devices, and check the readbacks to see that they match, and check whether the one that isn't working has an LFXTAL or not (32kHz crystal). 

    According to Raytac document, there is a 16MHz crystal on board, which is covered by a metal shield. Crystal on the other module could be seen with the naked eye.

    If I download only softdevice(s110)+application, it works well on both module (including BLE connection); when it comes to softdevice+application+bootloader, it would fail on Raytac module.

    So, I guess there is no difference between the two modules, and the reason may come from bootloader.

  • Yulien said:
    According to Raytac document, there is a 16MHz crystal on board, which is covered by a metal shield. Crystal on the other module could be seen with the naked eye.

    So no LFXTAL (32kHz), then? Does your application settings (sdk_config.h) take this into consideration?

    I am not that familiar with the SDK10 bootloader, as it is starting to get quite old, but from a quick glance, the main.c seems to have something like this (looking at the dual_bank_ble_s110 bootloader):

    in main.c, line 154:

    SOFTDEVICE_HANDLER_APPSH_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, true);

    So if you have an LFXTAL (32kHz physical xtal) with 20PPM accuracy, that is fine. If not, look in the enum from nrf_sdm.h, line 100, and find one entry that suits your HW. If you don't have an LFXTAL, try using NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION.

    If that doesn't work, then have you tried debugging? Try setting a breakpoint in the main() function of the bootloader. What happens? Is it reached?`Try to compare the working and non working device, and see if you see any difference in behavior.

    Best regards,

    Edvin

  • Hi Edvin,

    So if you have an LFXTAL (32kHz physical xtal) with 20PPM accuracy, that is fine. If not, look in the enum from nrf_sdm.h, line 100, and find one entry that suits your HW. If you don't have an LFXTAL, try using NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION.

    I've changed it into "NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION" already.

    If that doesn't work, then have you tried debugging? Try setting a breakpoint in the main() function of the bootloader. What happens? Is it reached?`Try to compare the working and non working device, and see if you see any difference in behavior.

    Yes, I just use debug mode for a while. It stops and shows this error when the code comes to nrf_delay.h. 

    The other module, which can work well, stops at other place.

    I think there are answers about these errors in devzone, but I haven't figure it out yet.

  • How have you connected the programmer to your boards, and what programmer are you using?

  • Hi Edvin,

      I use either Keil or nrfgo studio through Jlink. 

      If I try to use programmer in nrf connect for desktop, it cannot read my board. It might be some problem which I haven't figure out yet.

Related