Serial decoder 4b5b
Hello Dear Community,
I want to capture and decode a bitstream on STM32F746. The bit rate is 60ns/bit. Data is encoded using 4b5b and has a unique code for start of frame and no end of frame.
What I have tried so far, is to configure TIM2 (APB1 timer clock is 108MHz) with a prescalar of 0 and counter 1. Then, each time the interrupt is fired I sample the input data: Briefly, I try to implement an oversampling mechanism. This approach seems not working. I tried to toggle a pin in the same interrupt and the maximum frequency I get is 146.7KHz. Maybe it is not possible to fire a timer interrupt higher than this frequency (NVIC latency...).
How can I acquire my serial data efficiently? What will be the correct approach to implement my solution? I have seen some input capture using Timer/DMA and I am considering theme. Maybe some GPIO-DMA access?
One constraint I have is that the data rate might change from application to an other. Ideally, I would extract the clock from data stream using a PLL, I would do it easily using FPGA but we want to implement it on STM32.
