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

Problem programming custom PCBs on nrf51822

Hi, I tried my best to solve my problem via forum but unfortunately no success. I got nrf51 DK and played with it a lot. successfully program the samples and tweak them a bit. using SDK 5.1 and s110 v6.

The problem starts when I try custom boards. I have made one based on QFAAC0 for which:

I have same problem with a board I purchased online, PTR5528 which is based on CEAA . Can program blinky but no BLE.

Is there something that I am doing wrong. I did connect the board to 3 V and connected the segger programmer pins as explained in the forum (That's how I program without an error)

Thanks in advanced for your help, Ali

  • Well, tracked it down. It was the board I was using only had the 16Mhz xtal, no 32khz, so had to make a small change for it to work. Note that I'm using the latest SDK (5.2) and SD (6.0) with the QFAAC0 and it is ok for this application... YMMV..

    Modify the function below to use the NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM instead.. This was for a Xuntong board..

    static void ble_stack_init(void) { uint32_t err_code;

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, false);
    
    // Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
    APP_ERROR_CHECK(err_code);
    
    // Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
    

    }

  • Just FYI, I've been told that without having an external 32 KHz crystal, the 2 viable options for running the stack are (a) the synthesized 32 KHz source (as in, synthesized from 16 MHz) or (b) the internal 32 KHz oscillator. My understanding is that the synthesized source may be more accurate but will use more power than the internal oscillator. Nordic says the internal oscillator is sufficiently accurate for the BLE stack. If power consumption is a concern, you may wish to investigate.

    Also, I found (the hard way) that when using the synth source, the RTC wasn't running, but with the int osc it does. YMMV.

    Synth: NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM Int osc: NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION (there are other calibration interval options but allegedly this is accurate enough for the BLE stack)

  • Ahh yeah, I read that about the power.. not sure how much worse it is. Problem getting cheap OEM boards is they cut every possible cost. I'm surprised that a simple RC is good for BLE.. would think it'd drift/be quite uncalibrated...

    Good info tho, thanks for that.

  • Hi Chris

    Thank you very much for tracking this down. Fixed the same perplexing problem for me.

    I have a custom PCB based on the nRF51822 reference designs in the data sheet. The SoftDevice and memory map all were set up correctly. Test GPIO code integrated with inactive S110 SoftDevice and worked fine.

    Yet when running ble_app_hrs example code, main() worked up to ble_stack_init. At that point line 231 of softdevice_handler.c ....

    err_code = sd_softdevice_enable(clock_source, softdevice_assertion_handler);

    ... would cause a hang inside the SoftDevice in a loop between 0x237C to 0x2382.

    Fix was as you describe:

    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, false);

    I was not aware that SD110 was configured expecting an external 32KHz xtal. Looked again and didn't see reference to that in the nRF51822 data sheet, SDK or S110 documentation.

    Liam

  • Hi,all

      if your  PCB based on the nRF51822 reference designs in the data sheet.
    

    The SoftDevice and memory map all were set up correctly. Test GPIO code integrated with inactive S110 SoftDevice and worked fine.

    Yet when running ble_app_hrs example code, main() worked up to ble_stack_init. At that point line 231 of softdevice_handler.c ....

    1)please do it: if your PCB hasn't no xtal 32khz,you need to modify "ble_tack_init(void)" BLE_STACK_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, BLE_L2CAP_MTU_DEF, ble_evt_dispatch, false);

    2)the problem is still,please to do it.

    the xtal 16M Crystal has broken,so you need to replace by a new xtal 16M .

Related