2020-12-21 11:17 AM
Hi!
I'm trying to make 16-bit ADC measurement works but I have some trouble understanding the argument Channel.
First I have these SD-ADC channels.
SDADC1 have:
SDADC3 have:
I have study this example and do the same thing as the example does:
Yes, it works. But I have 5 measurements, not 1 measurement as the example shows.
I have created a call-back function for the NVIC interrupts for the SDADC's.
But still, I cannot get a stable value, because I'm indexing in wrong channel. Do you know how to do this?
Should I start with
CHANNEL = 0;
Or what should I do?
uint32_t CHANNEL
void HAL_SDADC_InjectedConvCpltCallback(SDADC_HandleTypeDef *hsdadc){
if(hsdadc->Instance == SDADC1){
// SD ADC 1
if(CHANNEL == 4)
SD_ADC_VALUES[0] = HAL_SDADC_InjectedGetValue(hsdadc, &CHANNEL);
else if(CHANNEL == 8)
D_SD_ADC_VALUES[0] = HAL_SDADC_InjectedGetValue(hsdadc, &CHANNEL);
else if(CHANNEL == 6)
D_SD_ADC_VALUES[1] = HAL_SDADC_InjectedGetValue(hsdadc, &CHANNEL);
}else if(hsdadc->Instance == SDADC3){
if(CHANNEL == 6)
SD_ADC_VALUES[1] = HAL_SDADC_InjectedGetValue(hsdadc, &CHANNEL);
else if(CHANNEL == 8)
D_SD_ADC_VALUES[2] = HAL_SDADC_InjectedGetValue(hsdadc, &CHANNEL);
}
}