2025-06-06 12:33 AM
Dear ST
I am encountering an issue with our current setup involving an Analog-to-Digital Converter (ADC) and a Microcontroller Unit (MCU).
The ADC is successfully receiving the input voltage when measured directly at its pins. However, the MCU connected to the ADC does not appear to be reading this voltage data. Consequently, I am unable to visualize the voltage output in our software interface.
Here are some details that might be helpful:
Could you please provide some guidance or assistance in diagnosing and resolving this issue? I suspect it might be related to [mention your suspicion if you have one, e.g., "incorrect MCU configuration for ADC communication," "driver issues," "software library incompatibility"].
Please let me know if you require any further information, such as code snippets, schematics, or specific register settings.
Email, shivabaln@dncltech.com
2025-06-11 12:56 PM
Troubleshooting Steps Taken So Far:
- Confirmed voltage at ADC input pins using a multimeter.
- Checked physical connections between ADC and MCU for continuity.
- Verified power supply to both ADC and MCU.
Did you check with an oscilloscope to be sure that the STM32's SPI bus is clocking and has data?
You return HAL status on your call to ADS_Cmd_Write inside ADS_Read_All_Raw. But you don't check the HAL status returned from ADS_Read_All_Raw. So, you are printing data without checking the HAL status to insure you have valid data returned.
while (1)
{
/* USER CODE END WHILE */
current = HAL_GetTick();
/* USER CODE END WHLE */
/* USER CODE BEGIN 3 */
if(previous<current) {
unsigned long now = HAL_GetTick();
ADS_Read_All_Raw(&ads, ads_data);
for(int i=0; i<8; i++) {;
volt_helper = ((float)ads_data[i])*2.5f/65535.0f;
volt[i] = (int)(volt_helper*100000000);
printf("CHN_%d: %u "BYTE_TO_BIN_PAT" "BYTE_TO_BIN_PAT" %d.%d\n", i, (uint16_t)(ads_data[1]<<8 | ads_data[0]), BYTE_TO_BIN(ads_data[1]), BYTE_TO_BIN(ads_data[0]), volt[i]/100000000, volt[i]%100000000);
}
2025-06-11 2:57 PM
Start simple. Hook up a scope, send a command, then a Command Read-Back Register command.