<?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: Interrupt driven UART in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186057#M3226</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jetoleg,&lt;/P&gt;&lt;P&gt;I've gotten the interrupt version working successfully.&amp;nbsp; Make sure the #define changes are truly in the BSP project and not a file in the /lib/ path as that is only a holding area for the libraries and header files that support MQX and its components.&lt;/P&gt;&lt;P&gt;So best to open the C:\Program Files\Freescale\Freescale MQX 3.1\config\m52259evb\build_libs.mcp to open the BSP mcp and then modify the user_config.h and recompile all components (just to be safe).&lt;/P&gt;&lt;P&gt;I'll attach the modified main.c I have and you can place it in the following directory:&lt;/P&gt;&lt;P&gt;C:\Program Files\Freescale\Freescale MQX 3.1\mqx\examples\io&lt;/P&gt;&lt;P&gt;I'm using the M52259EVB which has 3 UARTs (0/1/2).&amp;nbsp; My example allows enabling the iTTYB or iTTYC.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.freescale.com/files/community_files/MQXGEN/206_Copy_of_main8.c" rel="nofollow" target="_self"&gt;Copy_of_main8.c&lt;/A&gt;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by t.dowe on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-10-15&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;06:21 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 30 May 2009 02:47:31 GMT</pubDate>
    <dc:creator>DavidS</dc:creator>
    <dc:date>2009-05-30T02:47:31Z</dc:date>
    <item>
      <title>Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186054#M3223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have problem with interrupt driven UART implementation. For some reason when I replace ttya to ittya all examples stops working. I added delay in Hello World example to keep task running (as suggested in comments), still no lack.&lt;/P&gt;&lt;P&gt;Documentation doesn't say whole a lot about interrupt driver UARTs. I have a feeling that UART interrupts must be enabled somehow to make it working, but can't find any examples for it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, can any one give me list of acceptable modes for serial I/O initialization?&lt;/P&gt;&lt;P&gt;For example: FILE_PTR serial_fd =&amp;nbsp; fopen("ttya:",0); - have mode argument as 0. Is it only acceptable argument?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2009 23:08:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186054#M3223</guid>
      <dc:creator>Jetoleg</dc:creator>
      <dc:date>2009-05-29T23:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186055#M3224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, find my problem.&lt;/P&gt;&lt;P&gt;Looks like ITTA is not enabled on BSP level in user_config.h. BSPCFG_ENABLE_ITTYA needs to be non-zero value.&lt;/P&gt;&lt;P&gt;I really like this OS, but documentation needs a little overhaul. Looks like if&amp;nbsp; you need to now how things work you need to go source every time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 May 2009 01:22:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186055#M3224</guid>
      <dc:creator>Jetoleg</dc:creator>
      <dc:date>2009-05-30T01:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186056#M3225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still not out the woods.&lt;/P&gt;&lt;P&gt;I added following definitionts:&lt;/P&gt;&lt;P&gt;#define BSPCFG_ENABLE_ITTYA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;#define BSPCFG_ENABLE_TTYA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&lt;/P&gt;&lt;P&gt;UART somehow managed to work ones, but quickly crashed and I can't make it work again.&lt;/P&gt;&lt;P&gt;Currently definitions added to my project, but I aslo tried to add them into BSP user_config.h and rebuilding all the libs for BSP. Still no worky.&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 May 2009 02:30:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186056#M3225</guid>
      <dc:creator>Jetoleg</dc:creator>
      <dc:date>2009-05-30T02:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186057#M3226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jetoleg,&lt;/P&gt;&lt;P&gt;I've gotten the interrupt version working successfully.&amp;nbsp; Make sure the #define changes are truly in the BSP project and not a file in the /lib/ path as that is only a holding area for the libraries and header files that support MQX and its components.&lt;/P&gt;&lt;P&gt;So best to open the C:\Program Files\Freescale\Freescale MQX 3.1\config\m52259evb\build_libs.mcp to open the BSP mcp and then modify the user_config.h and recompile all components (just to be safe).&lt;/P&gt;&lt;P&gt;I'll attach the modified main.c I have and you can place it in the following directory:&lt;/P&gt;&lt;P&gt;C:\Program Files\Freescale\Freescale MQX 3.1\mqx\examples\io&lt;/P&gt;&lt;P&gt;I'm using the M52259EVB which has 3 UARTs (0/1/2).&amp;nbsp; My example allows enabling the iTTYB or iTTYC.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.freescale.com/files/community_files/MQXGEN/206_Copy_of_main8.c" rel="nofollow" target="_self"&gt;Copy_of_main8.c&lt;/A&gt;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by t.dowe on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-10-15&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;06:21 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 May 2009 02:47:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186057#M3226</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2009-05-30T02:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186058#M3227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Works fine now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 May 2009 02:51:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186058#M3227</guid>
      <dc:creator>Jetoleg</dc:creator>
      <dc:date>2009-05-30T02:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186059#M3228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry for rescue this thread, but I'm still a very confused about creates an uart using the functions FILE_PTR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to know what's the numbers of characters in my RX buffer to read it one by one. I've tried with this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if (fstatus(serial_fd))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //while(fstatus(serial_fd))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!feof(serial_fd))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; read(serial_fd,(pointer)&amp;amp;buffer,1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; write(serial_fd,(pointer)&amp;amp;buffer,1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But none of my 3 options works. Curiously, I always obtain not the last, but the penultimate character. I think that my problem is my uart contains the first time I read it a blank character, and if I could know the numbers of characters in my rx buffer, I could solve this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually, I'm not pretty sure, but is at least a good point to start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 05:48:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186059#M3228</guid>
      <dc:creator>Ardoster</dc:creator>
      <dc:date>2009-11-17T05:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186060#M3229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having more doubts about my problem: Just I don't understand why the first character I write via Uart is ignored until receive the second character. By this way, I always obtain the penultime character introduced, and not the last how I should obtain!!!! :smileysad:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code. Please, could you say me where I'm wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/*ISR*-----------------------------------------------------------&lt;BR /&gt;*&lt;BR /&gt;* ISR Name : new_tick_isr&lt;BR /&gt;* Comments :&lt;BR /&gt;*&amp;nbsp;&amp;nbsp; This ISR replaces the existing timer ISR, then calls the&lt;BR /&gt;*&amp;nbsp;&amp;nbsp; old timer ISR.&lt;BR /&gt;*END*-----------------------------------------------------------*/&lt;BR /&gt;&lt;BR /&gt;void uart_isr(pointer user_isr_ptr)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; MY_ISR_STRUCT_PTR&amp;nbsp; isr_ptr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; volatile char buffer;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if (fstatus(serial_fd))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(fstatus(serial_fd))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; read(serial_fd,(pointer)&amp;amp;buffer,1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; write(serial_fd,(pointer)&amp;amp;buffer,1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* Chain to the previous notifier */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; (*isr_ptr-&amp;gt;OLD_ISR)(isr_ptr-&amp;gt;OLD_ISR_DATA);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/*TASK*----------------------------------------------------------&lt;BR /&gt;*&lt;BR /&gt;* Task Name : main_task&lt;BR /&gt;* Comments&amp;nbsp; :&lt;BR /&gt;*&amp;nbsp;&amp;nbsp; UART ISR function. Executed when receiving a new character via uart&lt;BR /&gt;*END*-----------------------------------------------------------*/&lt;BR /&gt;&lt;BR /&gt;void main_task(uint_32 initial_data)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; MY_ISR_STRUCT_PTR&amp;nbsp; uart_isr_ptr;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; uint_32 baud=9600;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; uint_32 flag=IO_SERIAL_RAW_IO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; serial_fd =&amp;nbsp; fopen("ittya:",BSP_DEFAULT_IO_OPEN_MODE);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // configuro la UART0 a 9600 bps&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ioctl(serial_fd,IO_IOCTL_SERIAL_SET_FLAGS, &amp;amp;flag);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ioctl(serial_fd,IO_IOCTL_SERIAL_SET_BAUD, &amp;amp;baud);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(serial_fd,(pointer)"hola",4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; uart_isr_ptr = _mem_alloc_zero((_mem_size)sizeof(MY_ISR_STRUCT));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; uart_isr_ptr-&amp;gt;OLD_ISR_DATA =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _int_get_isr_data(BSP_UART0_INT_VECTOR);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; uart_isr_ptr-&amp;gt;OLD_ISR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _int_get_isr(BSP_UART0_INT_VECTOR);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _int_install_isr(BSP_UART0_INT_VECTOR, uart_isr,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uart_isr_ptr);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fflush(serial_fd);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _mqx_exit(0);&lt;BR /&gt;&lt;BR /&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2009 07:03:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186060#M3229</guid>
      <dc:creator>Ardoster</dc:creator>
      <dc:date>2009-11-17T07:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt driven UART</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186061#M3230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you should not be&amp;nbsp;working with&amp;nbsp;interrupts anyhow, this is hidden by the interrupt serial driver.&lt;/P&gt;&lt;P&gt;So you have to just open the driver, use some ioctl commands and then do the&amp;nbsp;while with fstatus check. Just remember, that the loop ends when there's nothing to read, i.e. it can happen right after you run the program (consider another loop to wait for a character first).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;PetrM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Nov 2009 21:44:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Interrupt-driven-UART/m-p/186061#M3230</guid>
      <dc:creator>PetrM</dc:creator>
      <dc:date>2009-11-23T21:44:59Z</dc:date>
    </item>
  </channel>
</rss>

