[En-Nut-Discussion] SVN REV 6452 and 6451

Ole Reinhardt ole.reinhardt at embedded-it.de
Tue May 24 19:33:49 CEST 2016


Hi Uwe,

first of all, let me explain my initial problem :)

I tried to use SPI4 on a STM32F411 with the SPI SCK pin configured to
PB13, which means that alternate function 6 shall be used (where 5 is
the default).

When using r6450 it turned out, that the alternate function selection
did not work, and the defaults where used.

This was the original code

/* SPI4*/
# if   defined(MCU_STM32F411)
#  define SPI4_NSS_AF   ((SPI4_NSS  == PB12)? 6 : 5)
#  define SPI4_SCK_AF   ((SPI4_SCK  == PB13)? 6 : 5)
#  define SPI4_MISO_AF  ((SPI4_MISO == PA11)? 6 : 5)
#  define SPI4_MOSI_AF  5
# elif  defined(MCU_STM32F446)
#  define SPI4_NSS_AF   ((SPI4_NSS  == PG14)? 6 : 5)
#  define SPI4_SCK_AF   ((SPI4_SCK  == PG11)? 6 : 5
#  define SPI4_MISO_AF  ((SPI4_MISO == PG12)? 6 : 5
#  define SPI4_MOSI_AF  ((SPI4_MOSI == PG13)? 6 : 5
# else
#  define SPI4_NSS_AF   5
#  define SPI4_SCK_AF   5
#  define SPI4_MISO_AF  5
#  define SPI4_MOSI_AF  5
# endif


But MCU_STM32F411 was not defined and there also was no configurator
option that would have exported this macro.

I then searched the .nut files for similar defines and found the one,
where MCU_STM32F411xE was defined.

So I just assumed a typo here...

And please also see my comments below.


Am 24.05.2016 um 15:11 schrieb Uwe Bonnes:
>     Ole> MCU_STM32F411xE define, which was not exported.
> 
> You don't need MCU_STM32F411xE. STM32F411xE is the define you need to look for!
> It is what we already use to include the vendor header.

Ok, I understand. But that's the way, it was used in
nut/include/arch/cm3/stm/stm32_spi_pinmux.h

and

nut/include/arch/cm3/stm/stm32_i2c_pinmux.h

I did not introduce anything new there, but just tried to correct the
just existing #ifdefs :-)

Could you perhaps have a look on these files again to check if the
defines are correctly used or not?

As mentioned before I'm not completely shure, how you intented to use
the defines there...

>     Ole> Yes, here we had the second problem.
>     Ole> arch.nut does not define MCU_STM32F401, but it defines
>     Ole> MCU_STM32F401xC and MCU_STM32F401xE.
> 
> Did you run with a custom config?

Yes, I did. I also did not use a config for the STM32F401, the changes
there were just based on an "educated guess".

I used a custom config based on nucleo_f411re.conf and there, the
MCU_STM32F411 define was not generated.

> Running conf/nucleo_f401re with 6450 gives following defines in
> include/cfg/arch.h:
> #define PLATFORM NUCLEO
> #define CM3_GCC
> #define MCU_STM32F401xE
> #define MCU_CM3 1
> #define MCU_STM32 1
> #define MCU_STM32F4 1
> #define MCU_STM32F401 1
> #define STM32F401xE 1
> #define STM32_GPIO_DEFAULT_MODE GPIO_DEFAULT_MODE
> 
> So here neither MCU_STM32F401 is missing nor some define for the exact part.
> But MCU_STM32F401xE could be ommited. I will clean up as I find time...

Hm... Sorry, perhaps I need some more introduction into the STM32 naming
scheme and configuration settings :)

In arch/cm3/stm32f4.nut there is one macro

macro = "MCU_STM32F401"

and two more for

macro = "STM32F401xC"
and
macro = "STM32F401xE"

But for the STM32F411 there is only one macro for

macro = "STM32F411xE"

but not a "generic one" for STM32F411?



Thanks!

Best regards,

Ole

-- 
kernel concepts GmbH            Tel: +49-271-771091-14
Sieghuetter Hauptweg 48         Mob: +49-177-7420433
D-57072 Siegen
http://www.embedded-it.de
http://www.kernelconcepts.de


More information about the En-Nut-Discussion mailing list