2024-10-31 03:44 AM
Hi all,
I am trying to activate SDADC on my custom designed board to measure a couple of analog voltages.
I am trying to measure 5-channels in injected continuous mode. Offset = 0, Gain = 1, Single-Ended Offset Mode. See the CUBE settings below :
In the code, I initiate the conversion by the following :
void SDADC_Start_Conversion (void)
{
if (HAL_SDADC_InjectedStart_IT(&hsdadc1) != HAL_OK)
{
/* An error occurs during the configuration of the injected conversion in interrupt mode */
Error_Handler();
}
}
Then I debug my code with a breakpoint in the callback function to see output data of the SDADC.
void HAL_SDADC_InjectedConvCpltCallback(SDADC_HandleTypeDef *hsdadc1)
{
/* Get conversion value */
InjectedConvData = HAL_SDADC_InjectedGetValue(hsdadc1, (uint32_t *) &InjChannel);
cnv_ready=1;
}
The thing is that all outputs are 32767. Channel number changes correctly so I think SDADC is successfully making some conversions.
As for the HW side; I measured all five voltages on my board and they are all OK and under the SDADC limit. I have voltages varying from 1.5V to 2.6V.
I am using a precise 3V at the VREFSD+ input and all other supplies are connected to 3.3V. I measured my reference voltage and it stands exactly at 3V. See below the power supply schematic :
Since I could not see anything wrong on the HW, I lean more towards this being a SW issue.
I would really appreciate if you could shed some light on this. I am mainly a HW guy who is doing firmware for diagnostics purposes so it is likely that I am missing a crucial step somewhere.