MRT: registers IRQ_FLAG vs STAT

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MRT: registers IRQ_FLAG vs STAT

537 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alagner on Sun Apr 27 13:18:28 MST 2014
I've managed to run MRT successfully, yet I'm still pretty much interested in one thing:

I have MRT's channel 0 configured, it counts as it is supposed to etc. My ISR looks like this:
(It's not supposed to blink LED in the real project, but I wanted to isolate the problem)

LPC_MRT->Channel[0].STAT |= 1;
led_toggle();


and it works fine - diode blinks.

But it should also be possible to use the IRQ_STAT register, in a way like this (at least that's the way I understand the manual):

uint32_t temp = LPC_MRT->IRQ_FLAG; //read flags
LPC_MRT->IRQ_FLAG = temp & 15; //write ones to ones
led_toggle(); //blink


the funny thing is that the led never blinks, and step debugging shows the following:
uint32_t temp = LPC_MRT->IRQ_FLAG; // after single stepping through this, temp equals 0, but peripheral view shows 1 in register, how come?
LPC_MRT->IRQ_FLAG = temp & 15; //and I'm landing in defaultHandler, so sth went wrong, gotta check what fault is this
led_toggle(); //never gets here


What is even more suspicious, this
uint32_t temp = LPC_MRT->IRQ_FLAG; // temp still zero
led_toggle(); //voila, it blinks!

operates perfectly.

Ok, I can use chnnel's STAT instead of IRQ_FLAG and live with that, that's not much of a problem, but I'm just curious about the issue.

The manual states this about IRQ_FLAG:

Quote:

Pending interrupt. The interrupt is pending because TIMER0
has reached the end of the time interval. If the INTEN bit in the
CONTROL0 register is also set to 1, the interrupt for timer
channel 0 and the global interrupt are raised.
Writing a 1 to this bit clears the interrupt request


Any ideas?

Regards,
Maciek
Labels (1)
0 Kudos
3 Replies

456 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MICHALKO12 on Sat May 10 09:56:41 MST 2014
http://www.elektroda.pl/rtvforum/viewtopic.php?p=13552312#13552312
0 Kudos

456 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Sat May 10 03:43:13 MST 2014
Hi Maciek,

very strange. On my system everything works as YOU expect it. Every one of the 3 first lines of handlerMrt() alone works in my program (attached).

What's interesting: in User Manual version 1.5 appeared a third MRT mode: "one shot bus stall" -
sound like a handy tool for quick and dirty GPIO bit banging  8-)

EDIT: and yes, using that mode for the main loop busy delay saves a 1mA@12MHz!

Marc
0 Kudos

456 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxp_apps on Fri May 09 14:12:46 MST 2014
Hi,

Please refer to the LPCOpen code (mrt peripheral example)...it uses the IRQ_FLAG to clear the interrupt.
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc8xx-packages

Thanks.

nxp_support
0 Kudos