-
Notifications
You must be signed in to change notification settings - Fork 707
fix esp32s3 compile error when xclk set to -1 #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix esp32s3 compile error when xclk set to -1 #405
Conversation
Please add proper title and explanation on why this change is necessary. Does it have to do with camera with their own XCLK? |
The XCLK pin of the camera on my own hardware uses an active crystal oscillator, and is not controlled by the IO port. When I set it to -1, because the XCLK is not judged in the program, an error will be reported. |
OK, then same check should be added here so other chips behave the same :) |
Only ESP32S3 needs it, other chips have judgment |
I'm not sure I understand what you mean? Are you saying that the other chips will work fine with |
@Kevincoooool I am facing the same problem and would like to suggest adopting this pull request. @me-no-dev The ESP32 and ESP32S2 implementations generate clocks using LEDC by determining if xclk is positive. esp32-camera/driver/esp_camera.c Lines 154 to 157 in a6f13d9
The ESP32S3 implementation crashes at runtime because it accesses the array without checking if xclk is positive. esp32-camera/target/esp32s3/ll_cam.c Lines 321 to 326 in a6f13d9
Therefore, it makes sense to add the xclk value check only to the ESP32S3 implementation, as in this pull request. In other words, the current situation is that xclk = -1 causes a crash only on the ESP32S3. Please consider this matter. |
@lovyan03 Thank you for the explanation, I think it makes sense to add this check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kevincoooool Could you please address the minor formatting issue and rebase your PR on top of the latest master branch? Thank you.
gpio_matrix_out(config->pin_xclk, CAM_CLK_IDX, false, false); | ||
|
||
if(config->pin_xclk>=0) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting nitpick: the opening brace should be on the same line as the if
, and there should be a space between if
and (
.
Closing in favor of #438. @Kevincoooool by the way, it is not necessary to create a new branch or a PR when you want to update an existing PR. You can push the changes to the same branch and the PR will be updated automatically. It is also okay to force-push to feature or bugfix branches like this one, in case you do perform a rebase of your local branch. |
when i set xclk=-1,complie error