I am reading the sensor output as the sensor wave (0-5 volts) through the oscilloscope. Now I want to assess the frequency of a period with the beagle bone , so I should be measuring between two rising edges of time S. Although, I have to work with Beagle bone Have no experience with you Can you give some advice or sample code about measuring time between rising edges?
How do you need it to be deterministic? If you can tolerate some wrongdoing, then you can probably do it on the main Linux OS; If you want to be a fancy pants, then it looks like a possible use case for BBB's PRU (which I have not used so much unfortunately, so take enough salt in it). I hope you can write PRU code which just sits with an unlimited external loop and then start looping inside that loop until the pin is detected, then starting from appearing to pin show 1 (This is the first rising edge), the counting starts until the pin again shows 0 (it will be a falling edge) or any other loop for the next rising edge ... in any way, you Counters can be assumed And you should be able to change it directly in time (PRU) as a fixed frequency for each instruction, and 200 MHz (50ns / instruction) Believing your loop
#Pins start with Inner Loop 1 1: RegisterX = loadPin increment counter jump if Zero Register X internal loop 1 # pin now High Inner Loop 2: RegisterX = Loadpin increment counter jump if internal loop 2 for a register # PIN is now low
It should take 3 instructions per pay per instructions, so that you can get time as 3 * counter * 50 ns.
No comments:
Post a Comment