Hello Dev Zone.
thanks for watching mt ask.
I need help.
I have 2 question.
1. I need use saadc continuous sampling
in SDK example, is it continuous Mode?
it looks like simple tesk Mode call by timer int every time.
if i set saadc register like this
// No automatic sampling, will trigger with TASKS_SAMPLE. NRF_SAADC->SAMPLERATE = SAADC_SAMPLERATE_MODE_Timers << SAADC_SAMPLERATE_MODE_Pos; // Sample Rate is 16 MHz / CC // CC [80 ~ 2047] 200KHz ~ 7.816KHz NRF_SAADC->SAMPLERATE |= 0x00000535;
is it working continuous sampling also?
2. continuous sampling buffer set
if i use all saadc channel 0 to 7
// Configure result to be put in RAM at the location of "result" variable. NRF_SAADC->RESULT.MAXCNT = 8; // uint16_t adc_sample NRF_SAADC->RESULT.PTR = (uint32_t)&adc_sample;
temp = adc_sample[4];
can i use like that?
thanks for help
//+add This is my full init Code for SAADC 0 - 7 Channel for(uint8_t i = 0; i<8; i++) { // Configure SAADC singled-ended channel, Internal reference (0.6V) and 1/6 gain. NRF_SAADC -> CH[i].CONFIG = (SAADC_CH_CONFIG_GAIN_Gain1_6 << SAADC_CH_CONFIG_GAIN_Pos) | (SAADC_CH_CONFIG_MODE_SE << SAADC_CH_CONFIG_MODE_Pos) | (SAADC_CH_CONFIG_REFSEL_Internal << SAADC_CH_CONFIG_REFSEL_Pos) | (SAADC_CH_CONFIG_RESN_Bypass<< SAADC_CH_CONFIG_RESN_Pos)| (SAADC_CH_CONFIG_RESP_Pulldown<< SAADC_CH_CONFIG_RESP_Pos)| (SAADC_CH_CONFIG_TACQ_10us<< SAADC_CH_CONFIG_TACQ_Pos); // Configure the SAADC channel with VDD as positive input, no negative input(single ended). //NRF_SAADC->CH[i].PSELP = SAADC_CH_PSELP_PSELP_AnalogInput5 << SAADC_CH_PSELP_PSELP_Pos; NRF_SAADC->CH[i].PSELP = (unsigned long) (i+1UL) << SAADC_CH_PSELP_PSELP_Pos; NRF_SAADC->CH[i].PSELN = SAADC_CH_PSELN_PSELN_NC << SAADC_CH_PSELN_PSELN_Pos; } // Configure the SAADC resolution. NRF_SAADC->RESOLUTION = SAADC_RESOLUTION_VAL_12bit << SAADC_RESOLUTION_VAL_Pos; // Configure result to be put in RAM at the location of "result" variable. NRF_SAADC->RESULT.MAXCNT =8; NRF_SAADC->RESULT.PTR = (uint32_t)&adc_sample; // No automatic sampling, will trigger with TASKS_SAMPLE. NRF_SAADC->SAMPLERATE = SAADC_SAMPLERATE_MODE_Timers << SAADC_SAMPLERATE_MODE_Pos; // Sample Rate is 16 MHz / CC // CC [80 ~ 2047] 200KHz ~ 7.816KHz NRF_SAADC->SAMPLERATE |= 0x00000535; Enable SAADC (would capture analog pins if they were used in CH[0].PSELP) NRF_SAADC->ENABLE = SAADC_ENABLE_ENABLE_Enabled << SAADC_ENABLE_ENABLE_Pos; // Calibrate the SAADC (only needs to be done once in a while) NRF_SAADC->TASKS_CALIBRATEOFFSET = 1; while (NRF_SAADC->EVENTS_CALIBRATEDONE == 0); NRF_SAADC->EVENTS_CALIBRATEDONE = 0; while (NRF_SAADC->STATUS == (SAADC_STATUS_STATUS_Busy << SAADC_STATUS_STATUS_Pos)); NRF_SAADC->TASKS_START = 1;