Thanks for feedback! And sorry for my mistake: replace AdcUdt::DRam[1] by PruIo::DRam[1]!
It's not that easy. The call to PruIo::mm_start() waits for the end of the measurement. You have to cover that call in one thread and use another thread to monitor PruIo::DRam[1] for your timestamp. Find example code in triggers.bas <http://users.freebasic-portal.de/tjf/Projekte/libpruio/doc/html/ChaExamples.html#sSecExaTriggers> (sorry, FreeBASIC only). Regards Am Montag, 17. September 2018 22:42:16 UTC+2 schrieb Thomas Remmert: > > TJF, > This is absolutely AWESOME! What a great library! I am just now reading > through the documentation and reviewing your recommendations but have a > question.. I plan on utilizing a GPIO pin and setting up MM mode and > monitoring AdcUdt::DRam[1]. How do you recommend I monitor > AdcUdt::DRam[1]? Just setup a loop in python or do you recommend another > method? Basically I need to put a timestamp at the leading edge of the > input. > > Thanks! > > > On Saturday, September 1, 2018 at 12:00:35 PM UTC-5, TJF wrote: >> >> Hi! >> >> Am Freitag, 31. August 2018 17:44:22 UTC+2 schrieb >> trem...@lonestartracking.com: >>> >>> Hello, >>> I am interested in using the BBB to monitor a sensor (geophone) at about >>> 200-400sps. I am currently using the Adafruit_BBIO.ADC library to do this >>> in Python. Ultimately, there are two goals for this project, and I would >>> love some input on how to approach this. >>> >>> 1) Time stamp when the input voltage reaches 0.5v - The geohone is >>> generating a sine wave, the stronger the vibration/movement of the >>> geophone, the higher the amplitude/voltage of the signal is produced. I >>> would hope to accurately place a timestamp at the exact moment the voltage >>> crossed that threshold. As far as timing goes, I am using onboard GPS with >>> 1 PPS output and Chrony for sync. >>> >> >> libpruio <http://github.com/dtjf/libpruio> is designed for such tasks. >> Use it in MM mode (MeasureMent mode). Up to four triggers can be set to >> specify the sampling start. Even pre-triggers are possible. See >> http://users.freebasic-portal.de/tjf/Projekte/libpruio/doc/html/_cha_features.html#SubSecTriggers >> >> for details. >> >> When measurement starts, the value of AdcUdt::DRam[1] drops down to 0 >> (zero). So by monitoring that value you can generate a timestamp with >> Python accuracy. If this isn't accurate enough, you could use the other PRU >> just for the timestamp. >> >> Next version 0.6 will ship with Python bindings and example sources. >> >> >>> 2) I also have a contact closure that I would like to monitor. Right >>> now, I am pushing 1v through the closure, and monitoring the ADC for a >>> voltage change from 0v to 1v, then applying a timestamp. Any thoughts here? >>> >> >> Since version 0.4 libpruio can handle GPIO input in MM mode. Ie configure >> a pulled-up GPIO-input and groud the pin by your closure. (You can also >> continue with ADC input, but in MM mode the data evaluation has to be done >> after the measurement.) >> >> Regards >> >> >>> I have read about the PRU on the BBB and am wondering if that is what I >>> need to be using to obtain sub millisecond accuracy on my timestamp. Any >>> thoughts here? >>> >>> Thanks! >>> >> -- 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/32d2e7fd-d265-4c13-8262-3142a3fdaf90%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.