Skip to main content
Associate II
November 26, 2023
Question

STM32: DCMI sends unreadable data to terminal

  • November 26, 2023
  • 5 replies
  • 6107 views

Hi Community!

I managed to communicate between the STM32-L4A6 (Nucleo-L4A6ZG) and the OV5640 camera module. I can read the camera's ID, set its modes, and even get image data. But there's a problem: the characters in the data I receive turn into unreadable data at some point (check the video link). Initially, everything looks good, but then it gets messy.

My goal is to send this data to the computer terminal using LUPART. If anyone knows why this is happening or how to fix it, I'd really appreciate the help.

Thank you in advance!

 

Video: https://www.icloud.com/attachment/?u=https%3A%2F%2Fcvws.icloud-content.com%2FB%2FAScrgf68YNAa28dSwi5pD24zZp8wAXrn1SOrfleYcqcKAARhtyqvfYqg%2F%24%7Bf%7D%3Fo%3DAlzB3DNKsDz4UGd-ztn9VnUKmrXMedOrxs9sE2RF_bqM%26v%3D1%26x%3D3%26a%3DCAogLVOIuo5oPnJCJqcbEdn0gv8T-MDYakDbkNWzz6WsFPsSeBDbl9XmvzEY26fQuskxIgEAKgkC6AMA_3u_U2BSBDNmnzBaBK99iqBqJsqK4PAziIKVBIf01tT0L7zBAgin1aFY_60Eq-cvpGw0ss0zVKAociZfEAxLWsLV1g3EMU8VzX_8eyhL9f0uwzR84CkFNnmhuYQ1tExWqw%26e%3D1703345918%26fl%3D%26r%3DFCCB1F55-046C-44E8-BADD-7D1FBB5D1F80-1%26k%3D%24%7Buk%7D%26ckc%3Dcom.apple.largeattachment%26ckz%3D821D61F7-A9BC-4A24-888B-249808BDA647%26p%3D152%26s%3DbBz8XnbT_6wPrgt2y1AcD-dZ_m4&uk=povOf8kAdHUPbekPPNvP8A&f=Screen%20Recording%202023-11-23%20at%2016.32.26.mov&sz=72839103

5 replies

KDJEM.1
ST Technical Moderator
November 27, 2023

Hi @nicola3 ,

I' m not able to download an to see the video. Could you please share a screenshot ?

I advise you to take a look to this discussion.

Thank you.

Kaouthar.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
nicola3Author
Associate II
November 27, 2023

Hi @KDJEM.1 

I'm sorry for the inconvenience. Attached i try it differently but also there are also photos for better understanding.

https://www.icloud.com/iclouddrive/0c9KNk1Qw5IJUURcZClG-pCyw#Screen_Recording_2023-11-23_at_16.32

Thank you very much for your help!


Best regards, 
Nicola

KDJEM.1
ST Technical Moderator
November 27, 2023

Hi @nicola3 ,

Please make sure that data are saved in DMA before starting send via LPUART.

Do you have any issue after converting data to the image? 

As mentioned in this discussion, if you're just sending data over terminal, you aren't going to show anything useful in the terminal. 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
nicola3Author
Associate II
November 29, 2023

Hi @KDJEM.1 

Thank you for your support. This is my first project with STM and I'm a little bit overwhelmed. 

I don't know how to converting this data into an image and how to save it to the DMA. Do you know how I should be able to do that?

Thank you in advance!

Best regards,

Nicola

KDJEM.1
ST Technical Moderator
November 29, 2023

Hello @nicola3 ,

Thank you for updating post.

This is my first project with STM and I'm a little bit overwhelmed. 

To start with DCMI, I recommend you to take a look to Introduction to digital camera interface (DCMI) for STM32 MCUs Application note. This application note gives to the STM32 users some basic concepts, with easy-to-understand explanations of the features, architecture, and configuration of the DCMI. It is supported by an extensive set of detailed examples (section 8 DCMI application examples).

I don't know how to converting this data into an image and how to save it to the DMA.

You can start from available examples and get inspired to create your own project for example:

To display your image on LCD, DCMI_CaptureMode example can help you. This application descripts how to use the DCMI to interface with a camera module to continuously capture RGB565 images, crop them from size 320x240 to 240x240 then display the video stream on the LCD.

To display capture data or video on your computer display, this example can help you: FP-AI-VISION1_V3.1.0\Projects\STM32H747I-DISCO\Applications\USB_Webcam in FP-AI-VISION1 package.

 I hope this help you!

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
nicola3Author
Associate II
November 30, 2023

Hi @KDJEM.1 

Thank you for your response! I'm trying to get the project "DCMI_CaptureMode" running but I cannot find the wiring diagram for the LCD display.

Do you know where I can find it?

Thank you very much and have a nice day!

Best regards, 

Nicola

KDJEM.1
ST Technical Moderator
December 11, 2023

Hi @nicola3 ,

Each JPEG stream is divided into packets, which have programmable size. The packets dispatching depends on the image content, and results in a variable blanking duration between two packets.
DCMI_HSYNC is used to signal the start/end of a packet. DCMI_VSYNC is used to signal the start/end of the
stream. For that, please make sure that DCMI_HSYNC and DCMI_VSYNC polarities are programmed according to the camera module configuration.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.