This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

AT91SAM7X SYS IRQ: RL-ARM problems by change from edge to level mode (for RTT etc.)

Hi there all at91sam7x developers,

we have really big problems running the rl-arm library (MDK-ARM RealView Microcontroller Kit 4_01) since we need to make use of the sysirq of the at91sam7x512 device which is not only used by the PIT we use for the scheduler timer tick but shared with other chip components like DBGU, RSTC, RTT, WDT and PMC.

We cannot change to the three other timers (TCx) because we use them already for other pupose.

In the default setting of edge mode the RTT cannot work properly and end up in a froozen scheduler and a always running idle task after 10-25 minutes (google retrieves other threads describing this similar).

We changed the OS_TINIT macro (in RTX_Config.c) to set the level mode for the sys irq (AIC->AIC_SMR[ID_TC] = (AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL| AT91C_AIC_PRIOR_HIGHEST)) as everyone in the web suggests (google told us) and we noticed the macro AT91C_TFIRQ to trigger the clock interrupt by software cannot work anymore because the AIC does not support software triggering of irqs in level mode.

At the moment I'm trying to change temporary back to edge mode of the AT91C_TFIRQ macro to make software triggering of the irq working again for it and keep my fingers crossed this will work stable for hours:

#define AT91C_TFIRQ
AT91C_LOCK; AIC->AIC_SMR[ID_TC] = (AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE| AT91C_AIC_PRIOR_HIGHEST); \
AT91C_UNLOCK; \
AIC->AIC_ISCR = OS_TIM_; \
AT91C_LOCK; AIC->AIC_SMR[ID_TC] = AT91C_AIC_SYSSRCTYPE; AT91C_UNLOCK

In level mode it works properly as soon as the load of os_xxx calls is very low. Having the full application running the system runs like the idle task runs (but others still run as breakpoints shows) only after about 1 hour. Things like os_sem_wait calls doesn't respond at os_sem_send calls happen and much more...

We have a mean stack loading of our 24 tasks of 50% max each.

Anyone experienced by using the sys irq of the at91sam7x in combination of the RL-ARM library driven by the PIT (not any TCx) out there?

Please help me!!

Best regards
Helmut

Parents
  • The other timers (TCx) are not used for continous intervals but for external monitoring and gating (via TIOA) and run not continously (only on demand but often). So I cannot use them as a clock to divide etc.

    For the fact the rl-arm scheduler requires software triggering of the clock intterupt code just set a breakpoint in "void os_tmr_force_irq (void)" (RTX_lib.c) and you'll see how often this one is called containing the macro OS_TFIRQ() that is just a macro of the above described AT91C_TFIRQ (RTX_Config.c defines them both).

    Thanks for all your ideas. Keep sending them. Thanks!!

    P.S.: My temporary change from level to edge (see above the multi line AT91C_TFIRQ macro) works long but still not stable (only 01h 45m under full software load)

Reply
  • The other timers (TCx) are not used for continous intervals but for external monitoring and gating (via TIOA) and run not continously (only on demand but often). So I cannot use them as a clock to divide etc.

    For the fact the rl-arm scheduler requires software triggering of the clock intterupt code just set a breakpoint in "void os_tmr_force_irq (void)" (RTX_lib.c) and you'll see how often this one is called containing the macro OS_TFIRQ() that is just a macro of the above described AT91C_TFIRQ (RTX_Config.c defines them both).

    Thanks for all your ideas. Keep sending them. Thanks!!

    P.S.: My temporary change from level to edge (see above the multi line AT91C_TFIRQ macro) works long but still not stable (only 01h 45m under full software load)

Children
  • But does using a timer as interrupt source solve your problem? Maybe you're looking at an entirely wrong direction!

  • Hi there,

    just to keep you updated: I made it! The system works now stable in sysirq's level mode and the pit as scheduler tick source - also during high loads so far.

    Some of you where right, I needed to make some other works too: Make some forgotten portions of my code real thread safe. I'm sorry I left out three portions in the code size of 25000 lines (without empty ones)...

    But on the other hand the current version of the rtx_config.c does _not_ support the sysirq's level mode that is a strict requirement for irq driven use of rtt and other peripherals "wired or" to the sysirq.

    I cooperation with support it's now working. But all my "many days" work is paid by my customer and therefore I've not the rights to publish the changes here.

    Hopefully the next official version of rtx_config.c will come with sysirq's level mode support which enables you to still use the pit as scheduler tick source and also use the others "wired or" sources of the sysirq like rtt.

    Thanks everybody for your kicks, questions, doubts, ideas and patience.

    Good luck
    Helmut