Skip to content

Feature Request: PortentaH7 Camera working using M4 #504

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

Closed
hpssjellis opened this issue Jun 20, 2022 · 2 comments
Closed

Feature Request: PortentaH7 Camera working using M4 #504

hpssjellis opened this issue Jun 20, 2022 · 2 comments

Comments

@hpssjellis
Copy link
Contributor

@facchinm (I wouldn't bug you if it wasn't important!)

Someone on the edgeImpulse.com forum is trying to get a machine learning vision model working on the M4 core. When I try even the simple Arduino camera raw bytes example I get the same results as a complex sketch:

C:\Arduino-1.8.19\portable\packages\arduino\hardware\mbed_portenta\3.1.1\libraries\Camera\src\camera.cpp: In function 'void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef*)':
C:\Arduino-1.8.19\portable\packages\arduino\hardware\mbed_portenta\3.1.1\libraries\Camera\src\camera.cpp:120:27: error: 'DCMI_TIM' was not declared in this scope
     if (htim->Instance == DCMI_TIM) {


Is this something that might have an easy fix or is it more complex than that?

@facchinm
Copy link
Member

Hi Jeremy,
this is due to this and this lines, that should read #if defined(PORTENTA_H7_M7) || defined(PORTENTA_H7_M4) to apply to M4 core too.
Let me know if changing it makes the camera work on the M4, because there may be other issues with memory zones and DMA. If it works, I'll be glad to merge the patch immadiately

@hpssjellis
Copy link
Contributor Author

hpssjellis commented Jun 21, 2022

Thanks @facchinm . I spent the whole day on it, summarized in the README.md file here

It works on both the PortentaH7 M7 and M4 cores when I comment out //SCB_InvalidateDCache_by_Addr(

my camera.cpp file is here

.

.

.

This is my old report:

Basically Camera::grabFrame( needs SCB_InvalidateDCache_by_Addr(, but I can't seem to get it included for the PortentaH7 M4 core, it runs fine on the M7 Core.

The file cachel1_armv7.h that has SCB_InvalidateDCache_by_Addr( is here

\cores\arduino\mbed\cmsis\CMSIS_5\CMSIS\TARGET_CORTEX_M\Include\cachel1_armv7.h

I am testing using the Arduino example CameraMotionDetect I am getting the same error even if I switch to SDRAM or the HEAP for the camera buffer, those examples are here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants