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.
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.
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
Hello,
It is true as @hmolesworth says, if you look at the lines of code he shared you will see that the SAADC channel measures the VDD using single-ended input.
Let me know if anything still should be unclear!
As a side note, it seems the link you meant to post is the SAADC sample, not the TEMP sensor sample which you linked in your ticket.
Best regards,
Karl
P.S Thank you @hmolesworth for your swift reply!
Yes, sorry for the mistake.
Can you tell me how to read from pin A0, using this code?
NRF_SAADC->CH[0].PSELP = PSELP_AnalogInput0 << SAADC_CH_PSELP_PSELP_Pos;
Thank you very much. That is helpful