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?

  • 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.

Reply Children
  • Have you tried using nrfjprog (nrf command line tools)

    But you never see these JLink - Cortex-M Error when you debug your application (without bootloader)?

    When you try to debug the bootloader, does the JLink error come immediately, or does it reach the main() function first?

  • Hi Edvin,

      Raytac engineer helps me to find out a little different.

    In my project which is transformed from SDK sample code, I use these argument setting:

    And these are Raytac engineer using (I was told that he uses SDK, too):

    So, I try the following 3 argument settings:

    1. --family NRF51 --program "#H"     ➜ I use at first 
    2. --reset --program "#H"         ➜ Raytac uses
    3. --reset --family NRF51 --program "#H     ➜ I mix 1 & 2

    Both setting 2 and 3 lead modules to work.

    After I turn back to try setting 1, modules work, too.

    It seems there is something wrong if I keep using setting 1; and in 2 or 3 Keil fixes the problems.

    Thank you for your help.

  • I forgot that the keil projects for the bootloader had this. If it works, that is completely fine. What the different command does is quite self explaining. The --reset flag will reset the device when the programming is complete. So if you don't have the --reset flag, you will need to reset the device manually, either by power cycling it, or by using the command nrfjprog --reset.

    The --family NRF51 just tells the programmer that it is an nRF51 chip. If you don't specify it, the programmer will check a register that says what chip it is. 

    Best regards,

    Edvin

Related