Page 1 of 1
STM32F4xx-I2C for STM32F401RE-NUCLEO
Posted: Wed Dec 21, 2016 5:49 pm
by Tarx
Hi,
In order to use STM32F4xx-I2C template on a STM32F401RE-NUCLEO board what should i change in the makefile?
I tried changing :
- linker script file in the makefile for F401RE-NUCLEO
- specific HAL board for F401RE-NUCLEO
with no luck, i receive a lot of compiler errors. Any hint?
Re: STM32F4xx-I2C for STM32F401RE-NUCLEO
Posted: Wed Dec 21, 2016 7:33 pm
by tfAteba
Hi Tarx,
I thinks you just need to modify the following :
- The board file
- The linker
Wich version of ChibiOS are you using?
Giovanni, I made quick test hand I had the following errors:
With the version 16.1.5 I had the following errors:
In file included from ../../../../os/hal/include/hal.h:32:0,
from ../../../../os/hal/src/hal.c:25:
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:956:2: error: #error "HSE frequency not defined"
#error "HSE frequency not defined"
^
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:1052:2: error: #error "STM32_PLLCLKIN outside acceptable range (STM32_PLLIN_MIN...STM32_PLLIN_MAX)"
#error "STM32_PLLCLKIN outside acceptable range (STM32_PLLIN_MIN...STM32_PLLIN_MAX)"
^
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:1115:2: error: #error "STM32_PLLVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"
#error "STM32_PLLVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"
^
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:1127:2: error: #error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"
#error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"
^
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:1354:2: error: #error "STM32_PLLI2SVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"
#error "STM32_PLLI2SVCO outside acceptable range (STM32_PLLVCO_MIN...STM32_PLLVCO_MAX)"
^
In file included from ../../../../os/hal/include/i2c.h:85:0,
from ../../../../os/hal/include/hal.h:52,
from ../../../../os/hal/src/hal.c:25:
../../../../os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.h:326:2: error: #error "I2C peripheral clock frequency out of range."
#error "I2C peripheral clock frequency out of range."
^
make: *** [build/obj/hal.o] Error
With the trunk, I had the following error:
Compiling osal.c
Compiling hal.c
In file included from ../../../../os/hal/include/hal.h:110:0,
from ../../../../os/hal/src/hal.c:25:
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:1386:2: error: #error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"
#error "STM32_PLLCLKOUT outside acceptable range (STM32_PLLOUT_MIN...STM32_PLLOUT_MAX)"
^
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:1406:2: error: #error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"
#error "STM32_SYSCLK above maximum rated frequency (STM32_SYSCLK_MAX)"
^
../../../../os/hal/ports/STM32/STM32F4xx/hal_lld.h:1486:2: error: #error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"
#error "STM32_HCLK exceeding maximum frequency (STM32_SYSCLK_MAX)"
^
make: *** [build/obj/hal.o] Error 1
I didn't have that errors before

.
I'm trying to look after to see what is the problem.
Re: STM32F4xx-I2C for STM32F401RE-NUCLEO
Posted: Wed Dec 21, 2016 8:00 pm
by Giovanni
Hi,
Make sure to take mcuconf.h from an F401 demo for Nucleo then change the makefile.
Giovanni
Re: STM32F4xx-I2C for STM32F401RE-NUCLEO
Posted: Wed Dec 21, 2016 8:24 pm
by RoccoMarco
Hi,
probably the easiest way is
- copy the default demo for STM32F401RE
- replace main.c
- enable I2C in halconf and mcuconf
- edit main.c making it compiling (most likely LEDs PIN/PORT are different and there is always a blinking thread)
Re: STM32F4xx-I2C for STM32F401RE-NUCLEO
Posted: Wed Dec 21, 2016 8:28 pm
by tfAteba
Hi,
Giovanni, you are right, that resolve the problem

.
All that errors come from the difference between the mcuconf files.
Tarx, do not forget to activated i2C driver and assign i2C peripheral in order to use the I2C module.
Thank you Giovanni.