OV7670, Generic STM32F103RC and ILI9341 display

What are you developing?
zmemw16
Posts: 1678
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by zmemw16 » Wed Dec 27, 2017 2:01 pm

those are the options inside the sys/debug item as shown in cubemx.

trace async - i think provides some info allowing you to follow the program flow.
istr that there's a hardware mod around for the 10pin usb stick blocks allowing it's use.
it's also the first of the options to use PB3, that's messing you up.

what's your setup etc ?

just for fun, could you try that suggestion for an exit via an enabling call to enabledebugports ?
srp

Cesco
Posts: 26
Joined: Mon Apr 18, 2016 3:34 pm

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by Cesco » Wed Dec 27, 2017 8:07 pm

> what's your setup etc ?

Image

> an exit via an enabling call to enabledebugports

The disable works. The enable is not needed, i dont have a button and i stored away the stlink :)

zmemw16
Posts: 1678
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by zmemw16 » Wed Dec 27, 2017 11:50 pm

that wasn't quite what i meant when asking for your setup :lol:
more like os win/linux/mac, arduino version, which core and more of a similar ilk :!:
srp

Cesco
Posts: 26
Joined: Mon Apr 18, 2016 3:34 pm

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by Cesco » Thu Dec 28, 2017 2:11 pm

Nothing special, standard $3 bluepill, standard $3 ov7670, windows7, no display.

The stm32f103 has 20kb of sram, not enough for 160x120. I might have to use 80x64 or even lower to run a jpeg compressor on it. I did not find a arduino ide compilable jpeg compressor yet. The idea is to have the decompressor on win7 PC and display picture there.

I have the arduino uno version of this with serial comm to PC and a "processing" program to display the BMP picture. AVR code is different, no internal storage of picture due to 2kb sram.

In the future this should migrate to the esp32 and send live realtime compressed pictures in broadcast mode. This might then be used as FPV feed in an RC plane or quad. Video from plane to user, RC data from user to plane, bidirectional.

They do 10km here with hi gain antenna. Camera is the jpeg capable ov2640 (i dont have):
https://www.youtube.com/watch?v=yCLb2eItDyE

Cesco
Posts: 26
Joined: Mon Apr 18, 2016 3:34 pm

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by Cesco » Fri Jan 19, 2018 1:21 pm

I have tried to grab a frame, 80x160 pixel, and send it to the PC via serial. That is 128000 bit, should take 0.5 sec at 250kbaud, but it needs 20 sec.

Is the single byte "Serial.write(byte)" slow or what is happening?
Has anyone tested the OV2640 cam with build in jpeg compressor?

160x80 BW frame:
Image

EDIT:
I did try to write one whole whole line to serial and its much faster. "Serial.write(linebuf,linesize);"

stevestrong
Posts: 2059
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by stevestrong » Fri Jan 19, 2018 1:30 pm

In general, single writes are always slower than buffered writes.
Using

Code: Select all

Serial.write(buffer, nr_bytes);
should be more speed efficient.
However, the throughput also depends on the speed with which you grab the bytes to be transmitted.
Without seeing your code is hard to suggest more optimization.

Which serial do you use? USB or UART?

Cesco
Posts: 26
Joined: Mon Apr 18, 2016 3:34 pm

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by Cesco » Fri Jan 19, 2018 2:26 pm

I grab the pic into ram and then send it over usb. Resolution sucks because of 20kb ram, i use 120x80 BW, 12800 bytes for frame buffer.
I changed to write a whole line with one write and its much much faster now.

Any help with a jpeg compressor?

dispcam is the display program, processing source. Uses 255 as start frame, 254 start of line, 253 end of pic. pixel values are truncated 0 to 250. You have to click dispcam to start a frame grab.
Note i did change PCLK_PIN to PB8 instead of PB3
Attachments
STM32_OV7670.zip
(3.13 KiB) Downloaded 13 times
DispCam.zip
(957 Bytes) Downloaded 7 times

User avatar
RogerClark
Posts: 7683
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by RogerClark » Sat Jan 20, 2018 4:09 am

@cesco

If you have a display connected .e.g ILI9341 you can use it as frame store, albeit reading the data out not that fast

Post Reply