1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

gpio: stop enabling pull-ups on all GPIOs in bootloader

The bootloader has been enabling pull-ups on all GPIO
pins during early init.  These pull-ups are disabled
immediately before jumping to the firmware.  This transition
results in all servos seeing a wide pulse as the board
resets making them jerk sideways aggresively and then snap
back to neutral.
This commit is contained in:
Stacey Sheldon 2012-04-16 14:41:25 -04:00 committed by James Cotton
parent 14cc9ef57c
commit 2ec197298b

View File

@ -55,20 +55,10 @@ void PIOS_SYS_Init(void)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE |
RCC_APB2Periph_AFIO, ENABLE); RCC_APB2Periph_AFIO, ENABLE);
/* Activate pull-ups on all pins by default */
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_InitStructure.GPIO_Pin = 0xffff;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_Init(GPIOD, &GPIO_InitStructure);
#if (PIOS_USB_ENABLED)
GPIO_InitStructure.GPIO_Pin = 0xffff & ~GPIO_Pin_11 & ~GPIO_Pin_12; /* Exclude USB pins */
#endif
GPIO_Init(GPIOA, &GPIO_InitStructure);
#if (PIOS_USB_ENABLED) #if (PIOS_USB_ENABLED)
/* Ensure that pull-up is active on detect pin */ /* Ensure that pull-up is active on detect pin */
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_InitStructure.GPIO_Pin = PIOS_USB_DETECT_GPIO_PIN; GPIO_InitStructure.GPIO_Pin = PIOS_USB_DETECT_GPIO_PIN;
GPIO_Init(PIOS_USB_DETECT_GPIO_PORT, &GPIO_InitStructure); GPIO_Init(PIOS_USB_DETECT_GPIO_PORT, &GPIO_InitStructure);