industrialNETworXnetx

ihd

ihd

| 16.02.2009 | 17:14 | 1 reply

Hardware Timer with Interrupt

Hello,
I'm evaluating some basic functions of the NETX with the evalboard NXEB-NET100. Everything worked fine, except the Hardware Timers. I tried to set-up a simple Blink-App with a Hardware Timer and its interrupt, but the ISR is never called! I studied the manuals about rcx (API, config, driver .. latest revisions) from hilscher several times but it still doesn't work. Btw: The manuals (especially the code-snippets in there) are not always correct imho, which is very exhausting sometimes - Is there a possibility to report errors?

my config file:

...
  {{"MYTIMER",RX_PERIPHERAL_TYPE_TIMER,0},       /* System Timer             */
    1,                                            /* use GPIO_counter1        */
    1000,                                         /* 1000 microseconds = 1msec */
    TRUE,                                         /* Continuous Mode          */
    TRUE,                                         /* Interrupt enabled        */
    FALSE,                                        /* No external Clock        */
    RX_HWTIMER_TRIGGER_NONE,                      /* No Trigger               */
    0,                                            /* No I/O reference         */
    0                                             /* No Prescaler             */
  }
...
    {{"MYTIMER",RX_PERIPHERAL_TYPE_INTERRUPT,0},  /* System Timer Interrupt             */
    SRT_NETX_VIC_IRQ_STAT_timer1,                 /* Use External Timer1 Interrupt      */
    28,                                           /* Priority 28                        */
    RX_INTERRUPT_MODE_SYSTEM,                  /* Allow Interrupt to be a Thread     */
    RX_INTERRUPT_EOI_AUTO,                        /* EOI Self by RX                     */
    RX_INTERRUPT_TRIGGER_RISING_EDGE,             /* Edge Triggered                     */
    RX_INTERRUPT_PRIORITY_STANDARD,               /* Normal Priority                    */
    RX_INTERRUPT_REENTRANCY_ENABLED,              /* Interrupt Itself is Reentrant      */
  }

...

STATIC CONST FAR RX_PERIPHERAL_CONFIG_T atrXCfgPre[] = {
{RX_PERIPHERAL_TYPE_TIMER,atrXHwTim,MAX_CNT(atrXHwTim)},
{RX_PERIPHERAL_TYPE_INTERRUPT,atrXInt,MAX_CNT(atrXInt)},
};

....

and my process:

// ISR:
void CALLBACK fnMyTim(RX_HANDLE hInt, void FAR*pvPrm){
 ; //  never gets here, sadly (optimization is off -O0)
}

....

RX_HANDLE hMyInt;
RX_HANDLE hTimer;

res = rX_MemAllocateMemory(&hTimer,DRV_HWTIMER_SIZE);
res = Drv_TimIdentifyTimer("MYTIMER",0,&hTimer);
res = Drv_TimInitializeTimer(hTimer);

res = rX_MemAllocateMemory(&hMyInt,DRV_INTERRUPT_SIZE);
res = Drv_IntIdentifyInterrupt("MYTIMER",0,&hMyInt);
res = Drv_IntInitializeInterrupt(hMyInt, fnMyTim, &hMyInt); // &input
res = Drv_IntEnableInterrupt(hMyInt);

rX_SysSetTaskInitialized(0);

res = Drv_TimStartTimer(hTimer);

...

However, the Timer is never shown in the RTOS window from HiTop. However, Tasks and Signals etc. are displayed there.

I'd be glad if someone could give me a hint.

Thank you,
greez Harry

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 19.02.2009 | 08:37

Hi ihd,

maybe the problem is located to this line:
res = Drv_IntInitializeInterrupt(hMyInt, fnMyTim, &hMyInt); // &input

You put the address of your ISR into this function.

Please try the following line:
res = Drv_IntInitializeInterrupt(hMyInt, fnMyTim, hMyInt); // &input

Login