• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

How to save to flash not RAM – MicroPython – ESP8266 – Mount MicroPython board as filesystem

Q&A Forum › Category: ESP8266 › How to save to flash not RAM – MicroPython – ESP8266 – Mount MicroPython board as filesystem
0 Vote Up Vote Down
Gary asked 3 years ago

Hi Sara,

How to save to flash not Ram?

Got the Web app to work finally.

But it only seems to save to RAM, not flash.

References:

  1. 192.168.1.148/?led=on
  2. https://github.com/RuiSantosdotme/ESP-MicroPython/tree/master/code/WiFi/Web_Server_Output_Simple
  3. MacBook Pro early 2015 Running current version of Monterey
  4. By they way I get an error trying to install uPyCraft  – current version
  5. Using Thonny 3.3.13
11 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Thonny IDE interface has changed.
You need to upload the files to the board. Just running the files won’t work.
You need to upload boot.py and then, main.py.
To upload a file you need to go to File > Save as > MicroPython Device, select your board, and save the file as boot.py or main.py.
 
After uploading both files, you can reset the board and it should start running the code as expected.
 
Regards
Sara

0 Vote Up Vote Down
Gary answered 3 years ago

Thanks Sara
1. I seem to be stuck, now I can’ reset the board, all I get is busy and I can’t stop it just get…. 
WARNING:root:Unexpected echo. Expected b’%Run -c $EDITOR_CONTENT\r\n’, got b”
Device is busy or does not respond. Your options:
  – wait until it completes current work;
  – use Ctrl+C to interrupt current work;
  – use Stop/Restart to interrupt more and enter REPL
2. I an unable to Stop/Restart or Ctrl+C
No print(‘Connection successful’) are seen
3. My code follows, by the way I added led = Pin(2, Pin.OUT) to led.low()
Thanks,
Gary 
# Complete project details at https://RandomNerdTutorials.com
#boot.py
try:
  import usocket as socket
except:
  import socket
from machine import Pin
import network
import esp
esp.osdebug(None)
import gc
gc.collect()
ssid = ssid = ‘My local Network wifi’
password = ‘password for local Network’
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(‘MicroPython-dbf032’, ‘micropythoN’)
while station.isconnected() == False:
  pass
print(‘Connection successful’)
print(station.ifconfig())
led = Pin(2, Pin.OUT)
led.low()

0 Vote Up Vote Down
Gary answered 3 years ago

Hi Sara,
Now when I try to download ‘boot.py’ to the device, 
all I get is a Th popup:
Device is busy. can’t perform this action now 
Please wait or cancel cu work and try again! 
 
OK 
—-There’s nothing a cad do now all fail. 
Thanks,
Gary
 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
If the device is busy, it means you need to press the STOP button before trying to upload a new code.
Additionally, make sure the device is not opened in any other program.
Regards,
Sara

0 Vote Up Vote Down
Gary answered 3 years ago

Thanks, I found some a ref   that  stopping with Stop and Ctrl-C, in the Python Window worked.
 
The code still does not run without problems.

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Can you describe the problem you’re getting?

0 Vote Up Vote Down
Gary answered 3 years ago

Thanks Sara so much, Ill get back to you ASAP
I have been working on this now for 4 day!
Thanks you for you grace!!
Gary

0 Vote Up Vote Down
Gary answered 3 years ago

Hi Sare,
I got Rui’s code to compile in Thommy with one missing: import socket in main.
When I go to http://192.168.1.148 it just hangs.

  • 192.168.1.148/?led=on
  • https://github.com/RuiSantosdotme/ESP-MicroPython/tree/master/code/WiFi/Web_Server_Output_Simple

 
Also when I run the code, shouldn’t the web page ring up?
Thanks,
Gary 

0 Vote Up Vote Down
Gary answered 3 years ago

Hi Sara,

Sorry Sara, not sure how to best edit my forum info
So sorry for the duplication, please advise me on best way to handle this, I deleted a bunch from my fist message.

  1. Now:

How to save to flash not Ram?
Got the Web app to work finally.
But it only seems to save to RAM, not flash.

2. PyCharm is still my goal, Thonny is very easy but also very limited.

What do you use?
Thanks,
Gary

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi Gary.
 
I’ve just tested that example using uPyCraft and Thonny IDE and it is working fine.
Make sure you upload boot.py first, and then main.py. Make sure those two files are uploaded to the board. Otherwise, it will not work.  If you’re having issues getting it working on two separate files, copy the content of the boot.py to the top of the main.py file and use just the main.py file.
 
I’m not familiar with PyCharm with MicroPython. I’m installing PyCharm at the moment, and if I get it right, I might create a tutorial about that.
 
To save data to flash, you need to set up a filesystem on the board (I’m not familiar with this on MicroPython).
 
Regards,
Sara
 
 
 

0 Vote Up Vote Down
Gary answered 3 years ago

Mount MicroPython board as filesystem

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.