← index #6814PR #1370
Related · medium · value 1.575
QUERY · ISSUE

SPI2 on STM32WB55 pin error

openby H-Grobbenopened 2021-01-29updated 2025-10-06
port-stm32needs-info

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.

CANDIDATE · PULL REQUEST

stmhal/boards/stm32fxx_prefix.c: Fix alt function number calculation

closedby blmorrisopened 2015-07-08updated 2015-08-17

This prevented the pin_find_af* functions in pin_named_pins.c from being able to find some
of the higher-numbered alternate functions in the pin struct.
Hadn't been an issue until now because these functions had limited use; I will be using them in I2S and will add another function (pin_find_af_type) as well.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied