adafruit / adafruit/Adafruit-VC0706-Serial-Camera-Library

Begin response confuses getVersion

Open
#32 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
139
Forks
108
PR merge metrics
No merged PRs in 30d

Description

This issue started when I noticed an intermittent failure of the camera getVersion() command. Adding some debug I found the verifyResponse was failing. In my case it was reading the string ‘Init end’ instead of the expected command response. The problem turned out to be the reset in begin() which triggers the camera to respond with:

```
VC0703 1.00
Ctrl infr exist
User-defined sensor
525
Init end
```

For anyone that is seeing a similar problem, as a work-around, I have found that running CamSerial.find("Init end") or just a 1 second delay after calling begin() will allow that output to be flushed out.

While exploring this issue I also realized that the getVersion() command only appeared to be working for me because it was returning the output of the begin() call before it. The problem was, as **NickWaterton** (https://github.com/NickWaterton) pointed out in his ticket #https://github.com/adafruit/Adafruit-VC0706-Serial-Camera-Library/issues/12, the arg value for GEN_VERSION command should be 0x00 not 0x01. Also, the returned string needs to skip over the standard response header in order to return the version string.

Rather than use the work-around above, I have added the code to consume the "basic configuration information" to the reset() function itself. I have created a pull request to make these changes here: #https://github.com/adafruit/Adafruit-VC0706-Serial-Camera-Library/pull/31

This is what my test code looks like:
```
CamSerial.begin(38400, SERIAL_8N1, CAM1_RX, CAM1_TX, false, 20000UL);
delay(500);

if (Cam.begin()) {
Serial.println("Camera Found");
} else {
Serial.println("No camera found?");
HACF();
return false;
}

char *reply = Cam.getVersion();
if (reply == 0) {
Serial.print("Failed to get version");
} else {
Serial.printf("Version: %s\n", reply);
}

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with begin(), reset(), getVersion(), and verifyResponse(), then review the linked pull request #31 and the provided camera test sequence. Reproduce the startup output and version request behavior; done means the initialization response is handled and getVersion() returns the camera version rather than stale startup data.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.