<?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>topic Re: uart_interrupt how does DEMO_UART_IRQHandler() get invoked in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1168381#M6226</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/178492"&gt;@stdcerr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you Left click on UART4_RX_TX_IRQHandler and then hit F3 (to bring up the definition) you'll see:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;WEAK void UART4_RX_TX_IRQHandler(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{ UART4_RX_TX_DriverIRQHandler();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This is the default definition of the interrupt handler for the UART4 RX/TX and if you repeat the F3 operation with the link inside the method, yoiu'll find that it leads to:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;void UART1_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;and if you F3 "IntDefaultHandler" you'll get to:&lt;/P&gt;&lt;P&gt;/&lt;FONT face="courier new,courier"&gt;/*****************************************************************************&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// Processor ends up here if an unexpected interrupt occurs or a specific&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// handler is not present in the application code.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;//*****************************************************************************&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;WEAK_AV void IntDefaultHandler(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{ while(1) {}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Which is what you expect (ie if you haven't defined an interrupt handler, you're going to a default one that does nothing).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The default handler referenced above has the "WEAK" option which means that if the "UART4_RX_TX_IRQHandler" is redefined, as in the definition code, then the original vector (which leads to "IntDefaultHandler") is overwritten with the address of your (or the demo) handler code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a feature of C99 which is completely non-intuitive but once you understand and accept it things become a bit more consistent when working with things like adding interrupt handlers.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2020 18:03:05 GMT</pubDate>
    <dc:creator>myke_predko</dc:creator>
    <dc:date>2020-10-15T18:03:05Z</dc:date>
    <item>
      <title>uart_interrupt how does DEMO_UART_IRQHandler() get invoked</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1166963#M6215</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question regarding uart_interrupt.c:&lt;/P&gt;&lt;P&gt;How does the ISR (DEMO_UART_IRQHandler) get invoked?&lt;/P&gt;&lt;P&gt;I cxhanged the example code from using UART0 to using UART4 and have updated the macros like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define DEMO_UART_IRQn       UART4_RX_TX_IRQn
