[En-Nut-Discussion] STM32F7xx fixes

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon Apr 18 17:39:27 CEST 2016

>>>>> "Holger" == Holger Mai <mai at gemac.info> writes:

    Holger> Hello all 1.  found an error in stm32_clk.c, Trunk 6442: it is
    Holger> impossible to set the AHB Clock to maximum speed (= SYSCLK),
    Holger> because if AHB divisor = 1, the divisor in RCC->CFGR.HPRE is set
    Holger> to 7
Please reread the reference manualcarefully:

Bits 7:4 HPRE: AHB prescaler
          Set and cleared by software to control AHB clock division factor.
          0xxx: system clock not divided
          1000: system clock divided by 2
So in my understanding 0b0111 == d7 means undivided clock.


    Holger> same theme, possible error in configurator with Trunk 6442 and
    Holger> STM32F7xx if edit the clock divisors, and let the AHB Clock
    Holger> divisor at 1 (default), then no symbol AHB_DIV is generated in
    Holger> clock.h, and no related Entry is generated in the .conf file. If
    Holger> set AHB divisor to 2, save the config, then set to 1 and
    Holger> compile, all is ok and the entrys will be generated. I did not
    Holger> found any default settings for AHB_DIV in source code if not
    Holger> defined in clock.h.

Sorry, I don't understand what you mean. If with the explanation above you
still think it is an error, perhaps explanin in other words or in private
mail in german.

    Holger> 2.  found an error in stm32xxxx.h the lines behind 303 "#elif
    Holger> defined(MCU_STM32F7)" for all 3 STM32F7 types is the same Header
    Holger> file included. Thats wrong and makes some trouble if you want to
    Holger> use a different one than STM32F745.

Fixed in my tree. Thanks
    Holger> 3.  in Trunk 6427 and later, in stm32xxxx.h at line 474: The
    Holger> ENABLE / DISABLE Symbols are in some standard headerfiles
    Holger> declared as enum "FunctionalState" (i.e. stm32F7xx.h). The
    Holger> declaration of these symbols with the same name disturbes the
    Holger> Application usage of the HAL and CMSIS drivers, who needs the
    Holger> original headerfiles.  If there is a symbol, that only exists at
    Holger> configurators compiletime (or has to be defined by configurator
    Holger> for this purpose), you can add a condition like "#if
    Holger> (BUILD_LIBRARYS == 1") around the DISBALE /ENABLE Defines.  This
    Holger> is also to do in the include/dev/usart.h for the same symbols.

For ENABLE/DISABLE, does following commit help?

    Holger> 4.  please add an Olimex STM32E407 board and an STM32E756 board:
    -> add to dev\board.h:

    Holger> #define BOARDNAME "STM32F4DIS_BB" #include
    Holger> <arch/cm3/board/stm32f4dis_bb.h> //new from line 277 ff: #elif
    Holger> defined(STM32E407) #include <arch/cm3/board/stm32e756.h> #define
    Holger> BOARDNAME "STM32E407" #elif defined(STM32E756) #include
    Holger> <arch/cm3/board/stm32e756.h> #define BOARDNAME "STM32E756" //end
    Holger> of new #elif defined(USPS) ...
commit dca2fee7af22fea4960808404ac73816aa8dbe38
Author: Uwe Bonnes <bon at elektron.ikp.physik.tu-darmstadt.de>
Date:   Mon Apr 18 17:31:55 2016 +0200

    stm32xxxx.h: Protect defines eventually used in vendor headers.
    Thanks to Holger Mai <mai at gemac.info>.

diff --git a/nut/include/arch/cm3/stm/stm32xxxx.h b/nut/include/arch/cm3/stm/stm32xxxx.h
index c31e6b0..bd8ec33 100644
--- a/nut/include/arch/cm3/stm/stm32xxxx.h
+++ b/nut/include/arch/cm3/stm/stm32xxxx.h
@@ -471,7 +471,12 @@
 extern int Stm32ResetCause(void);
 /* Allow readable values in the configurator */
-#define ENABLE  1
-#define DISABLE 0
+#if !defined ENABLE
+# define ENABLE  1
+#if !defined DISABLE
+# define DISABLE 0

    Holger>    -> add stm32e756.h to cm3\boards:

Please provide configuration files for these boards too.

Holger, sending patches and not verbal description of what to change will
make things clearer and easier for me.

Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------

More information about the En-Nut-Discussion mailing list