Hi,
i have some trouble with acting with the nrf 51822 ADCs. My Problem is that i have an Impuls which is 100 uS long and i have to measure it with 2 ADCs. I know that i can only use one at the Time becouse of the MUX in the ADCs. Thats why need to mesaure the impuls with alternating ADCs. Its like ADC1 -> ADC2 -> ADC1 ...
And here is my Problem, if i don't use alternating ADCs it works fine, the ADC i choose measures the Voltage. But if i want to mesure the Impuls with the Second ADC nothing happens. Also the First ADC does not work anymore.
Here is my Code ia using:
if (Messauswahl == false)
{
// config ADC
NRF_ADC->CONFIG = (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos) /* Bits 17..16 : ADC external reference pin selection. */
| (ADC_CONFIG_PSEL_AnalogInput3 << ADC_CONFIG_PSEL_Pos) /*!< Use analog input 0 as analog input. */
| (ADC_CONFIG_REFSEL_VBG << ADC_CONFIG_REFSEL_Pos) /*!< Use internal 1.2V bandgap voltage as reference for conversion. */
| (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling << ADC_CONFIG_INPSEL_Pos) /*!< Analog input specified by PSEL with no prescaling used as input for the conversion. */
| (ADC_CONFIG_RES_10bit << ADC_CONFIG_RES_Pos); /*!< 8bit ADC resolution. */
Messauswahl = true; } else { // config ADC
NRF_ADC->CONFIG = (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos) /* Bits 17..16 : ADC external reference pin selection. */
| (ADC_CONFIG_PSEL_AnalogInput4 << ADC_CONFIG_PSEL_Pos) /*!< Use analog input 0 as analog input. */
| (ADC_CONFIG_REFSEL_VBG << ADC_CONFIG_REFSEL_Pos) /*!< Use internal 1.2V bandgap voltage as reference for conversion. */
| (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling << ADC_CONFIG_INPSEL_Pos) /*!< Analog input specified by PSEL with no prescaling used as input for the conversion. */
| (ADC_CONFIG_RES_10bit << ADC_CONFIG_RES_Pos); /*!< 8bit ADC resolution. */
Messauswahl = false; }
// enable ADC
NRF_ADC->ENABLE = 1;
DAC (StimulationIntensitaet_T1 + Offset);
// start ADC conversion
NRF_ADC->TASKS_START = 1;
With "Messauswahl" i let the ADC change every time the function is called. The alternating works, i indicate this with an LED but the ADCs doesn't work with that configuration.
I think i am doing something wrong by setting up the CONFIG Register. Thanks for your Help.
Best regards Nils Minor