2022-11-26 01:12 AM
Hi everybody! Could please someone enlighten me on the data output format of the ADC1, on regular channels without oversampling, everything is set to default values? Just enabled one channel and converted it. The thing is, I use 2.5v internal reference, when I connect the input to GND, after conversion I get 0x3FFF, but when the input is connected to +3.3v, the data register reads zero. So please if someone could explain what is the data format and why do I get such interesting values.
Thank you!
Solved! Go to Solution.
2022-11-26 11:24 PM
Figured out what was the cause of the problem. The point is, ADC1 requires its clock to be in 5Mhz-55Mhz range. In my case HCLK was 160Mhz and accidentally I was writing ADC1 clock division bits one line before I enabled the whole business in the RCC_AHB2ENR1 register, so the division bits never got written. Silly me. Glad it all works now! Thank you guyz!
2022-11-26 02:25 AM
Which STM32?
> The thing is, I use 2.5v internal reference
How?
JW
2022-11-26 05:06 AM
There are many different adc variations across the STM32 portfolio. The ones capable of differential mode can probably be configured to what you observe....
2022-11-26 06:30 AM
Oh sorry, forgot to mention, i use NUCLEO-U575 board and dont play with data format, i only power the ADC1 one up, set one channel up and see what values the ADC1 gives. On that board, the ADC1 channels certainly can be configured in differential mode, but i didnt do that. What actually surprises me is the fact, that +3.3v shows zero and GND gives 0x3FFF
2022-11-26 10:19 AM
Best way to learn, go debug mode after stopping a basic code. Use adc and gpio hw register view and edit them manually until it does what you want.
You can keep a pin floating and use the selectable internal pull up xor down to play with the adc.
2022-11-26 02:00 PM
Will do that. Thank you . !
2022-11-26 11:24 PM
Figured out what was the cause of the problem. The point is, ADC1 requires its clock to be in 5Mhz-55Mhz range. In my case HCLK was 160Mhz and accidentally I was writing ADC1 clock division bits one line before I enabled the whole business in the RCC_AHB2ENR1 register, so the division bits never got written. Silly me. Glad it all works now! Thank you guyz!