This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem with timer initialisation

Other Parts Discussed in Thread: CC2530, CC2430, Z-STACK
Problem with timer initialisation
Hello everybody,
I have a problem using the timers on my cc2530eb.
In my code I included "hal_timer.h", and in the project files there is also listed "HAL\Target\CC2530EB\Drivers\hal_timer.c", which has the following output files: hal_timer.lst, hal_timer.pbi, hal_timer.r51, hal_timer.s51

Still, when I call the function HalTimerInit() to init the timer support, I receive a linking problem, which is:

Error[e46]: Undefined external "HalTimerInit::?relay" referred in myCoordinator ( D:\Texas Instruments\ZStack-CC2530-2.4.0-1.4.0\GCDevelop\ProjectHotel_3.1.2dev\Projects\zstack\Samples\myApp\

Any hints to solve it? If it may help, the stack I'm using is 2.4.0-1.4.0.

Thanks a lot in advance
  • The hal_timer.c module never worked for the CC2530 (the registers had not been ported from the CC2430) and so you will see that the module is empty in later Z-Stack installers. With a little work, you could get the module working for CC2530, but I would recommend you to just make you own module with your specific proprietary use of the one H/W timer that you need. If you try to revive hal_timer.c module, one thing I noticed missing from your configuration above is the HAL_TIMER=TRUE setting in hal_board_cfg.h

  • Hi Harry,
    thanks a lot for your answer. BTW, it was posted by a colleague of mine because my internet connection was not working properly this morning.

    It's a bit weird. I think I've seen a sample application which makes use of timers to send the same message every 5 seconds. Am I missing something?

    Anyway, I don't get your suggestion. How is it possible to use the H/W timer if I cannot call the HalTimerInit() function which is supposed to be called before using any of the timers available on the CC2530? Might you please make me an example, if you have a bit of spare time?

    Thanks a lot in advance,
    Gianluca

  • The application you are thinking of was probably using the OSAL S/W timer, +/- 1 msec at best with 4-12 msec jitter during heavy radio load. Thus the H/W timer would be used for a hard real-time deadline, and such needs are usually way too specific to be properly/easily abstracted with a HAL module. Thus, HalTimerInit() was just trying to abstract the H/W Timer registers a little. So you just need to review the data sheet for the CC2530, write to a few of the configuration registers for the H/W timer that you want, copy and paste an ISR handler, say from hal_led.c or hal_keys.c or even the old defunct hal_timer.c and setup your ISR handler, enable the ISR, and away you go!

  • You are right, Harry.
    Thanks a lot for your answer. You were right, indeed; in that program the OSAL timer is used. Anyway, its specifications are good enough for the timing requirements of my projects, so I think I myself will use this timer.

    Thanks a lot,
    Gianluca