PDA

View Full Version : TC1796 can't disable global interrupts



btech
Jul 24th, 2012, 03:30 PM
Hello, using TC1796 microprocessor, can't disable and enable interrupts around critical sections of code.

Referring to the Tricore Architecture Volume 1 manual:
The processor is running in User-1. In this mode you should be able to disable and enable interrupts.
checked in debugger, register PSW.IO = 0x01, User-1 Mode, "Tasks at this level may disable interrupts." (quoting the above manual)

Using the following C code to enable/disable interrupts:
asm volatile ("enable" : : : "memory");
asm volatile ("disable" : : : "memory");
Stepping through these lines of assembler in the debugger, register ICR.IE (Global Interrupt Enable) is always set.

Why are global interrupts not being disabled?

hamzath
Sep 18th, 2012, 01:51 AM
Did you try using mtcr instruction ?

alexshao1978
Nov 21st, 2012, 05:43 PM
Some time the debug tool can't tell you the truth. Try to test your code by program it to target board and test by set/clear/toggle test pins.
You can use ENABLE/DISABLE which difined in main.h and make test like this:

In main loop:
while(1)
{
DISABLE
set test pin1
delay long time
clear test pin1
ENABLE
delay long time
}

In timer interrupt
toggle test pin2

Compare test pin1 and pin2, you can get the truth.