-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Portenta camera fixes #122
Conversation
Memory usage change @ 2a05f69
Click for full report table
Click for full report CSV
|
* Fix default registers. * Set default registers on reset/boot.
* Fix broken DMA transfer. * Fix timer frequency (was running at 3MHz). * Fix cache issues. * Update API as requested. * Add skip_frames function.
* Use faster baudrate. * Upscale image to VGA for better viewing.
@iabdalkader: To test this do I just need to replace the I am fine with the sketches and using MIT Processes. |
Hi, yes, you need to replace camera.cpp, camera.h, himax.cpp and both the Arduino sketch and the Processing sketch. If the high baudrate doesn't work for you try 115200...Note I reverted some of the older registers and force pushed to the branch, so refresh to get the latest update. |
Memory usage change @ 13b1372
Click for full report table
Click for full report CSV
|
Thanks @iabdalkader I ran an impulse microcontroller detection program and got these results 93% microcontroller using a 48x48 crop. Your new code has made that happen. Thanks so much. |
libraries/Portenta_Camera/camera.cpp
Outdated
camera_frame_ready = 0; | ||
/* Wait until camera frame is ready : DCMI Frame event */ | ||
for (uint32_t start = millis(); camera_frame_ready == 0;) { | ||
__WFI(); |
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.
here we may want to add a wait for a signal rather than a flag and a WFI
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.
But it is a wait for interrupt, it should wake up on the first interrupt. Do you have something else in mind ?
libraries/Portenta_Camera/camera.h
Outdated
uint8_t* snapshot(); | ||
int start(uint32_t timeout); | ||
uint8_t* grab(void); | ||
int grab(uint8_t *buffer, uint32_t timeout=5000); |
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.
i'd propose to define a videoBuffer object, eventually in the ArduinoCoreAPI repo that could be used to do operations on top of the buffer and that would also allow to perform sanity checks on the passed buffer (for example that is big enough or in the right format).
the videoBuffer class could then be allocated either dynamically or statically and passed to the CameraClass API.
this could also allow the implementation of a V4L like implementation where the user pushes empty VideoBuffers in the CameraClass and pops full buffers when they are available. then the user, after using the frames would return the now empty buffers to the CameraClass
libraries/Portenta_Camera/examples/Envie_camera/Envie_camera.ino
Outdated
Show resolved
Hide resolved
* Fix pixclk polarity. * Update himax registers. * Support QVGA and QQVGA. * add set_framerate() * add standby() for low-power mode.
Memory usage change @ 780323e
Click for full report table
Click for full report CSV
|
@iabdalkader @pnndra @sebromero can you guys check to see if the Portenta Camera works using the M4 Core as well as the M7 Core. These feature would be very useful. My preliminary test says it doesn't but I am checking some more. Here is the inner M4 core error I am getting using the changes of about 5 days ago.
|
This driver isn't meant to be portable, it can be though. |
Memory usage change @ 43baef4
Click for full report table
Click for full report CSV
|
Thanks @iabdalkader , I merged it (was working perfectly), just changed a couple of APIs for motion detection to follow Arduino style guidelines. |
Note:When the sensor enters standby mode after a frame grab, the auto-exposure function does Not update or gets reset, for now I've added that skip_frames() function to run enough frames for auto-exposure to kick in... but I suggest running the sensor in "normal" mode and adding a function to enter low-power standby() when needed.