23 #include "stm32f10x.h"
25 #ifdef USE_FULL_ASSERT
30 assert_failed(
"NO stm32f10x_conf in some file",0xffffffff);
47 #define TxBufferSize1 (countof(TxBuffer1) - 1)
48 #define TxBufferSize2 (countof(TxBuffer2) - 1)
49 #define RxBufferSize1 TxBufferSize2
50 #define RxBufferSize2 TxBufferSize1
53 #define countof(a) (sizeof(a) / sizeof(*(a)))
112 USART_InitStructure.USART_BaudRate = 9600;
113 USART_InitStructure.USART_WordLength = USART_WordLength_8b;
114 USART_InitStructure.USART_StopBits = USART_StopBits_1;
115 USART_InitStructure.USART_Parity = USART_Parity_No;
116 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
117 USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
120 USART_Init(
USARTy, &USART_InitStructure);
122 USART_Init(
USARTz, &USART_InitStructure);
125 USART_ITConfig(
USARTy, USART_IT_RXNE, ENABLE);
126 USART_ITConfig(
USARTy, USART_IT_TXE, ENABLE);
129 USART_ITConfig(
USARTz, USART_IT_RXNE, ENABLE);
130 USART_ITConfig(
USARTz, USART_IT_TXE, ENABLE);
133 USART_Cmd(
USARTy, ENABLE);
135 USART_Cmd(
USARTz, ENABLE);
174 #ifndef USE_STM3210C_EVAL
192 GPIO_InitTypeDef GPIO_InitStructure;
194 #ifdef USE_STM3210C_EVAL
196 GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE);
199 GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);
200 #elif defined USE_STM3210B_EVAL || defined USE_STM32100B_EVAL
202 GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);
207 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
216 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
217 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
232 NVIC_InitTypeDef NVIC_InitStructure;
235 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
239 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
240 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
241 NVIC_Init(&NVIC_InitStructure);
245 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
246 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
247 NVIC_Init(&NVIC_InitStructure);
259 while(BufferLength--)
261 if(*pBuffer1 != *pBuffer2)
273 #ifdef USE_FULL_ASSERT