2020-06-30 12:32 PM
It is very confusing to me how pin multiplexer is explained in the datasheet, it doesnt help the matter when using .SVD file in the debugger as it is even more confusing.
Lets start with the SVD file. In the debugger I can see AFRL showing AFRL0-AFRL7 on the 40020020, and then AFRH is showing AFRH8-AFRH15 on 40020024. Each of those registers are 4bit.
Just looking at that one would say, that AFRL7 should contain pin number of GPIO ? Which doesnt work in any way if I want to assign two pins from AF7 group. USART_TX & USART_RX.
On the other hand, datasheet is saying that pins 0-7 should configure AFRL register, and pins 8-15 AFRH register.
So, taking that approach, configuring PA9 for USART1_TX, I would set AFRH9 = 7 (AF7) ?
That seems logical, but clashes with the SVD file, so probably isnt correct assumption. Also, my USART is not working, so obviously something is wrong :)
2020-06-30 12:54 PM
Not sure I agree with your interpretation of the SVD file.
Pins 0-7 are configured in AFRL, and pins 8-15 in AFRH.
> So, taking that approach, configuring PA9 for USART1_TX, I would set AFRH9 = 7 (AF7) ?
Yes, exactly.
2020-06-30 01:11 PM
I suppose when you know what you are looking at, then AFRL/H registers in SVD makes sense. Naming convention could be better. Like AFRL_P0-7 and AFRH_P8-15 would remove any ambiguity.
Anyhow, thanks for clarifying that.
2020-06-30 01:35 PM
>>It is very confusing to me how pin multiplexer is explained in the datasheet, it doesnt help the matter when using .SVD file in the debugger as it is even more confusing.
Each pin has 16 routing options (signal sources/destinations), some unpopulated.
At times the number of available choices for particular signals or groups of signals can still be limited, and pin availability will depend on the package and pin count.
ST has a history of making a lot of less-than-ideal choices in this regard.
Anyway the data sheet breaks the pins down as rows, with the choices as columns.
You get to pick one choice per row, and one choice per source.
Route more than one pin to the same source, undefined behaviour will result.