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?

  • I'm not sure what IC revision of the nRF51822 is in your RFduino, but let's assume it is compatible with SDK 11.0.0 for now. Does softdevice_enable() return an error? If not, are you getting to sd_ble_enable() inside softdevice_enable()? Does it return an error? How did you set the RAM start and size? Did you use the print outs in softdevice_enable()?

  • I am getting to sd_ble_enable() inside softdevice_enable() and it doesn't return an error. I didn't use the print outs in softdevice_enable()? how can I use them? I just used the RAM start and size for softdevice 130 given in the ROM and RAM Management Tutorial. How can I confirm that the size and start are correct inside the code?

  • Does sd_ble_enable() return at all? Do you get to return err_code; at line 482? If you do, how far do you get?

    You need to use RTT to use the print outs, but it is not necessary. You can use the debugger as well, ram_start should be bigger than app_ram_base after you have called sd_ble_enable(). Calling sd_ble_enable() with too little ram should only return an error, so I don't think the memory settings are causing the issue.

  • The memory settings were the ones causing an issue in sd_ble_enable, I changed the RAM start to 0x20002080 as it originally was on uart-example and RAM size to 0x1F80 since it's 16 KB not 32KB. After changing this setting there was no memory error. I am back to the same problem were the code compiles and loads but is still not advertising. I used LED's after each function to check if functions are not running into errors.

    Is it possibly the revision of the chip with SDK 11 that might be causing the prioblem?

  • Also, is it going to work if I purchase and use the latest revision of the nRF51822 IC, that it will be compatible with SDK 11 and SoftDevice S130 v2.0?

Related