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

The ble_app_proximity example of the nRF51 SDK8.1 don't work

I built the ble_app_proximity project and down load into my board, it can advertise and can connected by the lightblue and the nRF toolbox, But i sent the hex value of 0x02 via alert Level characteristic, it can't callback the "ble_bas_on_ble_evt", also i used the nRF toolbox App and clicked "FindMe", it also can't callback the "ble_bas_on_ble_evt". and the nRF toolbox App can't get battry infomation of the device. Also I can't enabe the notification of the battery level characteristic. I used the SDK version 10, it also can't work. I use iar to build the project. What can I do next to solve this problem.

Parents
  • Hi

    With the nRF Toolbox App, you need to bond before sending the alert in order for the alert to work on the nRF51 device.

    For the battery service, it did not work immediately on my side either, then I realized that the notification interval for the battery service was 120 seconds for the ble_app_proximity example in SDK 10. I decreased that to 1.2 seconds by defining:

    #define BATTERY_LEVEL_MEAS_INTERVAL         APP_TIMER_TICKS(1200, APP_TIMER_PRESCALER)
    

    then the notifications started to come through. Also, the example is set up to sample the supply voltage directly on the nRF51-DK board. If you instead initialize the ADC to sample from a pin like:

    nrf_adc_config_t adc_config = NRF_ADC_CONFIG_DEFAULT;
    adc_config.scaling = NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD;
    nrf_adc_configure(&adc_config); 
    nrf_adc_int_enable(ADC_INTENSET_END_Msk);
    NVIC_EnableIRQ(ADC_IRQn);
    NVIC_SetPriority(ADC_IRQn, 3);
    nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_3);
    

    Then the ADC samples voltage on pin P0.02 instead. If you short P0.02 to VDD, then you will see some battery value sent to the phone.

    For the Android nRFToolbox app, the app does not display battery value when there is low voltage measured, so I see nothing happen in the nRFToolbox when I short P0.02 to ground. You should however see change if you apply voltage to P0.02 from external power supply

  • Thanks Stefan, It can callback the "alert_signal" function now thanks.

Reply Children
No Data
Related