Go Down

Topic: Flash memory issue (Read 238 times) previous topic - next topic

Sarat_1984

Hello friends,

I am using Arduino due and Etherenet shield for my project.To store the network settings I am using flash memory of Due using DueFlashStorage library. After three times upload of my sketch the board became unusable.I am getting error saying "flash page locked". Can someone suggest me How I can resolve the issue.

Thanks in advance,
Sarat

ard_newbie

#1
Apr 16, 2019, 07:30 am Last Edit: Apr 16, 2019, 07:32 am by ard_newbie
Sadly it's a known issue with this library ( maybe a problem occured if an interrupt fired at the same time you were storing values in Flash).

You can try one of these workarounds (hopfully one of them should work  :)

1/ Find the platform.txt file in  …/hardware / Sam / 1.6.x

You can find this folder from an IDE window: select

Select File>Preferences. At the bottom of the open window, click in the URL
C:\Users\...\AppData....

Use a new blank IDE window as an editor(no setup(), no loop()), copy platform.txt.

Find the line (towards the end):

tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -e -w -v -b "{build.path}/{build.project_name}.bin" -R

Add -u for unlock all regions:

tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -e -u -w -v -b "{build.path}/{build.project_name}.bin" -R

Copy and save the new platform.txt.


This means bossac will unlock all the lock bits. Restart Arduino IDE


2/If you have a PC, type the "cmd" command in the Start window. Then write the following line after C:\Users\....>

AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino\bossac -U true -e -w -u -b  -R image.bin

Note 1: -U true is for an automatic scanning of an available COM port (will work either for a programming port or a Native USB port).

Note 2: image.bin is the binary file you want to upload. To find this .bin file, before compiling a sketch, select  sketch>Export Compiled Binary. Now in image folder you have image.ino AND image.bin. Of course you'll have to adapt the name and the right path to the .bin file in the line above.

Note 3: Before uploading with this method, push the Erase button for 3 seconds, then the Reset button for 3 seconds.

Note 4: If you receive an Auto scan failed message in return, unpug/plug the USB cable.


Go Up