DUE with DueFlashStorage.h library

Hi every one

I am using an Arduino DUE board with "DueFlashStorage.h" library, to write and read from Flash Ram, I want to save my variables from address 128000 in the second block on 256K that arduino DUE has, I'm using DueFlashStorage.h, I don't Know how I have to write the adrress with the function dueFlashStorage.write, I use the decimal approach 133097, but I get the error "Flash start address must be on four byte boundary" or "Flash write address too high" when i use the instruction "dueFlashStorage.write(133097, Rac1);".

How I have to write the address? any example please.

Thanks in advance for your help¡¡¡¡

File>Examples>DueFlashStorage-master>DueFlashStorageExample

Thanks for your response ard_newbie

I saw those examples but i have problems with struc write always I get "Flash start address must be on four byte boundary" response when i tried to write a Struc, Don't Know why.

Thanks any way

Here a part of the code I am using:

struct Frasepin6 {
char pin[7];
};

byte b5[sizeof(Frasepin6)]; // create byte array to store the struct
Frasepin6 codigo1 = {"336915"};
memcpy(b5, &codigo1, sizeof(Frasepin6)); // copy the struct to the byte array
dueFlashStorage.write(102, b5, sizeof(Frasepin6)); // write byte array to flash

When I ran the program I get "Flash start address must be on four byte boundary" error.

Don't Know why.

Thanks

"Flash start address must be on four byte boundary" means the start address must be a multiple of 4.

1 Like

ard_newbie

Thanks a lot , it works¡¡¡ didn't Know that with Struc the addres has to be multiple of 4.

Thanks again it almost get my crazy.....