Skip to content

_OV7670_init registers confusion #21

Open
@Chris-F5

Description

@Chris-F5

This issue is regarding _OV7670_init, an extract from which follows:

...
        _OV7670_REG_COM8,
        _OV7670_COM8_FASTAEC | _OV7670_COM8_AECSTEP | _OV7670_COM8_BANDING,
        _OV7670_REG_GAIN,
        0x00,
        _OV7670_COM2_SSLEEP, # <--- =0x10. This should be a register.
        0x00,
        _OV7670_REG_COM4,
        0x00,
        _OV7670_REG_COM9,
        0x20,  # Max AGC value
        _OV7670_REG_BD50MAX,
...

See how _OV7670_COM2_SSLEEP appears in an even (register) slot. This causes 0x00 to be written to register 0x10 (since _OV7670_COM2_SSLEEP=0x10). 0x10 corresponds to the _OV7670_REG_AECH exposure register with default value 0x40. I'm not sure what the intended behaviour is. I tried removing these two lines and noticed no visual difference in the output image. So its not an urgent problem, just a confusing piece of code that might cause subtle problems.

Also, at some other points in the init sequence it writes to reserved registers like 0x29 and 0x35:

...
        0x29,
        0x07,  # Reserved register?
        _OV7670_REG_CHLF,
        0x0B,
        0x35,
        0x0B,  # Reserved register?
        _OV7670_REG_ADC,
        0x1D,
...

I don't understand why. Perhaps the code should explain in a comment unless I am missing something obvious?

It almost looks like this entire init sequence was copied from some documentation or code elsewhere. Hence the questionmarks. If this is the case then perhaps a comment could link to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions