mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-27 02:40:00 +08:00
fix finsh can't use USART2 in STM32F107
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@182 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
2cac413f95
commit
2ec0cdb72c
5 files changed
+326
-34
No files matched your search
+6
-6
@@ -94,8 +94,8 @@ void rt_hw_board_init()
|
||||
}
|
||||
|
||||
#if STM32_CONSOLE_USART == 1
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_9
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_10
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_9
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_10
|
||||
#define CONSOLE_GPIO GPIOA
|
||||
#define CONSOLE_USART USART1
|
||||
#define CONSOLE_RCC RCC_APB2Periph_USART1
|
||||
@@ -103,14 +103,14 @@ void rt_hw_board_init()
|
||||
#elif STM32_CONSOLE_USART == 2
|
||||
|
||||
#if defined(STM32F10X_LD) || defined(STM32F10X_MD) || defined(STM32F10X_CL)
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_6
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_5
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_6
|
||||
#define CONSOLE_GPIO GPIOD
|
||||
#define CONSOLE_RCC RCC_APB1Periph_USART2
|
||||
#define CONSOLE_RCC_GPIO RCC_APB2Periph_GPIOD
|
||||
#elif defined(STM32F10X_HD)
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_3
|
||||
#define CONSOLE_TX_PIN GPIO_Pin_2
|
||||
#define CONSOLE_RX_PIN GPIO_Pin_3
|
||||
#define CONSOLE_GPIO GPIOA
|
||||
#define CONSOLE_RCC RCC_APB1Periph_USART2
|
||||
#define CONSOLE_RCC_GPIO RCC_APB2Periph_GPIOA
|
||||
@@ -154,13 +154,13 @@ static void rt_hw_console_init()
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
/* Configure USART Tx as alternate function push-pull */
|
||||
GPIO_InitStructure.GPIO_Pin = CONSOLE_RX_PIN;
|
||||
GPIO_InitStructure.GPIO_Pin = CONSOLE_TX_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(CONSOLE_GPIO, &GPIO_InitStructure);
|
||||
|
||||
/* Configure USART Rx as input floating */
|
||||
GPIO_InitStructure.GPIO_Pin = CONSOLE_TX_PIN;
|
||||
GPIO_InitStructure.GPIO_Pin = CONSOLE_RX_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(CONSOLE_GPIO, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
// <o> Console on USART: <0=> no console <1=>USART 1 <2=>USART 2 <3=> USART 3
|
||||
// <i>Default: 1
|
||||
#define STM32_CONSOLE_USART 1
|
||||
#define STM32_CONSOLE_USART 2
|
||||
|
||||
void rt_hw_board_led_on(int n);
|
||||
void rt_hw_board_led_off(int n);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System */
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_UART1
|
||||
#define RT_USING_UART2
|
||||
|
||||
/* SECTION: Console options */
|
||||
/* the buffer size of console*/
|
||||
@@ -64,7 +64,7 @@
|
||||
/* Using symbol table */
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_DEVICE_NAME "uart1"
|
||||
#define FINSH_DEVICE_NAME "uart2"
|
||||
|
||||
/* SECTION: device filesystem */
|
||||
#define RT_USING_DFS
|
||||
|
||||
@@ -156,31 +156,6 @@ void DMA1_Channel2_IRQHandler(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DMA1_Channel6_IRQHandler
|
||||
* Description : This function handles DMA1 Channel 6 interrupt request.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void DMA1_Channel6_IRQHandler(void)
|
||||
{
|
||||
#ifdef RT_USING_UART2
|
||||
extern struct rt_device uart2_device;
|
||||
extern void rt_hw_serial_dma_rx_isr(struct rt_device *device);
|
||||
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
/* clear DMA flag */
|
||||
DMA_ClearFlag(DMA1_FLAG_TC6 | DMA1_FLAG_TE6);
|
||||
rt_hw_serial_dma_rx_isr(&uart2_device);
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : USART1_IRQHandler
|
||||
* Description : This function handles USART1 global interrupt request.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user