2020-12-01 10:44 PM
Hi all,
I am now working with STM32F205 ADC1 w/ code generated by STM32CubeMX. I find that ADC pin has a 0.5V output even it is unconnected (floating). I tried pin PC0 (channel 10) and PC1 (channel 11) one by one and both have the same problem. After some debugging, I find that this is due to the "End of Conversion Selection". If EOC is chosen as single channel, everything alright. But if I use end of all channel, voltage go wired. But I can't run in continuous mode if I choose single channel. So does anyone face the same problem?
Attached please find my project in VS code
BR,
Sin
Solved! Go to Solution.
2020-12-02 10:40 PM
The effect of the input capacitor switching may be more pronounced if you sample more often in a given pin.
Recommended input impedance is given in the datasheet. Effective impedance of the signal source can be decreased by adding a capacitor to ground, at the cost of decreased bandwidth (it's a lowpass filter). Other than that, use an opamp follower buffer.
Read the ADC application notes, links are on the given STM32's product webpage.
JW
2020-12-02 12:37 AM
This is normal. You are supposed to connect a relatively low impedance external signal source.
JW
2020-12-02 05:49 PM
Thanks for your answer :) Sorry but want to ask some more question:
1) Any suggestion range of impedance? Are there any documents mention about this?
2) Why this only occurs when I choose wait for all conversation end? It seems strange that it is software dependence
3) Same circuit is used with STM32F10X & it works
4) I have no idea on how to reduce my input impedance.
Sin
2020-12-02 10:40 PM
The effect of the input capacitor switching may be more pronounced if you sample more often in a given pin.
Recommended input impedance is given in the datasheet. Effective impedance of the signal source can be decreased by adding a capacitor to ground, at the cost of decreased bandwidth (it's a lowpass filter). Other than that, use an opamp follower buffer.
Read the ADC application notes, links are on the given STM32's product webpage.
JW
2021-12-13 10:11 PM
Ive found with a stm32L432 that if you have any pins set to GPIO out then then hdac1 DAC_CHANNEL_2 is limited to 0.5 volts
if you add say PB7 as a GPIO output changeing the .ioc and letting it generate the code it changes
from
static void MX_GPIO_Init(void)
{
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOA_CLK_ENABLE();
}
to
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
/*Configure GPIO pin : PB7 */
GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
The output on hdac1 DAC_CHANNEL_2 is limited to justo over 0.5 of a volt. this appears to be consistent for all ports I have tried so far. It doesnt appear to be documented at least Ive not been able to find any thing
2021-12-13 10:40 PM
Further it appears to be __HAL_RCC_GPIOA_CLK_ENABLE(); which refers to
in Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_hal_rcc.h
#define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
__IO uint32_t tmpreg; \
SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN); \
/* Delay after an RCC peripheral clock enabling */ \
tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_GPIOBEN); \
UNUSED(tmpreg); \
} while(0)
Which is clever white mans magic that looks like its some registery update
Any way it appears to break hdac1 DAC_CHANNEL_2 full range
2021-12-14 04:11 AM
Please don't hijack older threads, start your own, stating what hardware are you using, which STM32, what is the program, what are the symptoms and how are they different from the expectations.
JW
2021-12-14 02:18 PM
Having a look at the schematic it looks like there are 2 jumpers on the back of the board SB18 Connect D4 to A4 and SB16 Connect D5 to A5 if you want to use A4 (PA5) as an analoge output or a5 as an ADC these jumbers neet to be removed
2021-12-14 03:51 PM
This thread F2 ADC,
Your thread L4 DAC, guessing you're using a Nucleo-32, but really should be stated specifically