I ordered the components and they should be here early next week.
I'm expecting an ATTiny817 dev board tomorrow, so I can start messing around with the CCL and the encoders. I am currently not seeing a way to get the signal I want (rising edges on every transition) without at least one extra component. I think I might be able to make it work with a single off-board gated D flip-flop (DFF) and both LUTs configured as XORs based on this dual edge detector circuit from Cypress (at the bottom). LUT0 would XOR the two phases together, generating a single signal with an edge for each transition, and pass it out an I/O pin to the offboard DFF. The output of that would pass back to LUT1 through an I/O pin, where it would be XORed with the output of LUT0, generating a rising edge on every transition, perfect for feeding to one of the internal timer/counters.
That feels like admitting defeat. Also, I'd have to do a third board spin (!!) before I assembled the first one, which is not really the way I want to roll.
So... I think I'm going to do this the dumb way. I'll set TCB as the timer for my main loop and set up TCA to track the cycles since the start. I can then make both of the phase inputs interrupts, and use the current value of TCA to track how long its been since the last transition. We'll see how well this works in practice.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.