Associate II
June 28, 2012
Question
Switching GPIO cause ripple on VDDA. Very strange problem.
- June 28, 2012
- 9 replies
- 2780 views
Posted on June 28, 2012 at 16:39
Good day everybody !
I have two strange problems with GPIO in STM32L151CBU61) This code I compile in Keil. Using an oscilloscope I see the time ports switching. Why PB7 switches slower than PA5 PA11 ? HSI_ON; SYSTEM_CLOCK_HSI; RCC->AHBENR |= RCC_AHBENR_GPIOBEN | RCC_AHBENR_GPIOAEN; GPIOA->MODER &= ~GPIO_MODER_MODER5; GPIOA->MODER |= GPIO_MODER_MODER5_0; //PA5 is output GPIOA->OSPEEDR|= GPIO_OSPEEDER_OSPEEDR5; // Maximum speed PA5 GPIOA->MODER &= ~GPIO_MODER_MODER11; GPIOA->MODER |= GPIO_MODER_MODER11_0; //PA11 is output GPIOA->OSPEEDR|= GPIO_OSPEEDER_OSPEEDR11; // Maximum speed PA11 GPIOB->MODER &= ~GPIO_MODER_MODER7; GPIOB->MODER |= GPIO_MODER_MODER7_0; //PB7 is output GPIOB->OSPEEDR|= GPIO_OSPEEDER_OSPEEDR7; // Maximum speed PB7 while(1) { GPIOA->BSRRL=GPIO_BSRR_BS_5; //Hi level on PA5 GPIOA->BSRRH=GPIO_BSRR_BS_5; //Low level PA5 GPIOA->BSRRL=GPIO_BSRR_BS_11; //Hi level on PA11 GPIOA->BSRRH=GPIO_BSRR_BS_11; //Low level PA11 GPIOB->BSRRL=GPIO_BSRR_BS_7; //Hi level on PB7 GPIOB->BSRRH=GPIO_BSRR_BS_7; //Low level PB7 } 2)But problem number 1 is very important. I do not need fast switch on PB7. Real trouble is that switching PA5 causes current consumption pulsation on VDDA ! This pulsation causes changes in the ADC readings. ?apacitors on VDDA do not solve the problem. In attachment there is measurement scheme and pulsations with amplitude 100mV when transmitting one byte through SPI1 , SCK of which is on PA5. When switching PA11 or PB7 , there is no pulsations on VDDA. Why PA5 is associated with VDDA in so strange way ? How to get the correct results from ADC when switching PA5 ?Thank you in advanceMikhail Polyakov,Moskow.A5. #gpio-vdda-ripple-pulsations