Getting bad data when receiving arducam image in python

Using this Arducam library. I have an arducam mini 2mp ov2640. When i run the Arducam_Mini_Video_Streaming example and use the accompanying host application, everything works. Still capture and video streaming. But I need the image inside a python program for processing. So, when I use my python program to receive the serial data (see picture), I get something that isn’t a jpeg. See the attached pdf for the data that I receive. In the Arducam_Mini_Video_Streaming sketch, the read_fifo_burst() function is only supposed to send data when the first two bits are 0xFF and 0xD8, and stop when it sees 0xFF and 0xD9. These are the start and end markers for a jpeg. But these bits never show up together in the data that I receive.

Can anyone tell me what I am doing wrong here?

bad jpeg.pdf (183 KB)


Can anyone tell me what I am doing wrong here?

If the "accompanying host application" receives the data correctly, and stores it as a usable file, then the Arduino is sending the data correctly. It is your python app that is the problem, and you'll note that this is not a python forum. Slither on over to a python forum for help with your unposted python code.