2019-11-21 11:52 PM
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 :(
2019-11-22 12:12 AM
> 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.
2019-11-22 12:49 AM
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
2019-11-22 02:39 AM
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.
2019-11-22 04:01 AM
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...