File tree Expand file tree Collapse file tree
STM32F4/cores/maple/libmaple Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,8 +94,14 @@ void HardwareSerial::begin(uint32 baud) {
9494 const stm32_pin_info *rxi = &PIN_MAP[rx_pin];
9595#ifdef STM32F2
9696 // int af = 7<<8;
97- gpio_set_af_mode (txi->gpio_device , txi->gpio_bit , 7 );
98- gpio_set_af_mode (rxi->gpio_device , rxi->gpio_bit , 7 );
97+ if (usart_device == UART4 || usart_device == UART5) {
98+ gpio_set_af_mode (txi->gpio_device , txi->gpio_bit , 8 );
99+ gpio_set_af_mode (rxi->gpio_device , rxi->gpio_bit , 8 );
100+ }
101+ else {
102+ gpio_set_af_mode (txi->gpio_device , txi->gpio_bit , 7 );
103+ gpio_set_af_mode (rxi->gpio_device , rxi->gpio_bit , 7 );
104+ }
99105 gpio_set_mode (txi->gpio_device , txi->gpio_bit , (gpio_pin_mode)(GPIO_AF_OUTPUT_PP | GPIO_PUPD_INPUT_PU | 0x700 ));
100106 gpio_set_mode (rxi->gpio_device , rxi->gpio_bit , (gpio_pin_mode)(GPIO_MODE_AF | GPIO_PUPD_INPUT_PU | 0x700 ));
101107 // gpio_set_mode(txi->gpio_device, txi->gpio_bit, (gpio_pin_mode)(GPIO_PUPD_INPUT_PU));
You can’t perform that action at this time.
0 commit comments