-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS3633-CM1 sensor support, HW dual edge capture, 48MHz timing resolution, and more #10
Conversation
add ts3633-cm1 explanation/image to readme.md
This is great. Took a glance and all seems reasonable. Will check it on my hardware when I come back home from vacation and will do a more through code review, likely on the weekend. Meanwhile, why did you decide to write your own PulseClassifier? I already have some code in data_decoder.cpp that extracts the whole data frame (it's not that useful, though). |
Thanks! As a practical matter, the separate PulseClassifier stub is not needed in this PR. @keir and I are both working in the same repository, and his PulseClassifier and RingBuffer commits are interleaved with mine. However, I'm not good enough at Git to know how to cherry pick and remove specific changes (e.g. ba36d4a, 977ad5e, a5f5d19). Your existing pulse processor, data decoder, and position solver code will work with this PR. The stubs are in place so that in the future the actual hardware implementation (whether CMP0/FTM1 today or FTM0 and auto-DMA memory transfers in the future) can be abstracted away from the downstream Lighthouse pulse processing code. This allows us to playback arbitrary pulse sequences into the PulseClassifier without needing the Teensy hardware and can be independent of the specific HW implementation. |
In recent commit 631de22 I added support for the FTM timer input source with an adjustable time resolution and polarity, getting to feature parity with this diff. While I won't be merging this code as the source tree is completely different now, I want to thank you @almostsquare for this diff because it pushed me to do a complete rewrite this project, hopefully making it better. |
I'm getting an error while I build using
Can you please help ? @almostsquare @ashtuchkin Thanks |
This is a large pull request that is a rewrite of the existing CMP0 pulse width capture routine with a new FTM1 hardware managed dual-edge capture routine. The code is structured to run both concurrently, so you can test the validity of the code side-by-side. The new timer capture routines call the same pulse_process() with some downscaling of resolution to fit the old us timebase.
This is my first pull request, so please let me know any feedback you have on how best to structure this to integrate with the existing codebase. Thank you!
Changes
Hardware wiring
Wire sensor envelope signal to (existing) pin 12 and (new) pin 3 on Teensy 3.2 to allow side-by-side testing of old and new code.
Sensor selection
To use with your existing homebrew sensor, set sensor0_active_high to true in setup.cpp. To use with the TS3633-CM1 sensor, set sensor0_active_high to false in setup.cpp.
Dynamic selection
To toggle between the existing CMP0 interrupt routine and the new FTM1 dual-edge timer capture routine, send "h" over the serial port. You can check whether the pulse width measurement is done with the FTM1 dual-edge timer hardware by sending "a" over the serial port. The ISR count will be appended with a "*" if using the FTM1 timer hardware.