cancel
Showing results for 
Search instead for 
Did you mean: 

I am developing a product that uses an STM32F103. I spent the last two days debugging the USART1 port due to multiple issues with the controlling SBC and the ARM GNU stdio lib.

PhilSter
Associate II

I got everything working but it turns out that there is an undocumented feature with the RTS line. Even after I bypassed the HW bug with the CAN peripheral (that was documented in your errata sheet), it still would not raise the RTS line when its RDR register was full.

The only way I could get it to work was to change the RTS GPIO pin from an alternate function push-pull to an alternate function open drain output (and add an external pull-up resistor). Apparently your firmware does not support alternate function push-pull with this pin (though it does with the TX pin).

IMHO this lack of a feature should be documented in the errata sheet because the fix requires a PCB change :(

4 REPLIES 4

> that was documented in your errata sheet

This is a primarily user-driven forum, with casual ST presence, so you perhaps want to talk directly to ST, through the web support form, or through FAE.

> The only way I could get it to work was to change the RTS GPIO pin from an alternate function push-pull to an alternate function open drain output

This is very unlikely. Open drain versus push-pull is a functionality localized within the GPIO module and is not related to the connected peripheral. That being said, a weird design error can't be excluded of course, just it sounds very unlikely. As you are apparently using some "libraries", I wouldn't be surprised if the error would be in there.

Can you please, using debugger, read out the USART and related GPIO registers with the working project; then do nothing else just set the project back to the push-pull-AF state, check it is not working, read out those registers and compare/check/post?

JW

PS. Please change your username to a normal nick.

PhilSter
Associate II

JW,

I'm an old school bit hacker and I program the peripherals directly using the reference manual. But you got me interested so I ran some more tests:

PA12 AF OD Works with the pull up resistor:

GPIOA_CRH : 400e44b2

PA12 AF PP Works with the pull up resistor:

GPIOA_CRH : 400a44b2

Then I disconnected the pull up resistor and it kept on working. So I am perplexed too, because like you said it makes no sense, but I still spent a lot of time with a logic analyzer trying to get the RTS line to go HI, and now it works. I dunno, maybe my prototype is quasi stable, because originally I was using push-pull and only tried OD out of desperation.

Thanks for your answer,

Phil

This parts are over decade​ old, the newer parts fixed a lot of the teething issues learned from the first generation of parts.

If you​ can't emulate functionality with GPIOs something wrong at a board level.

I'd start with the schematic not the software.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PhilSter
Associate II

First thing I do is check for shorted circuit traces and then I toggled the output as a GPIO because I don't trust my hand assembled prototype PCBs at all. It worked fine. I wasted many hours before I learned about the USART1 RTS / CAN defect, and when I figured that out, I thought I was on the home stretch, but nooooo. Serial is a PITA because it's not just the peripheral, you got the legacy Linux terminal driver and stdio to contend with too. So many things to get right...