Hi all, When working further with this code, I found out that interrupts and thus samples were missed, which was quite unpleasant for my project......
In the project I used this, I replaced the dual buffer strategy with a ring buffer. I have just updated the bbb-pru example code such that: 1) missed interrupts are detected; 2) the sampling thread is run at high priority. It turns out that with a blocksize less than about 2k, interrupts are being missed when the arm is under load (like when compiling another project at the same time). See some log files in the sample code directory apps/adc. The example code is at: https://github.com/l4m4re/bbb-pru The project where I implemented a ring buffer is at: https://github.com/l4m4re/SoakageTester Most of the code is in Sampler.cpp and pru.c, but it's quite messy at the moment and subject to change as well. I may add a ring buffer example to the bbb-pru code project at some point, so others can make use of this. All in all, this code is useful (IMHO) as a base for implementing closed loop controls on the pru, while using the arm to store the data and/or do post-processing, etc. The use of a ring buffer is helpful, because in that case one can afford to miss a few interrupts without losing data, while still having the data available on the arm reasonably fast *most* of the time... Regards, Arend. Arend Lammertink, MScEE, Goor, The Netherlands. W: http://www.tuks.nl T: +316 5425 6426 On Fri, Sep 22, 2017 at 9:07 AM, Arend Lammertink <lam...@gmail.com> wrote: > Hi all, > > I just wanted to share that I managed to run the ADC unit in a BBG at > (almost?) 800 kS/sec sampling two channels, which means a total sampling > rate of 1.6 mS/sec. I forked a small project from rvega and played with the > code. You can find my code at: > > https://github.com/l4m4re/bbb-pru > > The adc code is in the apps/adc directory. > > Perhaps this code is helpful for others, too. The PRU code configures the > ADC and the current setup samples AIN-1 and AIN-2 at 800 kS/sec. > > Regards, > > Arend Lammertink. > > -- > For more options, visit http://beagleboard.org/discuss > --- > You received this message because you are subscribed to a topic in the > Google Groups "BeagleBoard" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/beagleboard/l23H6oPyxcs/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > beagleboard+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/e343b354-1e28-4b32-bd94-ad20fdd91f1b%40googlegroups.com. > 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 beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAOYv6OOBXzHuF_2BhXuH9vhOUQYT0XEaZ0xE-CCcG0R35tJxsA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.