<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Firev2.7 Test결과 PSRAM이 인식이안됩니다.]]></title><description><![CDATA[<p dir="auto">Re: [Fire with UIFlow2](/topic/6685/fire```<br />
code_text</p>
<pre><code class="language--with-uiflow2)">

# /flash/mem_fire_check.py 

# check_psram_status.py - M5Stack Fire PSRAM Detection Script
import gc
import os
import sys
import machine


def check_psram_status():
    print("M5Stack Fire PSRAM Detection Status")
    print("=" * 50)

    # 1. System information
    print("1. System Information:")
    print(f" - MicroPython version : {sys.implementation.version}")
    print(f" - Platform           : {sys.platform}")
    print(f" - Machine            : {os.uname().machine}")

    # 2. Official esp32 PSRAM API check
    print("\n2. Official PSRAM API Check:")
    try:
        import esp32
        if hasattr(esp32, 'PSRAM'):
            size = esp32.PSRAM.size()
            print(f"   esp32.PSRAM available: {size:,} bytes "
                  f"({size / 1024 / 1024:.1f} MB)")
        else:
            print("   esp32.PSRAM attribute NOT found")
    except Exception as e:
        print(f"   Failed to access esp32.PSRAM → {e}")

    # 3. Current heap status
    print("\n3. Heap Memory Status:")
    gc.collect()
    total_heap = gc.mem_alloc() + gc.mem_free()
    print(f" - Total heap   : {total_heap:,} bytes ({total_heap / 1024 / 1024:.2f} MB)")
    print(f" - Allocated    : {gc.mem_alloc():,} bytes")
    print(f" - Free         : {gc.mem_free():,} bytes")

    # 4. PSRAM allocation stress test
    print("\n4. PSRAM Allocation Test (512KB chunks):")
    test_psram_allocation()

    print("=" * 50)


def test_psram_allocation():
    gc.collect()
    start_free = gc.mem_free()
    buffers = []
    chunk_size = 512 * 1024  # 512KB

    try:
        for i in range(1, 17):  # Try up to ~8MB
            buf = bytearray(chunk_size)
            buffers.append(buf)
            allocated = len(buffers) * chunk_size
            current_free = gc.mem_free()

            print(f"   {allocated / 1024 / 1024:.1f} MB allocated → "
                  f"{current_free / 1024 / 1024:.2f} MB free")

            # If free memory drops too fast → we're NOT using PSRAM
            if start_free - current_free &gt; (start_free * 0.8):
                print("   Sudden heap drop detected → Running WITHOUT PSRAM")
                break

    except MemoryError:
        print(f"   MemoryError at {allocated / 1024 / 1024:.1f} MB → "
              "PSRAM is NOT enabled in firmware")
    except Exception as e:
        print(f"   Unexpected error: {e}")
    finally:
        del buffers[:]
        gc.collect()
        print(f"   Cleanup complete → Free memory: "
              f"{gc.mem_free() / 1024 / 1024:.2f} MB")


def check_firmware_psram_support():
    print("\n5. Firmware PSRAM Support Summary:")
    print("   Testing different detection methods...")

    results = []

    # Method 1: esp32.PSRAM
    try:
        import esp32
        if hasattr(esp32, 'PSRAM') and esp32.PSRAM.size() &gt; 0:
            results.append("esp32.PSRAM API → Supported "
                          f"({esp32.PSRAM.size() / 1024 / 1024:.1f} MB)")
        else:
            results.append("esp32.PSRAM API → Not available")
    except:
        results.append("esp32.PSRAM API → Failed to import")

    # Method 2: Large allocation test
    gc.collect()
    try:
        _ = bytearray(6 * 1024 * 1024)  # 6MB
        results.append("Large allocation (6MB+) → SUCCESS (PSRAM likely enabled)")
        del _
    except MemoryError:
        results.append("Large allocation (6MB+) → FAILED (NO PSRAM)")

    gc.collect()

    # Final verdict
    for r in results:
        print(f"   • {r}")

    print("\n   Verdict:")
    if any("SUCCESS" in r or "Supported" in r for r in results):
        print("   PSRAM is ENABLED and working!")
    else:
        print("   PSRAM is DISABLED → Flash a PSRAM-enabled firmware!")


# Main execution
if __name__ == "__main__":
    check_psram_status()
    check_firmware_psram_support()



------------- Result    =============


MicroPython v1.25.0-dirty on 2025-10-24; M5STACK Fire with ESP32(SPIRAM)
Type "help()" for more information.
&gt;&gt;&gt; 
&gt;&gt;&gt; 
&gt;&gt;&gt; import check_psram_status as pp
&gt;&gt;&gt; pp.check_psram_status
&lt;function check_psram_status at 0x3f8034c0&gt;
&gt;&gt;&gt; pp.check_psram_status()
M5Stack Fire PSRAM Detection Status
==================================================
1. System Information:
 - MicroPython version : (1, 25, 0, '')
 - Platform           : esp32
 - Machine            : M5STACK Fire with ESP32(SPIRAM)

2. Official PSRAM API Check:
   esp32.PSRAM attribute NOT found

3. Heap Memory Status:
 - Total heap   : 4,184,768 bytes (3.99 MB)
 - Allocated    : 7,856 bytes
 - Free         : 4,176,864 bytes

4. PSRAM Allocation Test (512KB chunks):
   0.5 MB allocated → 3.42 MB free
   1.0 MB allocated → 2.91 MB free
   1.5 MB allocated → 2.40 MB free
   2.0 MB allocated → 1.90 MB free
   2.5 MB allocated → 1.46 MB free
   3.0 MB allocated → 0.96 MB free
   3.5 MB allocated → 0.46 MB free
   Sudden heap drop detected → Running WITHOUT PSRAM
   Cleanup complete → Free memory: 3.44 MB
==================================================
&gt;&gt;&gt;</code></pre>
]]></description><link>https://community.m5stack.com/topic/7903/firev2-7-test결과-psram이-인식이안됩니다</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 00:09:22 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7903.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Nov 2025 06:50:12 GMT</pubDate><ttl>60</ttl></channel></rss>