stm32f446 Enabling USART send unwanted byte
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-07-10 01:37 PM
Hi,
When I enable my USART peripheral it sends an unwanted byte interpreted as 0xFE.
To enable the USART peripheral, I first enable it in the APBENR register then I reset it through APBRSTR.
I then disable flow control, and program the baudrate.
I then configure the number of stop bits (0, this is quasi default communication) and then I enable USART through CR1 register. After that all what is left is to enable the TE and RE bit in CR1.
After sending this unwanted byte, it all works very well because I can send data without any problem at the correct baudrate. There is juste this annoying byte that get sent first...
Do you have any idea where I should look ?
I think it may be related to this note in the datasheet :
Note: 1: During transmission, a “0�? pulse on the TE bit (“0�? followed by “1�?) sends a preamble
(idle line) after the current word, except in smartcard mode. 2: When TE is set there is a 1 bit-time delay before the transmission starts.Thanks a lot & have a nice day !
Note: this post was migrated and contained many threaded conversations, some content may be missing.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-07-11 07:16 AM
Not that I know of.
Except enabling the clock for the appropriate GPIO port.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-07-11 08:09 AM
I am currently implementing an
for the micro-controller, and the language is not C so I don't think showing code would be really useful.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-07-11 08:12 AM
I think I have a problem with my GPIO configuration because by default when I enable them there is the same signal that appears on the logical analyzer...
My routine for the GPIO is :
- Enable the gpio in AHB1 (i use GPIOC)
- Set the output to push-pull in OTYPER
- Set the output to pull_up in PUPDR
- Write the AF mode in MODER then in AFR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-07-11 09:50 PM
I set up the USART first and turn the TX pin as output later. The USART ticks out the byte, but it's not getting out of the chip. And that's why I also use TXEIE to start/stop transmission, not TCIE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-07-12 05:31 AM
I agree with Juha. For standard serial I/O, I would try only enabling the transmitter as part of the output service routine, and disable it when no data was ready to go. When I had data ready to transmit, and in the transmit output register, then I would enable the transmitter (really enable the transmit register empty interrupt).
- « Previous
-
- 1
- 2
- Next »