SPI2 on STM32WB55 pin error
Trying to use pin D3 as SPI2_MISO alternate function does not work, the pin D3 switches to the previous alternate funtion (SPI2_SCK).
This can be fixed by removing the AF3 declaration out of the stm32wb55_af.csv list:
PortD,PD3,,,,SPI2_SCK,,SPI2_MISO,,,,,QUADSPI_BK1_NCS,,,,,EVENTOUT, (Original)
PortD,PD3,,,,,,SPI2_MISO,,,,,QUADSPI_BK1_NCS,,,,,EVENTOUT, (fix)
But this causes the Pin D3 incapable of switching to SCK mode.
This is caused by the definition of a pin list in spi.c (line 294), not a function list. In the pin list, the actual output pin is defined, but the information what the pin should be doing is not remembered.
A sollution could be the sequnce of the list, it can be defined to hold the function. The function mp_hal_pin_config_alt then should be told what the pin function should be.
stm32/boards: Fix returning incorrect af_list() with NUCLEO-F446RE.
This PR fixes following problem.
How to reproduce
Some pins returns incorrect result by af_list().
For example, PB2 has two alternate function (Timer2, SPI3) but I got empty list.
>>> pb2 = machine.Pin('PB2')
>>> pb2.af_list()
[]
MicroPython Version
v1.19.1
Environment
NUCLEO-F446RE
Detail of changes
boards/NUCLEO_F446RE uses stm32f429_af.csv but some alternate functions of STM32F411 are different with STM32F429.
To fix this problem, I made stm32f446_af.csv based on stm32f429.csv.
After using stm32f446_af.csv, af_list() correctly returns alternate functions.
>>> pb2 = machine.Pin('PB2')
>>> pb2.af_list()
[Pin.AF1_TIM2, Pin.AF7_SPI3]