This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF51822 QFAAC0 code compatibility with nRF51422AC on nRF51 DK?

Hey,

I have written a custom service for my company's sensor readings on the nRF51 DK, on top of the uart peripheral example given n SDK_11.0.0. However, for the final product development, the PCB will be using nrf51822 since it's cheaper and we don't need ANT in our product. For testing code compatibility, I have used one of the RFduino's (has nrf51822 chip) to upload the code. I have erased the boot loader and programmed the correct Softdevice S130. I also changed the target device in the code and IRAM and IROM addresses for S130 with memory of nRF51822:

IROM base: 0x1B00 - 0X25000 (256kB flash) IRAM base: 0x20001870 - 0x2790 (16kB RAM)

I also changed the clock in initialisation of SoftDevice to:

#define NRF_CLOCK_LFCLKSRC      {
                                 .source        = NRF_CLOCK_LF_SRC_SYNTH,            
                                 .rc_ctiv       = 0,                                
                                 .rc_temp_ctiv  = 0,                               
                                 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

Which synthesises the low frequency clock from high frequency since RFduino doesn't have an external 32.768KHz oscillator.

I have tested the program is correctly flashing the LED's I soldered on two GPIO pins. I have also tested that the clock is correctly working by using a timer to flash LED's every second and it did indeed work. However, the bluetooth is not advertising although there aren't any compile errors. I have pinpointed the function where I guess the bluetooth might not be working. In the static void ble_stack_init(void):

err_code = softdevice_enable(&ble_enable_params);

I tried using breakpoints to see what went wrong, but I can't figure out the problem.

My only guess is because the revision of nrf chip on RFduino is not compatible with SDK 11.0.0?

  • Ok. So you get to ble_advertising_start()? And it does not return an error? Then maybe it is a crystal issue. Do you know what kind of crystals the RFduino has? Does it have a 16 MHz crystal and a 32 kHz crystal? I would recommend buying one of our DKs. Either the nRF51 DK, or the nRF52 DK, nRF52 is our latest and greatest device. They are compatible with SDK 11, and SoftDevice S130/S132 v2.0.

  • Yes, I do get to ble_advertising_start() with err_code = 0; meaning there are no errors. I already initialised the crystal to be LFCLKSRC synthesised from the 16MHz crystal since the RFduino doesn't have a 32.678 crystal, and I checked if the crystal is working by using a timer to blink an LED every second. It did work. I have the nRF51 DK and the existing code does work on it however I need to program the nRF51 IC in the RFduino since it's the device that's soldered to our PCB. Currently, we are designing a new PCB with just the nRF51822 IC, however we're scared we will run into code compatibility problems just like we did with IC in RFduino and would want to ensure that revision we choose will be compatible with the existing code.

  • Sorry. Now I understand. On the nRF51 DK you have revision 3 of the nRF51422 IC (QF AC), see this. An application that works with this IC, will work with a revision 3 of the nRF51822 chip IC, see this. As long as you have the same amount of memory, and the same hardware configuration.

  • I still don't know why your application is not working on the RFduino. Could you try to use the RC oscillator as LF clock source instead of the synth? Try this:

    nrf_clock_lf_cfg_t rc_cfg = {
       .source = NRF_CLOCK_LF_SRC_RC,
       .rc_ctiv = 4, // check every 4 * 250ms
       .rc_temp_ctiv = 1, // only calibrate if temperature has changed.
    };
    
  • I have tried the RC oscillator but there's no luck.. I can't seem to pinpoint where the error is coming from yet. I have checked the error code of each function it's always = 0x0000000.

Related