I'm reading sensors using the analog inputs on my BBG and for my real application the SFS system is plenty fast enough but I do occasionally get share violation exceptions. I'm assuming that I'm attempting to read the file exactly when it is being written and therefore I get the exception. A try/catch handles that but I'd much rather just check to see if the conversion/write has finished and not generate exceptions.
Problem is I can't seem to find any information on what to check or even if there is anything I can check. Anyone have any information on this?
--
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 beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You realize that you can read the ADC from Linux at full speed also? No need to use the PRU.
Regards,
JohnI do, because I've proven just that :) mmap() is dahmed fast . . .
First, that isn’t going to work because the ADC uses a scan loop and unless you can respond to interrupts, you cannot determine when the ADC conversion has completed. There is a much simpler way to do this. Simply use the IIO driver and then
dd if=/dev/iio:device0 of=~/test
FIrst of all, it *will* work. I've done it, and it works. Second of all, in continuous mode, values are put out as 32bit values. Only the first 12bits is the actual ADC value. The next 4 bits is the channel ID( 0 - 7 ), and the last 16bits reserved / unused. Thirdly, using interrupts in fast moving code is about as bad of an idea as using try / catch blocks in fast moving code. It adds code latency, and also introduces non deterministic behavior. This is why iio does not work fast for short data sets.First, that isn’t going to work because the ADC uses a scan loop and unless you can respond to interrupts, you cannot determine when the ADC conversion has completed. There is a much simpler way to do this. Simply use the IIO driver and then
For example, do:dd if=/dev/iio:device0 of=~/testEnable the iio buffer and your file will receive samples at the configured speed.
From what I remember, the solution you proposed was using 90% of the CPU.
Oh, and one more thing; the IIO driver uses a top half and bottom half for handling interrupts, so you won’t see and added latency. All the real work is done in a workqueue.
mmap isn't faster than a kernel driver (kernel code has priority over user space code) and you still cannot handle interrupts from user space. Anyway, you won’t find any drivers in the kernel implemented your way (/dev/mem, mmap). However, mmap is used in drivers to eliminate mem to mem copy when transferring data between user space and kernel space.
Regards,
JohnNow. not only are you wrong, but you're making stuff up. You can handle interrupts from userspace, as much as iio can. But it's not my job to tell you how. I will mention that perhaps you should look into "userspace drivers". As far as whats faster ? who f***ing cares. mmap() is a lot faster than the ADCs . . . and still not the point.
Wrong again, UIO attempts to handle interrupts as events, but the concept is slow (typically ms, not us)
Thinking a little about what your requirement, it would by simple to modify these parameters in BB-ADC driver via sysfs. Think of the DT as default parameters when the driver first starts.
--