Compile HardTimerAsEncoder example erro

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
Post Reply
tom
Posts: 4
Joined: Sun May 28, 2017 11:15 am

Compile HardTimerAsEncoder example erro

Post by tom » Sun May 28, 2017 11:59 am

I am using the STM32F407 discovery board.Some items missing definiens.Does the Arduino_stm32 not support this board??
the complier output
"Arduino: 1.8.0 (Windows 10), Board: "STM32 Discovery F407"

Warning: Board Arduino_STM32:STM32F3:discovery_f3 doesn't define a 'build.board' preference. Auto-set to: STM32F3_DISCOVERY_F3
Warning: Board Arduino_STM32:STM32F4:discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCOVERY_F407
Warning: Board Arduino_STM32:STM32F4:stm32f4stamp doesn't define a 'build.board' preference. Auto-set to: STM32F4_STM32F4STAMP
Warning: Board Arduino_STM32:STM32F4:netduino2plus doesn't define a 'build.board' preference. Auto-set to: STM32F4_NETDUINO2PLUS
WARNING: Category '' in library SPI is not valid. Setting to 'Uncategorized'
WARNING: Category '' in library UIPEthernet is not valid. Setting to 'Uncategorized'
Build options changed, rebuilding all
Warning: platform.txt from core 'STM32F4 boards' contains deprecated compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/, automatically converted to compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/. Consider upgrading this core.
Warning: platform.txt from core 'STM32F4 boards' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Consider upgrading this core.
E:\I-RC\Documents\Arduino\hardware\Arduino_STM32\examples\Sensors\HardTimerAsEncoder\HardTimerAsEncoder.ino: In function 'void setup()':

HardTimerAsEncoder:69: error: 'TIMER_ENCODER' was not declared in this scope

timer.setMode(0, TIMER_ENCODER); //set mode, the channel is not used when in this mode.

^

E:\I-RC\Documents\Arduino\hardware\Arduino_STM32\examples\Sensors\HardTimerAsEncoder\HardTimerAsEncoder.ino: In function 'void loop()':

HardTimerAsEncoder:99: error: 'Serial' was not declared in this scope

Serial.print(timer.getCount());

^

HardTimerAsEncoder:131: error: 'Serial' was not declared in this scope

if (Serial.available() > 0) {

^

exit status 1
'TIMER_ENCODER' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
"

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Compile HardTimerAsEncoder example erro

Post by stevestrong » Sun May 28, 2017 2:41 pm

You could try with my repo, as this is not yet committed into main repo.

tom
Posts: 4
Joined: Sun May 28, 2017 11:15 am

Re: Compile HardTimerAsEncoder example erro

Post by tom » Mon May 29, 2017 11:19 am

stevestrong wrote:You could try with my repo, as this is not yet committed into main repo.
when i compile the example under example/sensor it has the same error 。the HardwareTimer.h under .\STM32F4\cores\maple different with .\STM32F1\cores\maple.

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Compile HardTimerAsEncoder example erro

Post by stevestrong » Mon May 29, 2017 12:10 pm

Well, then try to copy the F1 code to F4.

tom
Posts: 4
Joined: Sun May 28, 2017 11:15 am

Re: Compile HardTimerAsEncoder example erro

Post by tom » Tue May 30, 2017 8:32 am

stevestrong wrote:Well, then try to copy the F1 code to F4.

I copy stm32f1/system/libmaple and stm32F1/cores/ to the stm32f4,but still have the erro "fatal error: libmaple/stm32.h: No such file or directory".
this file is MCU-specific values.I have no idea to rewrite if.

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Compile HardTimerAsEncoder example erro

Post by stevestrong » Tue May 30, 2017 11:21 am

This is the change added to F1 family 2 years ago to support encoders.
You could apply this change to the respective F4 files, too, so that you get the same functionality.

Post Reply