2016-01-10 03:29 AM
2016-01-10 07:17 AM
When sending characters to the USART you need to check TXE is asserted before each byte, your string output functions completely ignore that.
Sending dozens of characters in the IRQ Handler is a poor plan, the buffer depth is a single character, you need to buffer the data on the software side, and output at each TXE assertion. Your use of include files suggests you aren't passing the right defines into the compiler. Check again the project options in the templates for your tool chain.2016-01-10 08:32 AM
Thanks clive1.
I just checked my source, and edit some code. -------------------------------------------- void SerialPutString(char *c) { while(*c) { USART_SendData(USART1, (uint16_t)*c++); while(USART_GetFlagStatus(USART1, USART_FLAG_TXE)==RESET); } }// USART1_IRQHandler
// GetChar interrupt Call // USART1 ìž…ë ¥ì„¤ì • í�?Œëž˜ê·¸ê°€ 세트ë�˜ë©´ 호출ë�¨. void USART1_IRQHandler(void) { uint16_t C; char s[20];if(USART_GetITStatus(USART1,USART_IT_RXNE) != RESET)
{ C = USART_ReceiveData(USART1); sprintf(s,''Data : %c : %#x\r\n'',C,C); SerialPutString(s); SerialPutString(''\r\n''); } } -------------------------------------------- But, the problem was not fixed. See my youtube : https://www.youtube.com/watch?v=awV40t2MGto2016-01-10 08:56 AM
void SerialPutString(char *c)
{
while(*c)
{
while(USART_GetFlagStatus(USART1, USART_FLAG_TXE)==RESET); // **BEFORE** - IS REGISTER EMPTY TO RECEIVE NEXT CHAR
USART_SendData(USART1, (uint16_t)*c++);
}
}
Make sure the setting of HSE_VALUE matches the 8 MHz clock source used.
You serial header has three pins, looks to use just two, do the two boards share a common ground?
I'd suggest outputting a stream of 'U' characters and checking the baud rate settings on a scope.
The output from the STM32 is at CMOS levels, not RS232 levels
2016-01-10 08:33 PM
Thanks clive1.
I just fixed my problem.The problem was cable problem.and i respect your advice and change my code.thank you.