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

SAADC Snippet cannot follow

I tried implementing 

https://github.com/andenore/NordicSnippets/blob/master/examples/temp/main.c

But i get 2.6V without connecting any of the Analog pins.

Exactly which pin is it designed for?

and why is it reading 2.6V with no input on pinA0.

Parents
  • That code is not reading pin A0; See this:

      // Configure the SAADC channel with VDD as positive input, no negative input(single ended).
      NRF_SAADC->CH[0].PSELP = SAADC_CH_PSELP_PSELP_VDD << SAADC_CH_PSELP_PSELP_Pos;
      NRF_SAADC->CH[0].PSELN = SAADC_CH_PSELN_PSELN_NC << SAADC_CH_PSELN_PSELN_Pos;

    This information will help:

    // Analog positive and negative input channels have strange numbering:
    //  PSELP_NC           0UL  Not connected
    //  PSELP_AnalogInput0 1UL  AIN0
    //  PSELP_AnalogInput1 2UL  AIN1
    //  PSELP_AnalogInput2 3UL  AIN2
    //  PSELP_AnalogInput3 4UL  AIN3
    //  PSELP_AnalogInput4 5UL  AIN4
    //  PSELP_AnalogInput5 6UL  AIN5
    //  PSELP_AnalogInput6 7UL  AIN6
    //  PSELP_AnalogInput7 8UL  AIN7
    //  PSELP_VDD          9UL  VDD

Reply
  • That code is not reading pin A0; See this:

      // Configure the SAADC channel with VDD as positive input, no negative input(single ended).
      NRF_SAADC->CH[0].PSELP = SAADC_CH_PSELP_PSELP_VDD << SAADC_CH_PSELP_PSELP_Pos;
      NRF_SAADC->CH[0].PSELN = SAADC_CH_PSELN_PSELN_NC << SAADC_CH_PSELN_PSELN_Pos;

    This information will help:

    // Analog positive and negative input channels have strange numbering:
    //  PSELP_NC           0UL  Not connected
    //  PSELP_AnalogInput0 1UL  AIN0
    //  PSELP_AnalogInput1 2UL  AIN1
    //  PSELP_AnalogInput2 3UL  AIN2
    //  PSELP_AnalogInput3 4UL  AIN3
    //  PSELP_AnalogInput4 5UL  AIN4
    //  PSELP_AnalogInput5 6UL  AIN5
    //  PSELP_AnalogInput6 7UL  AIN6
    //  PSELP_AnalogInput7 8UL  AIN7
    //  PSELP_VDD          9UL  VDD

Children
No Data
Related