zomborid / STM32TimerArray

Hardware aided timer array for STM32 boards
BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

blinky example doesn't build without modifications #1

Closed ChrisIdema closed 4 years ago

ChrisIdema commented 4 years ago

I use the nucleo F446ZE. I cannot get the example to build without modifications to my own code (I did not change the library code). I had the following issues:

I had to do the following:

#include "stm32f4xx_hal.h"
extern "C"{
extern TIM_HandleTypeDef htim2;
}
#define AutoReloadPreload Period
#define TIM_AUTORELOAD_PRELOAD_DISABLE 0

It should also be possible to change F_CPU in the ini file with board_build.f_cpu

With these modifications it works.

zomborid commented 4 years ago

Thanks for the tip and the workarounds. I intended the lib to be used with STM32Cube. It (to my knowledge) defines F_CPU, creates tim.h and the other symbols.

The attachTimerInSync error is weird, the blinky code should be valid. Can you copy the full error message?

Did you check the project_setup_with_cubemx example? It ensures that headers, includes and code generation are set up properly. Maybe it is a compatibility issue of STM32Cube between CPUs? (I use Nucleo F303RE.)

ChrisIdema commented 4 years ago

I've found other issues, but found out for some reason my platformio pulled a really old version of your library. That was the cause of several issues such as the missing attachTimerInSync and an overflow bug (which you have fixed already). For the AutoReloadPreload member of the struct I compared all stmcube processors and only the STM32F4 doesn't have that member. I've submitted a pull request for the fix. As for the F_CPU. Platformio creates a global define for F_CPU and it uses the board value as far as I know. I don't know if stmcubemx can override it. If you merge it I will consider the issue solved.

zomborid commented 4 years ago

If I understand correctly PR #2 fixed this.

ChrisIdema commented 4 years ago

If I understand correctly PR #2 fixed this.

Correct