I wrote about my working HID interface in the previous post. Now I can send data to my laptop in a convenient way in a simple HID report because I wrote a Delphi program to send and receive HID reports years ago.
Next step is to wire the Tascam TT-M1 scratch control unit to the board. As STM32F4 series have quadrature encoder interface in some timers, I can easily count the pulses without any line of code in my main loop or without using more interrupts or processor load.
In this STM32F407 family, TIM2 to TIM5 can be used as encoder interface. In my board, I only have TIM3 to use, because the pins of TIM2 are used by other chips or functions.
For encoder interface, CH1 and CH2 must be used. These are on PC5 and PB5 pins. So I wired a PS2 female socket to these pins as well as the 5V and GND.
I set up the TIM3 and the GPIO pins to be alternate function pins with push-pull, counting only on rising edge of the CH1 signal, and 0 for filter values, for my first tests. I am sending the timer CNT value to my laptop with the user button push.
With this setup, the counter counts more than 4100 tick per revolution. Of course it depends on where I put the rubber wheels of the Tascam unit. It counts up and down, and it seems to be quite accurate. I experienced some drift while scatching, but does not seems to be relevant at that phase.
Now I have a Tascam – HID converter. I can send the angular position of the vinyl to my laptop through the HID interface. Next step will be to make some useful MIDI information from the TIM3 counter value.