Simple Hardware Timer Setup Questions
Posted: Wed Jun 18, 2014 5:09 pm
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
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