And there's a memory write that goes to a field in that struct that is only ever written and nothing ever reads it.

I'm guessing this is some CPU magic that just knows that when a value is written to that address, it should transmit it over the UART_TX pin.

So now I just have to find the places which interact with this magic struct and somewhere it should show me what the options are for things like baud rate, parity and so forth. Hopefully that will let me determine where I've got something misconfigured.

I'm getting output on the UART pins when I plug in the FT232R, but it's [almost] all gibberish.

Reply to this note

Please Login to reply.

Discussion

I've now confirmed that I have the correct baud on the receiving side (115200).

But there's a comment that says "pin 9-10" and that is NOT where my pins are going.

I started digging into the datasheet for the microcontroller to see what's up and pins 8 and 9 can be configured as UART2 (19-20, the ones I am actually connected to, are UART1). But at best pin 10 is USART2_CK.

The hunt continues

I see references in the comments to AF7 and the code isnsetting af_num to 7, which seems to match. This lines up with pins 19/20 being UART1.

Ohhhh, PA9 and PA10, not literally pins 9 and 10! I think it's starting to come together. Can you feel the excitement?

But why does the comment say USART2 init if it is really initializing UART1? Is it a comment that is wrong? A typo? Maybe they used to use UART2 and then switched to UART1 and just missed updating the comment?

The variable is named usart1, so it feels like a deceptive comment, but what does the code say? Will I be able to confirm it before it's time for the 2600 meeting? We'll see...

It looks like I might be at the end of the line.

The MCU datasheet specifies the memory mapping for the PORT A range, but not any information on the structures that go there.

There's not even a reference to some other document that defines those structs.

Looks like hackaday is going to help me out. https://hackaday.com/2020/12/23/bare-metal-stm32-exploring-memory-mapped-i-o-and-linker-scripts/

Maya Posch, if you are on Nostr, I want to follow you and give you a zap for writing this article!!!