On Tuesday, May 13, 2014 4:46:29 AM UTC-6, [email protected] wrote:
>
> I have recently purchased a Freetronics IR Temperature sensor and have 
> been using it on the Beaglebone Black. I have been using the supplied c++ 
> arudino code which I modified to access GPIO pins on the BBB. 
>
> However it uses 60-80% of the cpu when running. The synchronous serial 
> algorithm is inefficient as it uses while loops to wait for the clock to 
> cycle.
>
> Is there a better, more efficient, way to read synchronous serial over 
> gpio pins?
>
>
Hi,

Looking at the driver code, this device has an interface that is almost 
SPI, except that the clock is driven by the device and the chip select 
(what they call aquire) is driven by the BBB. Because it is not standard 
SPI you can't use the SPI interface on the BBB. 

The best you could do would be to change the mode of the clock input pin so 
that it generates an interrupt on each rising edge. Your interrupt handler 
would read the data line and collect 1 bit at each interrupt. The interrupt 
handler would build the 5 data bytes, and save them into the data array and 
then signal the main application when all 5 bytes have been read. The main 
application would take the acquire signal low to start the measurement, 
then wait (suspended by the kernel) until the I/O complete signal was 
received from the interrupt handler. It would then release the acquire 
signal and process the data in the buffer as it does now. 

This would replace all the busy waiting with 40 short interrupt handler 
executions, and a short burst of activity at the beginning and end of each 
measurement. The CPU load would probably be too low to measure.

HTH
Dennis Cote

-- 
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