I'm working with a K82 MCU and a magnetic encoder attached to a motor. The encoder has 512 counts per rotation; with my targeted motor speed, the encoder output should be around 10KHz. I've configured FTM2 as a quad decoder. The clock is 60MHz and has a prescaler of 16. I am not using semi-hosting for debugging.
The quad decoder is not working properly - it might be losing counts, but that's hard to say because the bigger issue is that the direction is unreliable. When hand turning the motor, if I pause for a moment, then resume turning, there is a high probability that the direction will flip. I've been at this for a while; changing clock frequencies, adding filters, etc. to no avail. Scope captures of the encoder show a very clean signal. What could be causing this?
Solved! Go to Solution.
It turns out that the problem was an assembly defect - one of the MCU pins was not soldered down to its pad. Firmware debugging is always an adventure.
Thanks for the reply. I'll have to dig up a freedom board and investigate. I'm currently working with custom hardware that has the encoder routed to PTB18 and PTB19, so FTM2 is all I have at my immediate disposal.
It turns out that the problem was an assembly defect - one of the MCU pins was not soldered down to its pad. Firmware debugging is always an adventure.
Hi,
Thank you so much for your interest in our products and for using our community.
The frdmk82f_ftm_quad_decoder_peripheral SDK example use the FTM1, Does the same thing happen to you with the latter?
Have a nice day!