Can not set bit SWSTART to start convert ADC in STM32F103xG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-05 12:21 AM - last edited on ‎2024-03-05 8:06 AM by mƎALLEm
I'm learning STM32 with the board above and trying to program the ADC conversion.
However, when i start debug with keilC and observe the Adc value, nothing happen.
I check the ADC register and realized the SWSTART can not be set to start conversion process.
this is my source code:
- Labels:
-
ADC
-
STM32F1 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-05 5:18 AM
Read out and print the values in the ADC1 registers. Apart from SWSTART, do they match what you are expecting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-05 7:17 AM - edited ‎2024-03-05 7:19 AM
ADC_CR2.SWSTART starts conversion only if ADC_CR2.EXTSEL is set to 0b111.
Other remarks:
- you need to perform calibration first, otherwise results will be offset
- ADC_SR is to be cleared by direct assignment of 0, not &=
- sampling time setup is suspicious, I haven't checked which channel is it for but comment says different channel than selected for sequence
- you haven't finished the GPIO setup
JW
