2017-10-18 01:31 AM
Hi All,
I tried to use USART6 but the data I sended is corrupted, I check the baudRate bur its looks fine(9600 bps), I add the screen shot of oscilloscope I send 0x79(0b0111 1001) but its showed me irrelevant data, also I tired the diffrent baudrate but result was same,
Here is my USART6 initialization code;GPIO_InitTypeDef GPIO_InitStruct;
USART_InitTypeDef USART_InitStr; RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); GPIO_PinAFConfig(GPIOC, GPIO_PinSource6, GPIO_AF_USART6); GPIO_PinAFConfig(GPIOC, GPIO_PinSource7, GPIO_AF_USART6); GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(GPIOC, &GPIO_InitStruct); USART_InitStr.USART_BaudRate = 9600; USART_InitStr.USART_WordLength = USART_WordLength_8b; USART_InitStr.USART_StopBits = USART_StopBits_1; USART_InitStr.USART_Parity = USART_Parity_No; USART_InitStr.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStr.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; USART_Init(USART6, &USART_InitStr);USART_Cmd(USART6, ENABLE);I send with, USART_SendData(USART6, 0x79);
The response I read on terminal 0b1111 1001(Dec: 159)(Hx: F9)
Thanks in advanced.
Yigit
2017-10-18 02:01 AM
Do the settings of your terminal really match (number of bits, stop bits, parity) ?
What do you receive on your F407 board when you send characters from the terminal ?
You can loop back your UART (connect TX to RX), and check what you receive.
2017-10-18 02:15 AM
Hi
meyer.frank
, Thank you for your reply,I already set my terminal to USART6, and when I send data from terminal, this data
corrupted to,
Send 'a'(0x61) -> Response 0xA1
2017-10-18 02:39 AM
Now I tried send another data to teminal and the result is ;
TX(F407) RX(TeraTerm)
0b0111 1001 ------------------------------------> 0b1111 1001
0b0100 0111
------------------------------------>
0b1000 01110b0101 0100
----------------------------------->
0b1001 0100I guess some bits is missing, it could be stopbit but why is the stopbit missing?
2017-10-18 02:41 AM
meyer.frank
I use disco board, The connection between board and Pc by the TLL board(FTDI232)Rx->Tx
Tx->Rx
2017-10-18 04:01 AM
Here is the configuration of the terminal program and you're absolutely right about first bit, it is the first time I face like problem
2017-10-18 04:25 AM
Unfortunately it has not work for me, I did get this configuration from SPL examples, I wonder it might be problem with clock ?I checked but I couldnt see anything, I sharing this configuration, if you see anything wrong please tell me, thanks a lot
RCC_DeInit();
RCC_HSEConfig(RCC_HSE_ON); HSEStartUpStatus = RCC_WaitForHSEStartUp(); if (HSEStartUpStatus == SUCCESS) { RCC_HCLKConfig(RCC_SYSCLK_Div1); RCC_PCLK1Config(RCC_HCLK_Div4); RCC_PCLK2Config(RCC_HCLK_Div2); FLASH_SetLatency(FLASH_Latency_5); FLASH_PrefetchBufferCmd(ENABLE); RCC_PLLConfig(RCC_PLLSource_HSE, 4, 168, 2, 7); RCC_PLLCmd(ENABLE); while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) ; RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); while (RCC_GetSYSCLKSource() != 0x08) ;2017-10-18 04:34 AM
How is the connection done ?
Connecting the 3.3V output of the MCU directly to a COM port does not work, the levels do not match.
2017-10-18 04:58 AM
Ok I found the problem it was so annoying,
it is happen beacuse of 'HSE_VALUE' symbolic constant it was not equal to actual crystal value, how I forgot the fix it, Thank you so much my friend for try to help me, if I come to germany one day, I gonna order beer for you2017-10-18 05:06 AM
it was 25000000, but ı use 80000000