STM32F3 Discovery USART1 Problem
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-01-10 3:29 AM
Posted on January 10, 2016 at 12:29The original post was too long to process during our migration. Please click on the attachment to read the original post.
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-01-10 7:17 AM
Posted on January 10, 2016 at 16:17
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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-01-10 8:32 AM
Posted on January 10, 2016 at 17:32
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=awV40t2MGtoOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-01-10 8:56 AM
Posted on January 10, 2016 at 17:56
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
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-01-10 8:33 PM
Posted on January 11, 2016 at 05:33
Thanks clive1.
I just fixed my problem.The problem was cable problem.and i respect your advice and change my code.thank you.