OV7670, Generic STM32F103RC and ILI9341 display

What are you developing?
konczakp
Posts: 191
Joined: Thu Jul 14, 2016 4:17 pm

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by konczakp » Fri Nov 17, 2017 10:59 am

sure I can but I thought that You made some changes to Steve's lib and earlier You mentioned You will add this lib to the repo. But if not It's fine I will get it from Steve's github :)

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

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by RogerClark » Sat Nov 18, 2017 11:10 am

FYI.

I tried to get my camera and display working today, but found a load of wires broke off after I took it along to a Arduino club to show them some things you can do with an STM32.

So it took me a while to work out where all the wires went and to sold them all on again (about 6 wires broke off the display )

This is the code I'm using.
live_ov7670.zip
(23.94 KiB) Downloaded 49 times
I can't remember all the pinout, but its likely to be the same as Steve uses except for the LCD

If you cant figure out the pinout, let me know as I have a KiCad doc somewhere in which I have the pins, as I intended to get a PCB made, but never had time to finish the design

gungsukma
Posts: 6
Joined: Thu Jan 12, 2017 5:44 am

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by gungsukma » Tue Dec 26, 2017 10:21 am

I tried the stevestrong's STM32_OV7670.7z from Page 1
but it is not working with my blue pill (STM32F103C8T6) and OV7670 non-FIFO.

I can upload the sketch and run it but the Serial Monitor always stop on "Configuring camera..."
It is on Cam_Init() on pid = rdReg(REG_PID);

Here is the Pin connections:
OV7670 STM32F103C8T6
1. Vcc 3.3V
2. GND GND
3. SCL PB6
4. SDA PB7
5. Vsync PB4 (in)
6. Href PB5 (in)
7. Pclk PB3 (in)
8. Xclk PB0 (out)
9. D7..D0 PA7..PA0 (in)
10. Reset Not connected
11. Pwdn Not connected
May be the Reset and Pwdn pins should be connected somewhere or the SCL and SDA need external pull up
or the code is expired (it is from 2015) or my module is broken.
Please help.

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

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by stevestrong » Tue Dec 26, 2017 10:45 am

SCL and SDA need external pull up.

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

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by zmemw16 » Tue Dec 26, 2017 11:57 am

3k3 to 3.3v
4.7k/5.1k to 5v
rumour has it that 10k or below will work
srp

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

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by Cesco » Tue Dec 26, 2017 5:55 pm

My grabber is working with stevestrong code from page1, but only if i change pixel clock input from PB3 to PB8.
Is my bluepill PB3 broken or is there a problem with PB3 ?

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

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by zmemw16 » Tue Dec 26, 2017 7:33 pm

you've pins being used for debug and / or st-link programming
so you need to add

Code: Select all

disableDebugPorts();
whether or not this means single pass programming with st-link is unknown, might need a hard reset or even cycle the power :x
srp

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

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by Cesco » Tue Dec 26, 2017 8:00 pm

Ty.

Unluckily disableDebugPorts(); does lock out further stlink uploads unless i reset the bluepill every time.

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

Re: OV7670, Generic STM32F103RC and ILI9341 display

Post by zmemw16 » Tue Dec 26, 2017 8:34 pm

been playing with cubemx with 103c8
2 wire as it says pa13/pa14
3 wire 'trace async' adds pb3
4 wire adds pa15 to above
5 wire adds pb4 to above

i don't suppose you've enabled trace async mode as it clobbers pb3 ?

are you using a 20way cable st-link as opposed to a usb stick one(sdclk/sdio/gnd)

might be worth a try - if you add a 'quit' button capture inside of the loop function and something akin to

Code: Select all

if (buttonpress == true){
  EnableDebugPorts();
  while(1) {}
}
then press reset ?

stephen

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 12:06 pm

> trace async

No idea what that is. Yes, im using an usb-stick, 4 wires including power.

Pressing reset while starting stlink upload works with debugport disabled.

I did simply leave pixclock on PB8 instead of PB3. 2 lines of code change.
Then i finally got the maple bootloader working and now i use it instead of stlink.

I also changed the code so it doesent block waiting for pixclock or href. A little slower than the blocking "while" but safer.

Code: Select all

while( VSYNC ); //wait for low
line = 0;  
noInterrupts();
while (!VSYNC)	// as long as high
{
    if(HREF)
    {
      if (was_href_lo) 
      {
        was_href_lo = false; // linesync
        pck = 0;
        line++;
      }
      if (PCLK)
      {
        if (was_pix_lo) 
        {        
          was_pix_lo = false;
          if ( pck&0x01 && line<BUF_SIZE_X ) buf[line][pck>>1] = CAM_DATA;
          pck++;
        }
      }
      else was_pix_lo = true;     
    }
    else was_href_lo = true;
}
interrupts();
 
Serial.println("> image acquisition done."); 
Should be stated somewhere, "if you use stlink this doesent work".

Searching for a jpeg compressor now .... was not able to compile one yet. I will have to go low res and BW because of sram limits.

Post Reply