-
-
Notifications
You must be signed in to change notification settings - Fork 212
SDRAM Examples #38
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
Comments
@rdockterjr you are right, a tutorial on external ram usage is coming. |
@sbhklr |
@facchinm Thanks for the feedback. Just to clarify the preferred usage method would be as follows: |
Using the wrapped |
I'm closing this as no further reply by @rdockterjr came in. Please reopen and continue the discussion if necessary. |
Can we open this up again? What would be incredibly useful would be an example assigning the Camera 320x320 Grayscale frame buffer to SDRAM for the Portenta Vision Shield. Here is a link to the present Portenta raw data example By the way a grayscale OLED is the only way to mess around with the Portenta Vision Shield (I use the WaveShare 1.5 inch Grayscale 128x128 using the library Adafruit_SSD1327.h) I would submit a PR for you if the SDRAM 320x320 camera example worked. I have a base example here for using the grayscale OLED with the Portenta camera, it just needs the SDRAM coding. |
Surprisingly this works here with camera at 320x320 and the OLED is very fast showing the screen, using SDRAM for the camera frame buffer. but I feel it will eventually have memory leaks. Can someone make a suggestion as to how to make it a bit more robust. Specifically how to align it 16 or 32 bit whatever makes more sense. When I use the below method with a machine learning program it randomly crashes. I think align 32 is the best bet but don't know how to do that. The follwoing is probably the main line of code
|
Extra question for working with Tensorflowlite.
|
Ok, with some help from the people at EdgeImpulse.com I got the alignment working for the camera here The key parts are
then in setup
and this method works without errors with a machine learning model. Still curious about the above tensorflwolite question. |
I put a question on stackoverflow here basically about assigning data directly to an SDRAM block of memory, instead of making a normal array and then assigning the pointer to the array. Here is working code for the Arduino Portenta. Any suggestions?
|
I don't have Portenta but I guess storing TFLite model into flash (const array) and load into SDRAM memory at runtime should work.
|
Hi @hpssjellis! I'm not familiar with the sdram class used by mbed, but would a memcpy() (equivalent to the 'clumsy' approach above, but with a single function call) work? Something like:
|
Thanks for replying @petewarden, and I was wondering how to use memcpy, but that solution still has the data first being entered into a regular array. With all the regular array size limits on the portenta < about 1 MB. I need to enter the data directly into the block of memory allocated by the much larger, up to 8MB SDRAM pointer without first putting the data into an array. I could load the data after compilation from the SD Card but that adds complexity. Here is my latest working code, almost complete.
Which prints out
|
@petewarden you might have a solution here. It looks like memcpy can take a string of binary data. So I will look into that. Thanks.
|
Thanks @petewarden That works great. Should not be hard to reformat the TensorflowLite model header file array to the needed format. From:
To:
I think we can re-close this issue. Here is my final test code:
|
@facchinm Quick question: By having M7 set SDRAM then using RPC to send that pointer to M4 we have got SDRAM (or regular memory) working from both cores!!! Problem for some weird reason I have to re-set the M4 SDRAM pointer each loop from M7 instead of just once in setup. That doesn't make much sense to me but is the only way I can get it to work. Why when using this method would M4 SDRAM lose the pointer location. ??? I will try some other methods today.
|
If anyone is interested this code works with SDRAM and the new Camera settings for the Portenta with Vision shield and for this example the Waveshare 128x128 Grayscale OLED
|
I've noticed the Portenta_SDRAM library: https://github.com/arduino/ArduinoCore-mbed/tree/master/libraries/Portenta_SDRAM
But it does not have an examples folder. It would be very helpful if someone could post a basic read/write example for interacting with the external SDRAM.
The text was updated successfully, but these errors were encountered: