Reading from ADC is not working
Closed this issue · 1 comments
Hi,
First of all -thank you for this great project!
I've encountered an issue while connecting to pins of STM32 ADC - the coming data is not from the pins, seems like an ADC setup issue.
My own function monitors data readings number and the data itself(from ADC).
COM_getADCData() test:
217; 777; 268; 1; 294; 335; 253; - data
COM_getADCData() readings:
1068; 1068; 1068; 1068; 1068; 1067; 1067; -readings number
Readings number increases, while data is floating near those values. What can be wrong? This is a setup for adc_cfg:
#define BS_NR_OF_VOLTAGES_FROM_MCU_ADC 7
uint32_t adc_ChannelList[BS_NR_OF_VOLTAGES_FROM_MCU_ADC] = {ADC_CHANNEL_VBAT, ADC_CHANNEL_TEMPSENSOR, ADC_CHANNEL_0, ADC_CHANNEL_1, ADC_CHANNEL_2, ADC_CHANNEL_3, ADC_CHANNEL_4};
I've tried to tie the pins to VCC and GND, but nothing changes. It remains at values of 290-340 while ADC_CHANNEL_1 is zero. Looks strange. And it does not react for touching VCC and GND.
Maybe you have some ideas, why it is happening?
Best regards,
Fedor.
Fixed by using:
uint32_t adc_ChannelList[BS_NR_OF_VOLTAGES_FROM_MCU_ADC] = {ADC_CHANNEL_VBAT, ADC_CHANNEL_TEMPSENSOR, ADC_CHANNEL_14, ADC_CHANNEL_15, ADC_CHANNEL_8, ADC_CHANNEL_9, ADC_CHANNEL_1};
Now everything works! :D