Re: Problem with STM32 pin configuration

Uwe Bonnes <bon-1JbLm1bU5j5ZIx36JBfelj3+ndqKAYMe9FMPySWZwLkb1SvskN2V4Q@public.gmane.org>
Newsgroups gmane.comp.hardware.microcontrollers.ethernut
Message-ID <[email protected]>
>>>>> "Ole" == Ole Reinhardt <ole.reinhardt-L1vi/[email protected]> 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-1JbLm1bU5j5ZIx36JBfelj3+ndqKAYMe9FMPySWZwLkb1SvskN2V4Q@public.gmane.org

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.