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

15.2 proximity example, NRFX SAADC driver not updating battery service value

Hello,

I have the proximity example updating the battery service value fine using the provided nrf_drv_saadc.h driver.
When converting the saadc driver to NRFX (nrfx_saadc.h), and repeating the battery service, the value remains at 0x64,
whereas before a value would be say 0x27 when using cr2032 on the DK.
RTT shows normal.

Attached is the revised proximity example for nrfx on SES 832 DK.

thank-you,

ble_app_proximity-2.zip

Parents
  • Hi Simon,

    I think the main reason is that you cannot send NULL for nrfx_saadc_init and i think we will need to fix it in our documentation.

    for now change your code from 

    nrfx_saadc_init(NULL, saadc_event_handler);

    to 

    nrfx_saadc_init(NRFX_SAADC_DEFAULT_CONFIG, saadc_event_handler);

    And I think this should work.

Reply
  • Hi Simon,

    I think the main reason is that you cannot send NULL for nrfx_saadc_init and i think we will need to fix it in our documentation.

    for now change your code from 

    nrfx_saadc_init(NULL, saadc_event_handler);

    to 

    nrfx_saadc_init(NRFX_SAADC_DEFAULT_CONFIG, saadc_event_handler);

    And I think this should work.

Children
  • Probably best to give a quick test and see if it even compiles (code in zip had been provided).

    too few arguments to function 'nrfx_saadc_init'

    thank-you,

  • my bad sorry. 

    I changed the init function to this and checked on my phone to see if I am getting proper battery notifications and it seems to be correct.

    My change was in ad_configure()

  • made the change, but it seems to be back to where it was before this last change.
    for instance, insert cr2032 into DK, power on, connect to proximity, battery service, cccd,
    after a few seconds from 0x64 the value should change, but value the same at 0x64.
    anywhere else?

    thank-you,

  • Which DK are you testing this on, why are we seeing different results with the same configuration? I am not looking into RTT but I connected it to my phone nRF Connect app and it seems to be working OK. After 5 minutes the battery shows 28% and it keeps on reducing every 15-20 seconds

  • good to know that nrfx is confirmed with the coin (was not sure from an earlier post if a coin was tested).
    Started from scratch again, repeated conversion steps, and maybe cache was cleared or something,
    but now good and BAS data is changing on 832 DK.

    thank-you,