#define DEMO_UART_IRQHandler UART4_RX_TX_IRQHandler&lt;/LI-CODE&gt;&lt;P&gt;then enabling the interrupts looks like:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    /* Enable RX interrupt. */
    UART_EnableInterrupts(DEMO_UART, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable);
    EnableIRQ(DEMO_UART_IRQn);&lt;/LI-CODE&gt;&lt;P&gt;but I'm not sure now, if UART4RxInterrupt really invokes DEMO_UART_IRQHandler() and if it does, how is DEMO_UART_IRQHandler associated with the interrupt? I feel like I'm missing a piece somewhere.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 21:46:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1166963#M6215</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2020-10-13T21:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: uart_interrupt how does DEMO_UART_IRQHandler() get invoked</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1167972#M6225</link>
      <description>&lt;P&gt;Hi stdcerr:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see the vector table in devices/MK64F12\mcuxpresso\startup_mk64f12.c,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;__attribute__ ((used, section(".isr_vector")))&lt;BR /&gt;void (* const g_pfnVectors[])(void) = {&lt;BR /&gt;// Core Level - CM4&lt;BR /&gt;&amp;amp;_vStackTop, // The initial stack pointer&lt;BR /&gt;ResetISR, // The reset handler&lt;BR /&gt;NMI_Handler, // The NMI handler&lt;BR /&gt;HardFault_Handler, // The hard fault handler&lt;BR /&gt;MemManage_Handler, // The MPU fault handler&lt;BR /&gt;BusFault_Handler, // The bus fault handler&lt;BR /&gt;UsageFault_Handler, // The usage fault handler&lt;BR /&gt;0, // Reserved&lt;BR /&gt;0, // Reserved&lt;BR /&gt;0, // Reserved&lt;BR /&gt;0, // Reserved&lt;BR /&gt;SVC_Handler, // SVCall handler&lt;BR /&gt;DebugMon_Handler, // Debug monitor handler&lt;BR /&gt;0, // Reserved&lt;BR /&gt;PendSV_Handler, // The PendSV handler&lt;BR /&gt;SysTick_Handler, // The SysTick handler&lt;/P&gt;
&lt;P&gt;// Chip Level - MK64F12&lt;BR /&gt;DMA0_IRQHandler, // 16 : DMA Channel 0 Transfer Complete&lt;BR /&gt;DMA1_IRQHandler, // 17 : DMA Channel 1 Transfer Complete&lt;BR /&gt;DMA2_IRQHandler, // 18 : DMA Channel 2 Transfer Complete&lt;BR /&gt;DMA3_IRQHandler, // 19 : DMA Channel 3 Transfer Complete&lt;BR /&gt;DMA4_IRQHandler, // 20 : DMA Channel 4 Transfer Complete&lt;BR /&gt;DMA5_IRQHandler, // 21 : DMA Channel 5 Transfer Complete&lt;BR /&gt;DMA6_IRQHandler, // 22 : DMA Channel 6 Transfer Complete&lt;BR /&gt;DMA7_IRQHandler, // 23 : DMA Channel 7 Transfer Complete&lt;BR /&gt;DMA8_IRQHandler, // 24 : DMA Channel 8 Transfer Complete&lt;BR /&gt;DMA9_IRQHandler, // 25 : DMA Channel 9 Transfer Complete&lt;BR /&gt;DMA10_IRQHandler, // 26 : DMA Channel 10 Transfer Complete&lt;BR /&gt;DMA11_IRQHandler, // 27 : DMA Channel 11 Transfer Complete&lt;BR /&gt;DMA12_IRQHandler, // 28 : DMA Channel 12 Transfer Complete&lt;BR /&gt;DMA13_IRQHandler, // 29 : DMA Channel 13 Transfer Complete&lt;BR /&gt;DMA14_IRQHandler, // 30 : DMA Channel 14 Transfer Complete&lt;BR /&gt;DMA15_IRQHandler, // 31 : DMA Channel 15 Transfer Complete&lt;BR /&gt;DMA_Error_IRQHandler, // 32 : DMA Error Interrupt&lt;BR /&gt;MCM_IRQHandler, // 33 : Normal Interrupt&lt;BR /&gt;FTFE_IRQHandler, // 34 : FTFE Command complete interrupt&lt;BR /&gt;Read_Collision_IRQHandler, // 35 : Read Collision Interrupt&lt;BR /&gt;LVD_LVW_IRQHandler, // 36 : Low Voltage Detect, Low Voltage Warning&lt;BR /&gt;LLWU_IRQHandler, // 37 : Low Leakage Wakeup Unit&lt;BR /&gt;WDOG_EWM_IRQHandler, // 38 : WDOG Interrupt&lt;BR /&gt;RNG_IRQHandler, // 39 : RNG Interrupt&lt;BR /&gt;I2C0_IRQHandler, // 40 : I2C0 interrupt&lt;BR /&gt;I2C1_IRQHandler, // 41 : I2C1 interrupt&lt;BR /&gt;SPI0_IRQHandler, // 42 : SPI0 Interrupt&lt;BR /&gt;SPI1_IRQHandler, // 43 : SPI1 Interrupt&lt;BR /&gt;I2S0_Tx_IRQHandler, // 44 : I2S0 transmit interrupt&lt;BR /&gt;I2S0_Rx_IRQHandler, // 45 : I2S0 receive interrupt&lt;BR /&gt;UART0_LON_IRQHandler, // 46 : UART0 LON interrupt&lt;BR /&gt;UART0_RX_TX_IRQHandler, // 47 : UART0 Receive/Transmit interrupt&lt;BR /&gt;UART0_ERR_IRQHandler, // 48 : UART0 Error interrupt&lt;BR /&gt;UART1_RX_TX_IRQHandler, // 49 : UART1 Receive/Transmit interrupt&lt;BR /&gt;UART1_ERR_IRQHandler, // 50 : UART1 Error interrupt&lt;BR /&gt;UART2_RX_TX_IRQHandler, // 51 : UART2 Receive/Transmit interrupt&lt;BR /&gt;UART2_ERR_IRQHandler, // 52 : UART2 Error interrupt&lt;BR /&gt;UART3_RX_TX_IRQHandler, // 53 : UART3 Receive/Transmit interrupt&lt;BR /&gt;UART3_ERR_IRQHandler, // 54 : UART3 Error interrupt&lt;BR /&gt;ADC0_IRQHandler, // 55 : ADC0 interrupt&lt;BR /&gt;CMP0_IRQHandler, // 56 : CMP0 interrupt&lt;BR /&gt;CMP1_IRQHandler, // 57 : CMP1 interrupt&lt;BR /&gt;FTM0_IRQHandler, // 58 : FTM0 fault, overflow and channels interrupt&lt;BR /&gt;FTM1_IRQHandler, // 59 : FTM1 fault, overflow and channels interrupt&lt;BR /&gt;FTM2_IRQHandler, // 60 : FTM2 fault, overflow and channels interrupt&lt;BR /&gt;CMT_IRQHandler, // 61 : CMT interrupt&lt;BR /&gt;RTC_IRQHandler, // 62 : RTC interrupt&lt;BR /&gt;RTC_Seconds_IRQHandler, // 63 : RTC seconds interrupt&lt;BR /&gt;PIT0_IRQHandler, // 64 : PIT timer channel 0 interrupt&lt;BR /&gt;PIT1_IRQHandler, // 65 : PIT timer channel 1 interrupt&lt;BR /&gt;PIT2_IRQHandler, // 66 : PIT timer channel 2 interrupt&lt;BR /&gt;PIT3_IRQHandler, // 67 : PIT timer channel 3 interrupt&lt;BR /&gt;PDB0_IRQHandler, // 68 : PDB0 Interrupt&lt;BR /&gt;USB0_IRQHandler, // 69 : USB0 interrupt&lt;BR /&gt;USBDCD_IRQHandler, // 70 : USBDCD Interrupt&lt;BR /&gt;Reserved71_IRQHandler, // 71 : Reserved interrupt&lt;BR /&gt;DAC0_IRQHandler, // 72 : DAC0 interrupt&lt;BR /&gt;MCG_IRQHandler, // 73 : MCG Interrupt&lt;BR /&gt;LPTMR0_IRQHandler, // 74 : LPTimer interrupt&lt;BR /&gt;PORTA_IRQHandler, // 75 : Port A interrupt&lt;BR /&gt;PORTB_IRQHandler, // 76 : Port B interrupt&lt;BR /&gt;PORTC_IRQHandler, // 77 : Port C interrupt&lt;BR /&gt;PORTD_IRQHandler, // 78 : Port D interrupt&lt;BR /&gt;PORTE_IRQHandler, // 79 : Port E interrupt&lt;BR /&gt;SWI_IRQHandler, // 80 : Software interrupt&lt;BR /&gt;SPI2_IRQHandler, // 81 : SPI2 Interrupt&lt;BR /&gt;UART4_RX_TX_IRQHandler, // 82 : UART4 Receive/Transmit interrupt&lt;BR /&gt;UART4_ERR_IRQHandler, // 83 : UART4 Error interrupt&lt;BR /&gt;UART5_RX_TX_IRQHandler, // 84 : UART5 Receive/Transmit interrupt&lt;BR /&gt;UART5_ERR_IRQHandler, // 85 : UART5 Error interrupt&lt;BR /&gt;CMP2_IRQHandler, // 86 : CMP2 interrupt&lt;BR /&gt;FTM3_IRQHandler, // 87 : FTM3 fault, overflow and channels interrupt&lt;BR /&gt;DAC1_IRQHandler, // 88 : DAC1 interrupt&lt;BR /&gt;ADC1_IRQHandler, // 89 : ADC1 interrupt&lt;BR /&gt;I2C2_IRQHandler, // 90 : I2C2 interrupt&lt;BR /&gt;CAN0_ORed_Message_buffer_IRQHandler, // 91 : CAN0 OR'd message buffers interrupt&lt;BR /&gt;CAN0_Bus_Off_IRQHandler, // 92 : CAN0 bus off interrupt&lt;BR /&gt;CAN0_Error_IRQHandler, // 93 : CAN0 error interrupt&lt;BR /&gt;CAN0_Tx_Warning_IRQHandler, // 94 : CAN0 Tx warning interrupt&lt;BR /&gt;CAN0_Rx_Warning_IRQHandler, // 95 : CAN0 Rx warning interrupt&lt;BR /&gt;CAN0_Wake_Up_IRQHandler, // 96 : CAN0 wake up interrupt&lt;BR /&gt;SDHC_IRQHandler, // 97 : SDHC interrupt&lt;BR /&gt;ENET_1588_Timer_IRQHandler, // 98 : Ethernet MAC IEEE 1588 Timer Interrupt&lt;BR /&gt;ENET_Transmit_IRQHandler, // 99 : Ethernet MAC Transmit Interrupt&lt;BR /&gt;ENET_Receive_IRQHandler, // 100: Ethernet MAC Receive Interrupt&lt;BR /&gt;ENET_Error_IRQHandler, // 101: Ethernet MAC Error and miscelaneous Interrupt&lt;/P&gt;
&lt;P&gt;}; /* End of g_pfnVectors */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;when interrupt&amp;nbsp; (82 : UART4 Receive/Transmit interrupt) fires,&amp;nbsp; then isr&amp;nbsp;&amp;nbsp;UART4_RX_TX_IRQHandler will be called.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 05:23:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1167972#M6225</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2020-10-15T05:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: uart_interrupt how does DEMO_UART_IRQHandler() get invoked</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1168381#M6226</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/178492"&gt;@stdcerr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you Left click on UART4_RX_TX_IRQHandler and then hit F3 (to bring up the definition) you'll see:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;WEAK void UART4_RX_TX_IRQHandler(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{ UART4_RX_TX_DriverIRQHandler();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This is the default definition of the interrupt handler for the UART4 RX/TX and if you repeat the F3 operation with the link inside the method, yoiu'll find that it leads to:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;void UART1_RX_TX_DriverIRQHandler(void) ALIAS(IntDefaultHandler);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;and if you F3 "IntDefaultHandler" you'll get to:&lt;/P&gt;&lt;P&gt;/&lt;FONT face="courier new,courier"&gt;/*****************************************************************************&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// Processor ends up here if an unexpected interrupt occurs or a specific&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// handler is not present in the application code.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;//*****************************************************************************&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;WEAK_AV void IntDefaultHandler(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{ while(1) {}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Which is what you expect (ie if you haven't defined an interrupt handler, you're going to a default one that does nothing).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The default handler referenced above has the "WEAK" option which means that if the "UART4_RX_TX_IRQHandler" is redefined, as in the definition code, then the original vector (which leads to "IntDefaultHandler") is overwritten with the address of your (or the demo) handler code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a feature of C99 which is completely non-intuitive but once you understand and accept it things become a bit more consistent when working with things like adding interrupt handlers.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 18:03:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1168381#M6226</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2020-10-15T18:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: uart_interrupt how does DEMO_UART_IRQHandler() get invoked</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1508954#M8321</link>
      <description>&lt;P&gt;I'm using spifi driver and sample code of polling transfer. my code was going in&amp;nbsp; "&lt;FONT face="courier new,courier"&gt;WEAK_AV void IntDefaultHandler(void)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{ while(1) {}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;"&lt;/P&gt;&lt;P&gt;as well. Why do we need an interrupt handler? Why is the SKD sample code not taking care of the SPIFI interrupt?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 18:29:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/uart-interrupt-how-does-DEMO-UART-IRQHandler-get-invoked/m-p/1508954#M8321</guid>
      <dc:creator>NVazquez</dc:creator>
      <dc:date>2022-08-19T18:29:36Z</dc:date>
    </item>
  </channel>
</rss>

