<?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>MQX Software SolutionsのトピックRe: MQX UART twrcf51cn problem</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186546#M3265</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leonardo,&lt;/P&gt;&lt;P&gt;Glad your persistence paid off to allow you to find a solution.&amp;nbsp;&amp;nbsp; Good work.&lt;/P&gt;&lt;P&gt;The idea behind the itty (SCI interrupt) mode is to hide the underlying driver and isr code from you so you only have to read/write when you want to.&amp;nbsp; If you really want to replace or edit the SCI interrupt then you are really editing the RTOS driver code rather than creating application level code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So your solution of doing the coding at application level to parse the characters received is really the best solution.&lt;/P&gt;&lt;P&gt;The SCI interrupt routine grabs the SCID value and places it in a FIFO buffer.&amp;nbsp; When you do a fread() if data is present in buffer, then it is given to you.&amp;nbsp; If not your code blocks.&amp;nbsp; Therefore you are indirectly reading the SCID register.&lt;/P&gt;&lt;P&gt;The FSLMQX/mqx/examples/isr demo is a good start for learning about linking to an exisiting periodic interrupt (the heart beat of the RTOS).&amp;nbsp; Pretty cool.&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Mar 2011 22:48:15 GMT</pubDate>
    <dc:creator>DavidS</dc:creator>
    <dc:date>2011-03-02T22:48:15Z</dc:date>
    <item>
      <title>MQX UART twrcf51cn problem</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186543#M3262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a problem with the serial module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First at all I have a LOT of doubts about set up the UART module with MQX. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;serial_fd = &amp;nbsp;fopen(BSP_DEFAULT_IO_CHANNEL, 0);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;baud_rate = 9600;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;flags=IO_SERIAL_NON_BLOCKING;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ioctl(serial_fd, IO_IOCTL_SERIAL_SET_BAUD, &amp;amp;baud_rate);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ioctl(serial_fd, IO_IOCTL_SERIAL_SET_FLAGS, &amp;amp;flags);&lt;/DIV&gt;&lt;DIV&gt;Then for reception I have to do the next:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;char receive[248];&lt;/DIV&gt;&lt;DIV&gt;if (fstatus(serial_fd)) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;read(serial_fd, &amp;amp;receive, 248);&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;Here my doubt with the &lt;STRONG&gt;flag =IO_SERIAL_NON_BLOCKING&lt;/STRONG&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the documentation saids:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"In this mode the _io_read() function doesn’t&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;wait till the receive buffer is full, but it&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;immediately returns received characters&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;and number of received characters."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've declared&amp;nbsp;char receive[248] with a size of 248 bytes because it's the maximun number of data that i can receive, but my messages have diffrentes size's. I mean in some moment I can receive "FF 00 09 01 01 14 E8" but in other moment i can receive&amp;nbsp;&lt;/P&gt;&lt;P&gt;"FF&amp;nbsp;&lt;SPAN style="line-height: 14px; white-space: pre-wrap; color: #000000;"&gt;C8 65 00 00 00 0E 02 EA 00 0E 16 72 00 0D EF 62 00 0D D0 22 00 0E 18 66 00 0D ED 6E 00 0E 04 DE 00 0E 22 2A 00 0E 0E A2 00 0D D2 16 00 0D F7 32 00 0D CE 2E 00 0D E7 92 00 0D FD 0E 00 0E 24 1E 00 0E 10 96 00 0D F1 56 00 0E 1E 42 00 0D E5 9E 00 0D FB 1A 00 0E 14 7E 00 0D CC 3A 00 0D FF 02 00 0D E1 B6 00 0D CA 46 00 0D E9 86 00 0D D4 0A 00 0E 08 C6 00 0E 26 12 00 0E 12 8A 00 0D D7 F2 00 0E 0C AE 00 0D DF C2 00 0E 20 36 00 0E 0A BA 00 0D F5 3E 00 0D DD CE 00 0E 1C 4E 00 0D F9 26 00 0D E3 AA 00 0D C8 52 00 0D DB DA 00 0E 06 D2 00 0E 1A 5A 00 0D F3 4A 00 0D C6 5E 00 0D D9 E6 00 0E 00 F6 00 0D D5 FE 00 0D EB 7A 12 02"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;When i call&amp;nbsp;&lt;/STRONG&gt;&lt;U&gt;read(serial_fd, &amp;amp;receive, 248);&lt;/U&gt; I have 2 problems:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. When i set the flag&amp;nbsp;&lt;STRONG&gt;IO_SERIAL_NON_BLOCKING&lt;/STRONG&gt; I only&amp;nbsp;&lt;SPAN style="font-family: arial, sans-serif; font-size: 13px; color: #000000; line-height: normal;"&gt;receipt the first byte&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans-serif; font-size: 13px; color: #000000; line-height: normal;"&gt;2. When I dont set the flag&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;IO_SERIAL_NON_BLOCKING the read function waits&amp;nbsp;till the receive buffer is full. But it doesnt work for me. i need to receive a variable number of bytes and save the data into a variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone can help me I'll be very grateful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Feb 2011 10:56:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186543#M3262</guid>
      <dc:creator>NeuroSolutions</dc:creator>
      <dc:date>2011-02-26T10:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: MQX UART twrcf51cn problem</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186544#M3263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi NeuroSolutions,&lt;/P&gt;&lt;P&gt;Interesting issue.&amp;nbsp; I don't have solution at first but have questions for you.&lt;/P&gt;&lt;P&gt;Is the default TTY set for Polling or Interrupt mode?&lt;/P&gt;&lt;P&gt;Polling mode means that each time you want to read the UART, your code is blocking until it reads X characters.&amp;nbsp;&amp;nbsp; So in this case you would want to know ahead of time how many bytes you want to receive at once.&amp;nbsp; Unless you only read one character at a time and them can determine from the data stream dynamically how many will be sent in the the stream.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interrupt mode means that even if your task isn't asking for characters, the UART interrupt routine will grab the characters and store them in a buffer (size determined in bsp&amp;nbsp;processor support&amp;nbsp;header (ex: twrmcf52259.h) as BSPCFG_UART0_QUEUE_SIZE.&amp;nbsp; Using Interrupt mode helps to prevent over running the UART internal charater buffer should you not poll fast enough or have a task blocking your polling efforts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More genericall do you have a protocol established that will let you know what the variable stream length is going to be?&amp;nbsp; Ex: &amp;lt;size field&amp;gt;&amp;lt;data field&amp;gt; or some character sequence that you can decode at beginning of packet stream to determine what the variable number will be? I ask because the issue seems to be not knowing the variable lenght of received data in the packet.&amp;nbsp; How do you know when to store what you have?&lt;/P&gt;&lt;P&gt;Or is there a variable data stream and it stops for a minute then sends another variable data stream?&amp;nbsp; So in this case you could use a timeout to say if I haven't received any more data the buffer received is all you get?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2011 06:15:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186544#M3263</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2011-03-02T06:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: MQX UART twrcf51cn problem</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186545#M3264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David, thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, I have a protocol &amp;lt;Header&amp;gt;&amp;lt;size field&amp;gt;&amp;lt;data field&amp;gt;&amp;lt;CRC&amp;gt; and I already resolved the problem getting one char at time using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (fstatus(serial_fd)) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; receivedByte = fgetc(serial_fd);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valid = EvaluateReceiveByte(receivedByte); //Machine State&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started using the polled mode ttyb:, then I move to the interrupt mode with ittyb, but the main idea with a interrupt is that you know wich function will be called &lt;SPAN&gt;when a char has been received, and I dont know which is this function. Honestly i dont know how works the interrupts in MQX ( i would like that someone explain me with details &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried installing an ISR&lt;/SPAN&gt; and doesnt work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;typedef struct my_isr_struct&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; MCF51XX_sci_struct&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OLD_ISR_DATA;&amp;nbsp;&amp;nbsp; // Struct that contains the SCI_DATA??&lt;BR /&gt;&amp;nbsp;&amp;nbsp; uint_8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; caracter;&lt;BR /&gt;} MY_ISR_STRUCT, _PTR_ MY_ISR_STRUCT_PTR;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void new_tick_isr&amp;nbsp; (&amp;nbsp; pointer user_isr_ptr ){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; MY_ISR_STRUCT_PTR&amp;nbsp; isr_ptr;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; /* Here I have to get the SCID Value, but i dont know how! */&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;isr_ptr-&amp;gt;OLD_ISR_DATA = _int_get_isr_data(MCF51CN_INT_Vsci2rx);&lt;/P&gt;&lt;P&gt;_int_install_isr(MCF51CN_INT_Vsci2rx, new_tick_isr, isr_ptr);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I have another question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use&lt;STRONG&gt;&lt;EM&gt;_int_get_isr_data(MCF51CN_INT_Vsci2rx);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;It returns a pointer with the data,&amp;nbsp; the data has this prototype &lt;EM&gt;&lt;STRONG&gt;MCF51XX_sci_struct&lt;/STRONG&gt;&lt;/EM&gt;????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cause if not, How can I get the SCID value???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can post an example &lt;SPAN&gt;explaining&lt;/SPAN&gt; how to install another ISR for the serial reception and get the SCID value when an interrupt happens it will be very helpful&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leonardo Arango Baena&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2011 07:03:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186545#M3264</guid>
      <dc:creator>NeuroSolutions</dc:creator>
      <dc:date>2011-03-02T07:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: MQX UART twrcf51cn problem</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186546#M3265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leonardo,&lt;/P&gt;&lt;P&gt;Glad your persistence paid off to allow you to find a solution.&amp;nbsp;&amp;nbsp; Good work.&lt;/P&gt;&lt;P&gt;The idea behind the itty (SCI interrupt) mode is to hide the underlying driver and isr code from you so you only have to read/write when you want to.&amp;nbsp; If you really want to replace or edit the SCI interrupt then you are really editing the RTOS driver code rather than creating application level code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So your solution of doing the coding at application level to parse the characters received is really the best solution.&lt;/P&gt;&lt;P&gt;The SCI interrupt routine grabs the SCID value and places it in a FIFO buffer.&amp;nbsp; When you do a fread() if data is present in buffer, then it is given to you.&amp;nbsp; If not your code blocks.&amp;nbsp; Therefore you are indirectly reading the SCID register.&lt;/P&gt;&lt;P&gt;The FSLMQX/mqx/examples/isr demo is a good start for learning about linking to an exisiting periodic interrupt (the heart beat of the RTOS).&amp;nbsp; Pretty cool.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2011 22:48:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186546#M3265</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2011-03-02T22:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: MQX UART twrcf51cn problem</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186547#M3266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Hi Leonardo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;How does it work the function that you used??&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;valid = EvaluateReceiveByte(receivedByte); //Machine State&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;BR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Daniel&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 20:53:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-UART-twrcf51cn-problem/m-p/186547#M3266</guid>
      <dc:creator>danielarenas</dc:creator>
      <dc:date>2013-09-09T20:53:38Z</dc:date>
    </item>
  </channel>
</rss>

