← index #6814Issue #1011
Off-topic · high · value 1.324
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 · ISSUE

Pin.af_list() method is mis-classified

closedby pfalconopened 2014-12-18updated 2016-06-19
docs

http://docs.micropython.org/en/latest/library/pyb.Pin.html#Pin.af_list is includes in "Class methods" section, but says "Returns an array of alternate functions available for this pin." It doesn't take any argument based on the signature, so unclear what "this pin" refers to (if it's class method). And http://docs.micropython.org/en/latest/library/pyb.Pin.html#class-pinaf-pin-alternate-functions gives example which contradicts the method being class one.

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