Hi,
I have some simple questions about using hardware timers.
I am moving a design which is based on low level hardware control to a ChibiOS design.
In my low level design, I have set up a hardware timer (TIME13) to issue an interrupt every 5ms.
This works perfectly.
Now I am setting up a similar timer for the same interval using ChibiOS and I am receiving linker errors.
Perhaps I am missing something fundamental here.
Below is my code for setting up the timer (TIM9 this time):
//...before main()
// Timer callback function:
static void FiveMsTimerCallBack(GPTDriver *gpt_ptr)
{
palTogglePad(GPIOD, GPIOD_LED3);
}
//-----in main().....
// Initialize the timer used for the ISR.
// Set up a general purpose timer structure.
static GPTConfig FiveMsTImerCfg =
{
1000000, // Timer Clock Freq in Hz
FiveMsTimerCallBack // Timer callback function
};
// Start the 5ms timer and set it to run continuously:
// Timer triggers at 5000us (5ms) and calls the callback function FiveMsTImerCfg.
gptStart(&GPTD9, &FiveMsTImerCfg);
gptStartContinuous(&GPTD9, 5000);
I have set up the proper define in halconf.h:
#define HAL_USE_GPT TRUE
I have enabled the timer (TIM9) in mcuconf.h:
#define STM32_GPT_USE_TIM9 TRUE
When I compile, I receive the following linker errors:
Error[Li005]: no definition for "gpt_lld_start_timer" [referenced from...]
Error[Li005]: no definition for "gpt_lld_start" [referenced from ...]
Error[Li005]: no definition for "GPTD9" [referenced from ...]
Error[Li005]: no definition for "gpt_lld_init" [referenced from ...]
I also tried Timer1 and TImer14 and received the same linker errors.
Am I missing a setup function (or two)?
Am I requesting a parameter that is out of range?
Is there a simple example I can reference?
Thank You,
Forrest
Simple Hardware Timer Setup Questions
Moderator: RoccoMarco
-
forrestjon
- Posts: 13
- Joined: Mon Jun 16, 2014 10:11 pm
Re: Simple Hardware Timer Setup Questions
I found a setting in gpt_lld.h that I thought would make a difference however it did not.
Setting STM32_GPT_USE_TIM14 to TRUE did not work.
I also tried setting the define for TIM9 to true. This did not work either.
/**
* @brief GPTD14 driver enable switch.
* @details If set to @p TRUE the support for GPTD14 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_GPT_USE_TIM14) || defined(__DOXYGEN__)
#define STM32_GPT_USE_TIM14 TRUE
#endif
Setting STM32_GPT_USE_TIM14 to TRUE did not work.
I also tried setting the define for TIM9 to true. This did not work either.
/**
* @brief GPTD14 driver enable switch.
* @details If set to @p TRUE the support for GPTD14 is included.
* @note The default is @p TRUE.
*/
#if !defined(STM32_GPT_USE_TIM14) || defined(__DOXYGEN__)
#define STM32_GPT_USE_TIM14 TRUE
#endif
-
forrestjon
- Posts: 13
- Joined: Mon Jun 16, 2014 10:11 pm
Re: Simple Hardware Timer Setup Questions
Boy do I feel silly!
Added gpt_lld.c to the project...
Sorry for the post happy barrage from me today.
Added gpt_lld.c to the project...
Sorry for the post happy barrage from me today.