[En-Nut-Discussion] Problem with STM32 pin configuration

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Wed Oct 7 10:52:01 CEST 2015

>>>>> "Ole" == Ole Reinhardt <ole.reinhardt at embedded-it.de> writes:

    Ole> Hi Uwe, Thanks for the fix!

    Ole> For me the SPI now works fine and the connected MX25 dataflash can
    Ole> be mounted with UFLASH.

You were lucky :-)

For STM32, devices need to write a function-specific and sometimes also
pin-specific number to the pin-dedicated bits of the alternate function
register for that port. Deciphering the pin-specific AF value is done in the
include/arch/cm3/stm32/stm32_xxx_pinmux.h files with the preprocessor. The
preprocessor restriction "all enums are defined as 0" applies here too. So
if nutgpio_t is declared after including pins.h, the decision for the AF
value may fail. Obvious this didn't happen to you.

This can be solved by including the pinmux before including pins.h.

I just uploaded a patch to do so.
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

More information about the En-Nut-Discussion mailing list