cancel
Showing results for 
Search instead for 
Did you mean: 

How to decode LVDS data

HL.2
Associate II

I've a camera using lvds protocol, now using LVDS to LVTTL converter connect to stm32f730r8t6.

I want to decode lvds data and fifo it to USB.

But first problem is could stm32 decode 20Mhz lvttl clock?

I've tried to use tim input captuer clock and using signal generator test it, stm32 only can follow 100kHZ.

Should I use 800mhz mcu to do it? Or only FPGA can do this job.

TIM config.

0693W00000D1ii6QAB.png

100khz result. (yellow is from stm32, blue is from signal generator)0693W00000D1iiuQAB.png100mhz result. (yellow is from stm32, blue is from signal generator)

0693W00000D1ijYQAR.png

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
	if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
		GPIOC->ODR = 16384;
	} else {
		GPIOC->ODR = 0;
	}
}
 
int main(void) {
	HAL_Init();
	SystemClock_Config();
	MX_GPIO_Init();
	MX_TIM1_Init();
 
	HAL_TIM_IC_Start_IT(&htim1, TIM_CHANNEL_1);
	HAL_TIM_IC_Start_IT(&htim1, TIM_CHANNEL_2);
	while (1) {
	}
}

4 REPLIES 4
MM..1
Chief II

Your 100kHz result isnt right. Too your callback capture IF isnt ideal.

And for capture serial dat ais better SPI...

KnarfB
Principal III

The freq. limiting factor in your code is the software, not the timer, especially when using HAL IRQ and the GPIOC access.

Anyway, I doubt that LVDS (camera link?) processing can be done in MCU software for any reasonable camera frame sizes and frame rates.

I would recommend looking into a LVDS deserializer chips interfacing to an STM32 MCU with a DCMI interface, or an FPGA solution.

thanks your reply, I'm looking for another solution.

How many bits involved?

Single bit with a clock, perhaps be an SPI slave.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..