usqlite icon indicating copy to clipboard operation
usqlite copied to clipboard

RPI PICO is freezing

Open mishal opened this issue 5 months ago • 0 comments

Hello!

I'm playing with an idea to use sqlite on microcontroller (RPI PICO). I've successfully built the firmware with usqlite module (with micropython v1.22.1)

When I execute the example script multiple times (from your README):

import usqlite

if not usqlite.mem_status():
    usqlite.mem_status(True) # Enable memory usage monitoring

con = usqlite.connect("data.db")

con.executemany(
    "BEGIN TRANSACTION;"
    "CREATE TABLE IF NOT EXISTS data (name TEXT, year INT);"+
    "INSERT INTO data VALUES ('Larry', 1902);"+
    "INSERT INTO data VALUES ('Curly', 1903);"+
    "INSERT INTO data VALUES ('Moe', 1897);"+
    "INSERT INTO data VALUES ('Shemp', 1895);"+
    "COMMIT;")

with con.execute("SELECT * from data") as cur:
    for row in cur:
        print("stooge:", row)
        
con.close()

print("usqlite mem - current:", usqlite.mem_current(), "peak:", usqlite.mem_peak())

the device freezes. I tried to disable the mem_status feature. I'm not sure how to debug this, but I noticed strange issue (at least for me). If I upload the generated uf2 using picotool, then connect to sqlite db from repl, disconnect, and then when I verify the uf2 with the device flash (using picotool verify) it shows that the images are not the same (ERROR: The device contents did not match the file).

What could be the cause? What information do you need from me? Thanks a lot.

mishal avatar Jan 10 '24 13:01 mishal