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

configuration BLE and softdevice

Hello,

I'm working with a proprietary chip that has a nRF51822. I want to configure it as a BLE peripheral. I'm using ble_ app_uart example to achieve this.

I tried it on the dongle nRF51 and it works fine. Now I'm transferring it to the chip. I had some problems with the SOFTDEVICE_HANDLER_INIT function because of the clock configuration, as you can see on this post.

I configured to use the NRF_CLOCK_LF_SRC_RCand now it doesn't give me an error when trying to enable the sofdevice. When it goes to the ble_advertising_start(BLE_ADV_MODE_FAST); function it doesn't give me an error but it doesn't connect to the central (configured on a DK51 and previously tested).

My chip has a crystal connected to the pins XC1 and XC2, but none connected to the XL1 and XL2 pins, that why I use the internal oscillator. I'm not getting any errors when I configure the pins/clocks nor when I enable the functions I need, but it still doesn't connect to the central.

Other thing is that I'm using the DK51 to program and debug the chip because I don't have access to a J-link probe, does this introduce some problems? Because when I debug it seems to respond strangely some times.

So I wanted to ask for some help, regarding this problem, it goes to the advertising (appears to have the right settings) but it doesn't connect to the central device!

I reviewed some questions to avoid duplication; apologies if this was already asked and/or answered. Here are some snippets of my code, at least what I think it is important for this problem, If needed more just ask!

Thanks, Jorge. (I use nrf51, SDK11 and SD130 v2)

  • I'll try to see this. Before there was a working code on this chip with the SDK 7, I tried to replicate the settings they had but with the differences on the migration of the SDK's. I will try and then write my findings

  • Just tried on a board that use 32MHz crystal and LFCLK RC and it works. I used ble_app_template and changed the changed the LF clock config to:

    nrf_clock_lf_cfg_t clock_lf_cfg = { .source = NRF_CLOCK_LF_SRC_RC,		\
                                            .rc_ctiv = 4,	\
                                            .rc_temp_ctiv = 1};
    

    And added this at the top of main:

    NRF_CLOCK->XTALFREQ = 0;
    

    Can you try the same and let me know what you find out?

  • It worked, using the NRF_CLOCK_LF_SRC_SYNTH!! thank you for the help.

    So the LFCLK RC oscillator is not working with this chip? It is strange because it was used with combination of SDK7. If there is any update to use this, where should I find it? Thank you again

    Edit: I tried that configuration, and it didn't work (the one with the NRF_CLOCK_LF_SRC_RC).

  • It seemed that yesterday was fluke... Yesterday I tried with the Synth clock and it appeared on my MCP on the iphone, but today is not working again (without changing anything). I tried to debug it on the Keil and when is getting out of the function ble_advertising_start and tries to printf the status it gives me an error of "***JLink Error: Programming failed @ address 0x00010508 (block verification error)" and it stays on this loop

        // If printing is disrupted, remove the irq calls, or set the loop variable to 0 in the debugger.
    
    __disable_irq();
    
    while(loop);
    
    __enable_irq();
    

    I tried to put the variable loop to 0 and continue, but after a while it goes back to the same place.

  • Please do not close this case yet. Even though synthesized clock works, it is not a good solution to this problem and most users of the chip will not tolerate the high current draw that comes with it. I will ask you to deselect the answer until we find the root cause of this problem.

    Can you open a case on mypage so we can take the discussion there? I expect that else this thread will be quite long. Mark the case with my name.

Related