BRT Community

General Category => Discussion - MCU => Topic started by: twittich on February 24, 2020, 07:41:00 AM

Title: FT90x Camera Overwrite read data test pattern
Post by: twittich on February 24, 2020, 07:41:00 AM
Hello
i'm using the ft90x, the bridgetek example "usbd example uvc webcam" and a camera modul. The camera works nearly fine, just sometimes some fragments in our setup, so i want to inject softwareside data. The idea is where the data is received from the camera i want to fill the bytes manually to make a test picture like colored lines for example.
I don't know where the data is received to overwrite it.
Any one any idea.
Thanks in advance.
twittich
Title: Re: FT90x Camera Overwrite read data test pattern
Post by: BRT Community on February 25, 2020, 04:30:56 PM
Hello,

The complete source code is provided allowing you to customise however you require. It can be found at the following location after installing the FT9xx Toolchain (https://brtchip.com/ft9xx-toolchain/):

C:\Users\Username\Documents\Bridgetek\FT9xx\2.5.0\Examples\USBD Example UVC Webcam

Best Regards,
BRT Community
Title: Re: FT90x Camera Overwrite read data test pattern
Post by: twittich on February 26, 2020, 09:23:21 AM
Hello
Thank you for the response.
I know this example and this is running and i'm testing with this. I want to try to inject test data between the input from the camera to the ft90x and the output to usb so that it looks like a testpattern from the camera.
I think i have to make the change in the function "  void cam_ISR(void) "  at  " :"r"(urb->ptr), "r"(&(CAM->CAM_REG3)), "r"(to_read)); "
How can i make red, blue, yellow, green etc bars? Are the values somewhere explained and how the lines are stored so that i can change it, the used format from the camera side is ycbcr422 / yuy2?


Thanks in advance.
Regards twittich
Title: Re: FT90x Camera Overwrite read data test pattern
Post by: BRT Community on February 28, 2020, 09:23:42 AM
Hello,

If it is an MJPEG compressed output from the camera then you would need to form a JPEG image.
You could make a JPEG test card image, store it in Flash or RAM, and send that into the stream.

If it is uncompressed output from the camera, then the format is a variant of uncompressed data stream called YUY2.
You just need to calculate the chrominance of each colour required at points on the display and send them as required.

Best Regards,
BRT Community
Title: Re: FT90x Camera Overwrite read data test pattern
Post by: twittich on March 16, 2020, 06:50:15 AM
Hello
yes the method for the uncompressed output i want to use but i dont know where to do that. I don't know how to calculate that and where to insert it... I think i was wrong to make changes in the cam_isr function but i don't know.
Thanks in advance for any hint.
Regards twittich
Title: Re: FT90x Camera Overwrite read data test pattern
Post by: BRT Community on March 18, 2020, 04:31:38 PM
Hello,

If the changes are in the cam_isr function then the dummy code will have to stream the required data at the same rate as that coming from the camera interface. This will mean that the dummy image will have to match the size and format of the camera output. The advantage of doing this is that the timing strobe from the camera interface will be present and ensure that data is sent at the exact correct rate as expected by the host. The disadvantage is that the data size and format must match the output of the camera exactly.

An alternative would be to make another function inject data into a buffer that the USB portion will read. This will have to be done by a timer to make sure that it is synchronised with the data rate and frame rate that the host expects. Not easy to do.

So, to summarise, the data rate (and hence the frame rate) and the data format need to match what the host expects. A USB analyser would be the absolute minimum required hardware to make this work. Even with that it might be difficult to make it match with software alone.

Best Regards,
BRT Community