<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC Microcontrollers中的主题 LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1985306#M57190</link>
    <description>&lt;P&gt;Hi, I'm using MRT on LPC832 (SDK: 2.16.000), and if I call the following, the interrupt for channel 1 does actually happen, and the flags for RUN and INT are set. &amp;nbsp;To ignore channel 1, I have to test for &lt;FONT color="#FF9900"&gt;MRT_GetEnabledInterrupts&lt;/FONT&gt;() in the interrupt handler. &amp;nbsp;Which is Ok, because it works, but it seems counter-intuitive that if I say "disable interrupts for channel 1," the interrupt is still actually enabled. &amp;nbsp;Or am I doing something wrong?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void MRT0_DriverIRQHandler(void)
{
	if ( MRT_GetStatusFlags( MRT0, kMRT_Channel_0 ) == (MRT_CHANNEL_STAT_INTFLAG_MASK | MRT_CHANNEL_STAT_RUN_MASK) ) {
		MRT_ClearStatusFlags( MRT0, kMRT_Channel_0, kMRT_TimerInterruptFlag );
		g_doPWM = 0;
		g_LED0 = !g_LED0;
		GPIO_PinWrite( g_pins[0].gpio.base, g_pins[0].gpio.port, g_pins[0].gpio.pin, g_LED0 );
	}

	if ( MRT_GetEnabledInterrupts( MRT0, kMRT_Channel_1 ) ) {
	if ( MRT_GetStatusFlags( MRT0, kMRT_Channel_1 ) == (MRT_CHANNEL_STAT_INTFLAG_MASK | MRT_CHANNEL_STAT_RUN_MASK) ) {
		MRT_ClearStatusFlags( MRT0, kMRT_Channel_1, kMRT_TimerInterruptFlag );

		g_doPWM = 0;
		g_LED1 = !g_LED1;
		GPIO_PinWrite( g_pins[3].gpio.base, g_pins[3].gpio.port, g_pins[3].gpio.pin, g_LED1 );
	}
	}

	SDK_ISR_EXIT_BARRIER;
}

/*
 * @brief   Application entry point.
 */
