On 6/13/14, 2:53 PM, "Ivan Nazarenko" <[email protected]> wrote:

>On Fri, 13 Jun 2014 13:48:59 -0700 (PDT)
>Aswin <[email protected]> wrote:
>
>> Hi,
>> 
>> I need to interface BBB with a PIC microcontroller using UART. I have
>>had 
>> partial success- I could read the data received by BBB using minicom as
>> well as this command: (stty 115200 cs8 -ixon; cat) < /dev/ttyO0 >
>> UART_data.log   
>> I assume these two methods use polling.
>> 
>> My app expects around 80kB data from PIC and need to write it into some
>> file. Since polling would mean that BBB would've to loop and not be
>>able to 
>> execute anything else, I guess I should go for interrupt driven UART.
>>But 
>> I'm totally clueless on how to go about it. Can someone please help me?
>
>I assume these two methods end up doing a libc "read", which transfers to
>the OS the task of reading the data. IFAIK, it does use interrupts.
>
>http://www.freebsd.org/cgi/man.cgi?query=read&sektion=2
>
>Notice that when you specify the amount of data to be read (nbytes) the
>read "blocks" until that amount of data arrives. But while blocked
>waiting, you will also notice that the CPU is almost all free for other
>threads and processes.
>
>So simply start a new thread or process and use the OS to read the data.
>The OS will handle it gracefully, with low CPU overhead. Even if you
>loop, reading small chunks (like 1 or 8 bytes, for instance), just for
>checking the live stream in real time, still the CPU usage would be
>negligible at 115200.
Or you can use Node.js which uses non blocking I/O. No need to deal with
the problems associated with threads. If you want to present that data on
a dynamic webpage, you could do that in just a few lines of code.

Regards,
John
>
>-- 
>For more options, visit http://beagleboard.org/discuss
>--- 
>You received this message because you are subscribed to the Google Groups
>"BeagleBoard" group.
>To unsubscribe from this group and stop receiving emails from it, send an
>email to [email protected].
>For more options, visit https://groups.google.com/d/optout.


-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to