Using a hardware timer (eCAP?) to measure the width of a pulse from a Ultrasonic Range finder

I have a HC-SR04 Ultrasonic Ranging Module[1] I want to interface to the Bone. It outputs a pulse whose width is proportional to the distance to the object.

The AM335x TRM says the eCAP Module (Enhanced Capture) can measure the time of a pulse. Has anyone written an eCAP kernel driver? Are there other ways to access the eCAP hardware?

I’m running the 1-July-2014 Debian image.




I came across this today

Might be just what you need.

Thanks for the quick response. That’s a great lead.

I found I can get maybe 0.2 ms accuracy just using JavaScript. That translates to around 4cm, which isn’t back.

When I have the time I’ll see how much the PRU improves things.