int main(void) {

	/* Init board hardware. */
	BOARD_InitBootPins();
	BOARD_InitBootClocks();
	BOARD_InitBootPeripherals();
#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
	/* Init FSL debug console. */
	BOARD_InitDebugConsole();
#endif

	mrt_config_t defaultMRTConfig;
	MRT_GetDefaultConfig( &amp;amp;defaultMRTConfig );
	MRT_Init( MRT0, &amp;amp;defaultMRTConfig );

	MRT_SetupChannelMode( MRT0, kMRT_Channel_0, kMRT_RepeatMode );
	MRT_SetupChannelMode( MRT0, kMRT_Channel_1, kMRT_RepeatMode );

	MRT_UpdateTimerPeriod( MRT0, kMRT_Channel_0, MRTINTERVAL, 1 );
	MRT_UpdateTimerPeriod( MRT0, kMRT_Channel_1, SYSCLOCK, 1 );
 
	MRT_EnableInterrupts( MRT0, kMRT_Channel_0, kMRT_TimerInterruptEnable );
	MRT_DisableInterrupts( MRT0, kMRT_Channel_1, kMRT_TimerInterruptEnable );
	EnableIRQ( MRT0_IRQn );  /* Normally, this would be called in peripherals.c */&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 06:29:17 GMT</pubDate>
    <dc:creator>aaronm</dc:creator>
    <dc:date>2024-10-31T06:29:17Z</dc:date>
    <item>
      <title>LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1985306#M57190</link>
      <description>&lt;P&gt;Hi, I'm using MRT on LPC832 (SDK: 2.16.000), and if I call the following, the interrupt for channel 1 does actually happen, and the flags for RUN and INT are set. &amp;nbsp;To ignore channel 1, I have to test for &lt;FONT color="#FF9900"&gt;MRT_GetEnabledInterrupts&lt;/FONT&gt;() in the interrupt handler. &amp;nbsp;Which is Ok, because it works, but it seems counter-intuitive that if I say "disable interrupts for channel 1," the interrupt is still actually enabled. &amp;nbsp;Or am I doing something wrong?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void MRT0_DriverIRQHandler(void)
{
	if ( MRT_GetStatusFlags( MRT0, kMRT_Channel_0 ) == (MRT_CHANNEL_STAT_INTFLAG_MASK | MRT_CHANNEL_STAT_RUN_MASK) ) {
		MRT_ClearStatusFlags( MRT0, kMRT_Channel_0, kMRT_TimerInterruptFlag );
		g_doPWM = 0;
		g_LED0 = !g_LED0;
		GPIO_PinWrite( g_pins[0].gpio.base, g_pins[0].gpio.port, g_pins[0].gpio.pin, g_LED0 );
	}

	if ( MRT_GetEnabledInterrupts( MRT0, kMRT_Channel_1 ) ) {
	if ( MRT_GetStatusFlags( MRT0, kMRT_Channel_1 ) == (MRT_CHANNEL_STAT_INTFLAG_MASK | MRT_CHANNEL_STAT_RUN_MASK) ) {
		MRT_ClearStatusFlags( MRT0, kMRT_Channel_1, kMRT_TimerInterruptFlag );

		g_doPWM = 0;
		g_LED1 = !g_LED1;
		GPIO_PinWrite( g_pins[3].gpio.base, g_pins[3].gpio.port, g_pins[3].gpio.pin, g_LED1 );
	}
	}

	SDK_ISR_EXIT_BARRIER;
}

/*
 * @brief   Application entry point.
 */
int main(void) {

	/* Init board hardware. */
	BOARD_InitBootPins();
	BOARD_InitBootClocks();
	BOARD_InitBootPeripherals();
#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
	/* Init FSL debug console. */
	BOARD_InitDebugConsole();
#endif

	mrt_config_t defaultMRTConfig;
	MRT_GetDefaultConfig( &amp;amp;defaultMRTConfig );
	MRT_Init( MRT0, &amp;amp;defaultMRTConfig );

	MRT_SetupChannelMode( MRT0, kMRT_Channel_0, kMRT_RepeatMode );
	MRT_SetupChannelMode( MRT0, kMRT_Channel_1, kMRT_RepeatMode );

	MRT_UpdateTimerPeriod( MRT0, kMRT_Channel_0, MRTINTERVAL, 1 );
	MRT_UpdateTimerPeriod( MRT0, kMRT_Channel_1, SYSCLOCK, 1 );
 
	MRT_EnableInterrupts( MRT0, kMRT_Channel_0, kMRT_TimerInterruptEnable );
	MRT_DisableInterrupts( MRT0, kMRT_Channel_1, kMRT_TimerInterruptEnable );
	EnableIRQ( MRT0_IRQn );  /* Normally, this would be called in peripherals.c */&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 06:29:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1985306#M57190</guid>
      <dc:creator>aaronm</dc:creator>
      <dc:date>2024-10-31T06:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1985752#M57194</link>
      <description>&lt;P&gt;Hello, my name is Pavel and I will be supporting your case, I reviwed the example on the SDK LPCOpen on the IDE MCUXpresso and this use the next to active.&lt;/P&gt;
&lt;DIV style="background-color: #ffffff; padding: 0px 0px 0px 2px;"&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Consolas'; font-size: 10pt; white-space: pre;"&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;/* Enable the interrupt for the MRT */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;NVIC_EnableIRQ&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MRT_IRQn&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;And on bellow of this there is&lt;/P&gt;
&lt;DIV style="background-color: #ffffff; padding: 0px 0px 0px 2px;"&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Consolas'; font-size: 10pt; white-space: pre;"&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;void&lt;/SPAN&gt; &lt;SPAN&gt;NVIC_DisableIRQ&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;IRQn_Type&lt;/SPAN&gt;&lt;SPAN&gt; IRQn)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;Could you try with this.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I couldn't find the function of&amp;nbsp;&lt;SPAN&gt;MRT_GetEnabledInterrupts.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Pavel&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 18:54:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1985752#M57194</guid>
      <dc:creator>Pavel_Hernandez</dc:creator>
      <dc:date>2024-10-31T18:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1985808#M57196</link>
      <description>&lt;P&gt;Hi Pavel,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NVIC_DisableIRQ() will definitely shut off the interrupt for MRT, but it will shut off *all* interrupts for MRT. &amp;nbsp;The LPC832 has &lt;FONT color="#800080"&gt;4 channels&lt;/FONT&gt; for MRT, and they're all enabled or disabled, with NVIC_EnableIRQ() or disable, as above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, in the MRT peripheral, there's a &lt;FONT color="#FF9900"&gt;MRT_DisableInterrupts&lt;/FONT&gt;() that should, I assume, disable a particular MRT channel, as needed. &amp;nbsp;So if I configure two MRT channels, and then want to stop one of them,&amp;nbsp;MRT_DisableInterrupts() should do that. &amp;nbsp;However, in the interrupt handler,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MRT_GetStatusFlags( MRT0, kMRT_Channel_1 ) == (MRT_CHANNEL_STAT_INTFLAG_MASK | MRT_CHANNEL_STAT_RUN_MASK) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;returns true, even if channel 1 has had its interrupt disabled. &amp;nbsp;This following check in the ISR will block the ISR portion for channel 1 from executing, but I'm wondering why the channel was hardware triggered in the first place, if the channel was disabled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if ( MRT_GetEnabledInterrupts( MRT0, kMRT_Channel_1 ) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SDK documentation is here:&amp;nbsp;&lt;A href="https://mcuxpresso.nxp.com/api_doc/dev/4555/a00017.html#gafa8493a0faee1cc356da26ca99a54da8" target="_blank"&gt;https://mcuxpresso.nxp.com/api_doc/dev/4555/a00017.html#gafa8493a0faee1cc356da26ca99a54da8&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Like I said, I can work around this, but I'm curious if this is how it's supposed to work.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 22:04:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1985808#M57196</guid>
      <dc:creator>aaronm</dc:creator>
      <dc:date>2024-10-31T22:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1986487#M57200</link>
      <description>&lt;P&gt;Hello, I'm using the SDK of LPCOpen on the MCUXpresso and that library is not added, where are you develop this? Could you share the source of this example?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pavel_Hernandez_0-1730510974198.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/308228iDC591D18ACC1ED2A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pavel_Hernandez_0-1730510974198.png" alt="Pavel_Hernandez_0-1730510974198.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Pavel&lt;/P&gt;</description>
      <pubDate>Sat, 02 Nov 2024 01:29:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1986487#M57200</guid>
      <dc:creator>Pavel_Hernandez</dc:creator>
      <dc:date>2024-11-02T01:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1987710#M57209</link>
      <description>&lt;P&gt;Hi Pavel,&lt;/P&gt;&lt;P&gt;Sorry for the delay: I was out of town for the weekend. &amp;nbsp;I got the SDK from NXP's SDK Builder:&amp;nbsp;&lt;A href="https://mcuxpresso.nxp.com/en" target="_blank"&gt;https://mcuxpresso.nxp.com/en&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Go there, select "Select Board / Processor"; enter "LPC832," and then build your SDk. &amp;nbsp;Current version is 2.16.000.&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 06:41:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1987710#M57209</guid>
      <dc:creator>aaronm</dc:creator>
      <dc:date>2024-11-05T06:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1988375#M57216</link>
      <description>&lt;P&gt;Hello, thanks for the information I was using the LPCOpen, I will download and reviewed.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Pavel&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 02:14:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1988375#M57216</guid>
      <dc:creator>Pavel_Hernandez</dc:creator>
      <dc:date>2024-11-06T02:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1993153#M57237</link>
      <description>&lt;P&gt;Hello, I did a simple test with the part of the code that you upload, but I need more information, could you open an Internal case put my name I will take it, because I need you share the whole project or the whole main.c. I think replay the same issue that you report on my board.&lt;/P&gt;
&lt;P&gt;Let me know what you do.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Pavel&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 22:10:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1993153#M57237</guid>
      <dc:creator>Pavel_Hernandez</dc:creator>
      <dc:date>2024-11-12T22:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: LPC832: MRT_DisableInterrupts() doesn't actually prevent interrupt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1994000#M57246</link>
      <description>&lt;P&gt;Hey, Pavel, the entire code base can be found here, but it's not that important, I guess. &amp;nbsp;I can work around it. &amp;nbsp;I just wanted to understand the "why" behind the way it works, since it's somewhat unintuitive, but since I can work around it, it's less critical, now.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-Sample-project-for-using-MRT-to-generate-more-than-6-PWMs/m-p/1991330#M57225" target="_blank"&gt;https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-Sample-project-for-using-MRT-to-generate-more-than-6-PWMs/m-p/1991330#M57225&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Feel free to close this one out.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 20:55:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC832-MRT-DisableInterrupts-doesn-t-actually-prevent-interrupt/m-p/1994000#M57246</guid>
      <dc:creator>aaronm</dc:creator>
      <dc:date>2024-11-13T20:55:42Z</dc:date>
    </item>
  </channel>
</rss>

