Hallo, ich habe einen SM3210e-Eval board mit einem STM32F103Z Prozessor von ARM drauf und habe das Problem das wenn ich was sende ich am Terminal was ganz anderes raus bekomme.... Ich sende 0x49 bekomme 8698 (Hex) angezeigt Ich sende (uint8_t *)'A' bekomme FE06 (Hex) angezeigt Ich sende (uint8_t *)'0' bekomme F800 (Hex) angezeigt Denke meine GPIO sollte stimmen das ich ja was empfange. An meinem Terminal sollte auch alles richtig sein: Baud:9600 Data:8 Stop:1 Parity:None Hier mein Code....
1 | USART_InitTypeDef USART_InitStructure; |
2 | |
3 | |
4 | void main(void) |
5 | {
|
6 | |
7 | Init(); |
8 | Config_ADC(); |
9 | Config_Usart(); |
10 | ...
|
11 | |
12 | while(1) |
13 | {
|
14 | USART_SendData(USART1,0x49); // |
15 | /* Loop until the end of transmission */
|
16 | while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) |
17 | {
|
18 | }
|
19 | }
|
20 | }
|
21 | |
22 | void Config_Usart() |
23 | {
|
24 | |
25 | //enable bus clocks
|
26 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE); |
27 | |
28 | /* Configure USART2 Tx as alternate function push-pull */
|
29 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; |
30 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; |
31 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; |
32 | GPIO_Init(GPIOA, &GPIO_InitStructure); |
33 | |
34 | USART_InitStructure.USART_BaudRate = 9600; |
35 | USART_InitStructure.USART_WordLength = USART_WordLength_8b; |
36 | USART_InitStructure.USART_StopBits = USART_StopBits_1; |
37 | USART_InitStructure.USART_Parity = USART_Parity_No; |
38 | USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; |
39 | USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; |
40 | /* Configurating and enabling USART1 */
|
41 | USART_Init(USART1, &USART_InitStructure); |
42 | |
43 | |
44 | USART_Cmd(USART1, ENABLE); |
45 | }
|