Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:57 22 Dec 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Help me to corrupt the Raspberry Pi Pico2 flash with MMBASIC

Author Message
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 734
Posted: 11:12am 21 Dec 2025
Copy link to clipboard 
Print this post

Hello,

I would like to find out how many write cycles the Raspberry Pi Pico 2 can tolerate before it becomes faulty (I know it should be around 100.000).


My first question is:

- Does MMBASIC have some kind of "flash wear leveling"? (even if so, it would become even more interesting!)

Is it possible to achieve this using the "CHAIN" command by constantly switching between two different programs? In doing so, I would simply increment a variable. However, I'm wondering how I could reliably determine that a sector has become corrupted over time, since I am only reading / incremeting one variable.

Maybe I should use more variables to hold data. But I am sure there are even better ways, so this is why I am
asking. Please let me hear your suggestions for a good test set-up!

As far as I know, the Raspberry Pi Pico's onboard flash memory is typically rated for around 100,000 write/erase
cycles per sector.

One day has 86400 seconds, CHAIN process consumes also time which depends on the program size, so let's say one
CHAIN cycles takes 10 seconds (with back CHAIN) we could achieve 8640 write cycles a day. The Raspberry Pi Pico should
at least work for around 11 days without errors, right?

Why I am curious: I have more and more programs which make use of CHAIN loading from sdcard (because of program size) and I wanted to know at what point it becomes crititcal.

Greetings
Daniel
Edited 2025-12-21 21:15 by Amnesie
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 352
Posted: 11:26am 21 Dec 2025
Copy link to clipboard 
Print this post

Why not use var save ? Doesn't take 10 seconds and also uses flash ...

You could save, say, 1000 times and read back the 1001 value to see if it still matches... or so. But if you have bad luck the flash gives you 1000000 cycles. If the cycle count is also saved, you could make it reboot stable and thus cover power failures which will come in the future...
                                                                 
73 de OE1HGA, Gerald
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1706
Posted: 11:30am 21 Dec 2025
Copy link to clipboard 
Print this post

Hi Daniel,
this reminds me of my test with a EEPROM 11 years ago.

Interesting question.
Kind regards
Michael
causality ≠ correlation ≠ coincidence
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 734
Posted: 12:16pm 21 Dec 2025
Copy link to clipboard 
Print this post

@ Gerald

thanks for the input - I will take a look into the manual!

@ Michael

Ha, that's interesting! Seems EEPROM hold up longer than Atmel stated in the datasheet. That's good.

Yeah, hard facts are better than just rely on the datasheet.

Greetings
Daniel
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 352
Posted: 02:12pm 21 Dec 2025
Copy link to clipboard 
Print this post

but what do you gain? A dead pico maybe, but no gain in knowledge IMHO. The sample size of 1 is a bit small to give some reliable answer to how many writes the pico flash can take. It's just an individual result you will never be able to reproduce again ... but well, mankind has done worse things out of curiosty    .
                                                                 
73 de OE1HGA, Gerald
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 717
Posted: 04:37pm 21 Dec 2025
Copy link to clipboard 
Print this post

Agree ..you also need to fear, that overclocking makes it worse ;)
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5543
Posted: 04:50pm 21 Dec 2025
Copy link to clipboard 
Print this post

Flash endurace specifiek by the manufacturer is far more reliable than anything you can do yourself. When you use MMBasic, flash is cached, and unless you exactly know what you are doing, you might be testing cache endurance.

And you sample batch may be small. RP Will have tested with hundreds of chips in controlled climatic conditions.

Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 717
Posted: 06:45pm 21 Dec 2025
Copy link to clipboard 
Print this post

  Quote  Hello,

I would like to find out how many write cycles the Raspberry Pi Pico 2 can tolerate before it becomes faulty (I know it should be around 100.000).


When you use MMBasic, flash is cached, and unless you exactly know what you are doing, you might be testing cache endurance.


Idea for Sylvester instaed of rockets:
Use the Arduino IDE and write a short loop and start it 5 to 12.
Please post your findings.


Edit: OT - I didn't notice  
Edited 2025-12-22 05:48 by dddns
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025