I narrowed the search and changed the loop :
int chunks = 32760;
for (int i = 0; i < 30; ++i) {
chunks += 1;
Serial.printf("chunks = %d\n", chunks);
readthefile(chunks, last);
}
This shows that the problem happens with blocks of...
Sorry, there was a mistake in the function. Here is the correct one :
void readthefile(int chunks, float last) {
chrono = 0;
File file2 = myfs.open("onnx__Conv_110.h", FILE_READ);
if (file2) {
// file2.readBytes((char*)data, N * 4)...
And here is a code with the loop over the number of bytes read in the file. It should crash inside the loop...
/*
Test LittleFS write, read
*/
#include <LittleFS.h>
LittleFS_QPINAND myfs; // QSPI NAND Flash attached to SPI
#include...
Hi, sorry for my late reply.
Here is a code that read the file parts by parts.
/*
Test LittleFS write, read
*/
#include <LittleFS.h>
LittleFS_QPINAND myfs; // QSPI NAND Flash attached to SPI
#include "onnx__Conv_110.h"
const int total =...
Thanks for your answers, but we don't know if it's a bug or just a problem related to PSRAM or Flash chips.
I understand that it's not easy to reproduce, because it requires a Teensy with additional PSRAM and Flash. So could anyone try to...
That's what I did in message number 45, but it seems to freeze for large values of N (or arrayLen).
Please read message 45 as it seems you answer to message 42...
Yes, sorry for the confusion, this is just a test code, I'm learning to use the external Flash.
Thanks a lot, this is exactly what I was looking for! I wouldn't have thought about this alone...
However, it seems not robust. It works for low...
Here is what I did to read the file:
if (file2) {
Serial.println(1); // to trace execution
char *databytes = (char*) extmem_malloc(4 * N);
Serial.println(2);
file2.readBytes(databytes, 4 * N); // freeze if N = total (921600)...
Thanks, I did this in post 26.
Oh, you mean that the PSRAM and the additional Flash use the same SPI bus?
If the free PSRAM memory is larger than twice the size of the float array, then I can dynamically assign a temporary buffer and use it to...
file2.readBytes( data, total*4 );
That's what I tried in the first place, but readBytes requires a byte array and data is a float array.
So I'd need a very large bytes buffer array (size 4*total bytes) to store the content of the file, and then...
Thanks a lot, that's what I was looking for.
I changed the code and it's much simpler and faster.
/*
Test LittleFS write, read
*/
#include <LittleFS.h>
LittleFS_QPINAND myfs; // QSPI NAND Flash attached to SPI
#include "onnx__Conv_110.h"...
Sorry, I don't understand what you mean.
If I understand well, the dataFile.println writes the values as ASCII code using (in my case) 8 digits after the dot.
When I read the data again from the file, it seems also to read it as ASCII...
First: I changed to EXTMEM and it works perfectly, reading 300 000 float data in 1760 ms, and more than 5 seconds for the whole 900 000 data array.
What I want to do: port a neural network (NN) onto the Teensy. The network can be quite large and...
Oups, I mixed EXTMEM and DMAMEM !!!! My fault.
Yes, I'm just testing, but obviously in the end I'll load the entire array.
This array is generated by another program and is in the form of an .h file that I can #include.
But I can also transform...
Thanks to all your explanation, I finally understood how all this works!
Now I have a code that compiles and can create a file to store a large array, and read it afterwards.
/*
Test LittleFS write, read
*/
#include <LittleFS.h>...
It seems that the problem comes from
dataFile.close();
when writing the file. This instruction alone takes almost 7 seconds.
I don't think I ever wrote 256 MB in the Flash memory, to saturate it somehow. But it's as if the multiple tests I did...
Now I have a new problem, I really don't understand what is going on...
Here is the code:
/*
Test LittleFS write, read
*/
#include <LittleFS.h>
LittleFS_QPINAND myfs; //Specifies to use an QSPI NAND Flash attached to SPI
#include...
I tried the code, and it works. I have changed it a bit:
/*
Test LittleFS write, read
*/
#include <LittleFS.h>
LittleFS_QPINAND myfs; //Specifies to use an QSPI NAND Flash attached to SPI
// const int chipSelect = 4;
#include...
Thanks to both of you for your answers.
@mjs513 : I'll try this when I'm back at work.
However, it seems to me that reading a float number as an list of ascii values then transforming it to float (if I understand well atof) is a waste of time...
Hi
I am now trying to use the LittleFS library, to copy very large arrays to the NAND Flash memory.
My understanding is that I create a "file" in the NAND Flash and write the array in it. I wrote a small test code but I can't read the float...
Sorry, I don't understand. Does it mean I have 8 or 16MB PSRAM?
This piece of code:
// Check for PSRAM chip(s) installed
uint8_t size = external_psram_size;
Serial.printf("PSRAM Memory Size = %d Mbyte\n", size);
prints 8 MB.
Yes, but I bought it at Protosupplies:
https://protosupplies.com/product/teensy-4-1-fully-loaded-for-prototyping-system/
Edit:
After double thinking about what you said, I went back to the prosupplies site and read this...
I did my best to reduce the size and complexity of the code while keeping the error. You can find a smaller program here.
Please tell me if you can donwload it and if it gives the same error I get...
Actually, input and output cannot be const as they are changed during the execution.
I changed my code like this:
// Memory block
#include "..\include\parameters\onnx__Conv_95.h"
#include "..\include\parameters\onnx__Conv_98.h"
#include...
Thanks Paul.
Should I do the same for EXTMEM and DMAMEM?
EXTMEM const float input[131072];
DMAMEM const float input2[32768];
EXTMEM const float output[131072];
DMAMEM const float weightsRAM2[73728];
EXTMEM const float weightsPSRAM[921600]...
Hi
I have a Teensy 4.1 with 8MB PSRAM and 256 MB Flash.
I have a large code that uses large arrays declared in .h files. I try to manage the storage between RAM1 & 2, PSRAM and Flash, depending on their size.
For example, the file...
Thanks for the answer.
Using these functions enables a great speed gain, so it would be worth the effort of using the latest versions. How can I do this?
Just a remark.
I see on the CMSIS link provided above that the arm_dot_prod_f32 is defined with const arguments:
void arm_dot_prod_f32 (const float32_t *pSrcA, const float32_t *pSrcB, uint32_t blockSize, float32_t *result)
When I use it and...
Thanks for your answers. I understand now better how to use the header files and optimize the memory usage.
Here what I do : all remarks and suggestions are welcome. My objective is to save as much memoray as I can and increase speed also...
So the code snippet proposed in post 10 is correct?
Sometimes, at compilation, I get an error such as: "DMAMEM is not known" or "EXTMEM is not known". Do I need to #include something before using DMAMEM or EXTMEM ?
Actually, this is my first time using DMAMEM and EXTMEM on a Teensy 4.1
I have large arrays whose values are defined in .h files, for example:
static float weights[1234] = { 1.0, 2.0, ...
...
...
};
To put this array into RAM2, I understand that...
Hi, sorry to dig this message from the past, but is this still true, or did you find a solution?
My question is: can we initialize arrays defined as DMAMEM and EXTMEM?