[En-Nut-Discussion] STM32F7xx fixes

Holger Mai mai at gemac.info
Mon Apr 18 15:12:30 CEST 2016


Hello all

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

to fix this, edit stm32_clk.c from line 232:

231>    cfgr  &= ~(RCC_CFGR_HPRE | RCC_CFGR_PPRE2); 
	if (AHB_DIV > 1) //the AHB divisor may be 1 (no division), this results in
HPRE=0 
	{
 		/* Skip zeros at start of table*/
		i = 7;
 		while ((1 << AHBPrescTable[i]) < AHB_DIV) {
			i++;
		}
		cfgr |= i * RCC_CFGR_HPRE_0;
	} 
        ...

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

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

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



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

#define BOARDNAME "STM32F4DIS_BB"
#include <arch/cm3/board/stm32f4dis_bb.h>
//new from line 277 ff:
#elif defined(STM32E407)
#include <arch/cm3/board/stm32e756.h>
#define BOARDNAME "STM32E407"
#elif defined(STM32E756)
#include <arch/cm3/board/stm32e756.h>
#define BOARDNAME "STM32E756"
//end of new
#elif defined(USPS)
...
 


-> add stm32e756.h to cm3\boards:

/*
 * (c) 2016 by Holger Mai
 *
 * All rights reserved.
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the copyright holders nor the names of
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE. 
 */

/*
 * \file arch/cm3/board/stm32e756.h
 * \brief modified Olimex STM32E407 board (MCU replaced by STM32F756ZGT).
 *        but also can used for the original STM32E407 board
 *
 * \verbatim
 * $Id$
 * \endverbatim
 */

 
#ifndef DEV_UART
#define DEV_UART devUsartStm32_3
#include <dev/usartstm32.h>
#endif
#ifndef DEV_UART_NAME
#define DEV_UART_NAME  devUsartStm32_3.dev_name
#endif 

#ifndef DEV_DEBUG

#define DEV_DEBUG devUsartStm32_3
#endif
#ifndef DEV_DEBUG_NAME
#define DEV_DEBUG_NAME  devUsartStm32_3.dev_name
#endif

#ifndef DEV_CONSOLE
#define DEV_CONSOLE devUsartStm32_3
#endif

#ifndef DEV_CONSOLE_NAME
#define DEV_CONSOLE_NAME devUsartStm32_3.dev_name
#endif

/* Ethernet interface */

#include <dev/stm32_emac.h>
#ifndef DEV_ETHER
#define DEV_ETHER devStm32Emac
#endif
#ifndef DEV_ETHER_NAME
#define DEV_ETHER_NAME  "eth0"
#endif

>> end of file


mit freundlichen Grüßen /Best Regards

Holger Mai

mai at gemac-chemnitz.de



GEMAC - Gesellschaft für Mikroelektronik-
anwendung Chemnitz mbH
Zwickauer Straße 227
D-09116 Chemnitz
Tel. +49 371 3377 - 0
Fax +49 371 3377 272
UST-ID: DE140851265
HRB 6443 Chemnitz/Stadt
Geschäftsführer: Dirk Hübner / Karsten Grönwoldt
http://www.gemac-chemnitz.de


More information about the En-Nut-Discussion mailing list