<?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[[Bug] Core2 loads JPG from flash but crashes with image from micro SD card]]></title><description><![CDATA[<p dir="auto">I would like to load a JPEG file from storage and display it on the Core2 display. It will be hundreds of pictures, so I want to use the SD card to give less stress to the internal flash.</p>
<p dir="auto">Loading the image from flash works</p>
<pre><code>from m5stack import *
lcd.clear()
lcd.image(lcd.CENTER, lcd.CENTER, "/flash/images/sled240.jpg")
</code></pre>
<p dir="auto">But loading the image from the SD card crashes</p>
<pre><code>lcd.image(lcd.CENTER, lcd.CENTER, "/sd/images/sled240.jpg")
</code></pre>
<pre><code>Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4015b7d0  PS      : 0x00060c30  A0      : 0x8015c216  A1      : 0x3ffcf800  
A2      : 0x3f871ed0  A3      : 0x3ffcf8f0  A4      : 0x3ffcf908  A5      : 0x0f006900  
A6      : 0x00000006  A7      : 0x00000000  A8      : 0x0000002f  A9      : 0x3f4007d2  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x00060021  A13     : 0x3ffcfe10  
A14     : 0x34003243  A15     : 0x3ffcfd30  SAR     : 0x00000001  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x0f006920  LBEG    : 0x40093e48  LEND    : 0x40093e53  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x4015b7cd:0x3ffcf800 0x4015c213:0x3ffcf890 0x4015cb00:0x3ffcf8f0 0x40166cf3:0x3ffcf940 0x401706a9:0x3ffcfb90 0x400e4686:0x3ffcfd00 0x400e03a5:0x3ffcfd30 0x400e04e6:0x3ffcfd50 0x400eea49:0x3ffcfd70 0x400e4754:0x3ffcfe10 0x400e03a5:0x3ffcfe70 0x400e03ce:0x3ffcfe90 0x4017640e:0x3ffcfeb0 0x40176535:0x3ffcff40 0x400f83b1:0x3ffcff70 0x40096249:0x3ffcffa0
</code></pre>
<p dir="auto">I transferred the file with Thonny to both locations, using latest Core2 firmware v1.7.2. The SD card seems to be working fine.</p>
<pre><code>&gt;&gt;&gt; import os
&gt;&gt;&gt; os.listdir("/sd/images")
['sled240.jpg']
</code></pre>
<p dir="auto">How can I fix this?</p>
<p dir="auto">Thanks<br />
Mike</p>
]]></description><link>https://community.m5stack.com/topic/2872/bug-core2-loads-jpg-from-flash-but-crashes-with-image-from-micro-sd-card</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Mar 2026 22:41:50 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2872.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 31 Jan 2021 16:54:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Fri, 05 Feb 2021 14:35:45 GMT]]></title><description><![CDATA[<p dir="auto">Here we go, easy work-around for the faulty lcd.image():</p>
<pre><code>from m5stack import *
buffer = open("/sd/images/test.jpg").read()
lcd.image_buff(lcd.CENTER, lcd.CENTER, buffer)
</code></pre>
]]></description><link>https://community.m5stack.com/post/12320</link><guid isPermaLink="true">https://community.m5stack.com/post/12320</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Fri, 05 Feb 2021 14:35:45 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Mon, 01 Feb 2021 15:37:05 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the info, <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/187">@world101</a> !</p>
<p dir="auto"><s>I guess I just need to go to old <a href="https://github.com/m5stack/M5Stack_MicroPython" target="_blank" rel="noopener noreferrer nofollow ugc">M5Stack MicroPython (LoBo)</a>, find the JPG encoder and plug it into an <a href="https://docs.lvgl.io/latest/en/html/overview/image.html#register-an-image-decoder" target="_blank" rel="noopener noreferrer nofollow ugc">LVGL image encoder</a>. Never mind.</s></p>
<p dir="auto">So I need to find a different solution to display JPGs from SD on my Core2 display.</p>
]]></description><link>https://community.m5stack.com/post/12224</link><guid isPermaLink="true">https://community.m5stack.com/post/12224</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Mon, 01 Feb 2021 15:37:05 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Mon, 01 Feb 2021 14:14:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4834">@mb</a></p>
<p dir="auto">Ahh I see now what was going on. The really early versions of M5stack MicroPython were based on Lobo's branch. About 18 months ago (give or take a few months), M5stack rebased from the mainline MicroPython releases and so much has changed since then.... new APIs, new firmware, new upy modules, etc. It didn't even occur to me which API you were using.... I totally missed that.</p>
<p dir="auto">Anyway, bmp/jpg works on the original Core devices (black/grey/Fire/Go) and png works on the Core2. I think that is the case due to M5stack using LVGL graphics engine on the Core2. Not sure that LVGL supports bmp/jpg yet according to this...<br />
<a href="https://forum.lvgl.io/t/jpg-decoder-do-we-have-ready-for-support-decoder-jpg-format/632" target="_blank" rel="noopener noreferrer nofollow ugc">https://forum.lvgl.io/t/jpg-decoder-do-we-have-ready-for-support-decoder-jpg-format/632</a></p>
<p dir="auto">Hope this helps some.</p>
]]></description><link>https://community.m5stack.com/post/12223</link><guid isPermaLink="true">https://community.m5stack.com/post/12223</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Mon, 01 Feb 2021 14:14:50 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Mon, 01 Feb 2021 12:38:19 GMT]]></title><description><![CDATA[<p dir="auto">While <code>lcd.image()</code> does not seem to support PNG, I now got <code>M5Img()</code> warking and it only supports PNG. It does not crash when loading an image from SD card.</p>
<pre><code>from m5stack import *
from m5stack_ui import *

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)

image0 = M5Img("/sd/images/sled150.png", x=0, y=0, parent=None)
</code></pre>
<p dir="auto">Too bad the web service I am targeting only delivers JPG files :-(</p>
]]></description><link>https://community.m5stack.com/post/12220</link><guid isPermaLink="true">https://community.m5stack.com/post/12220</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Mon, 01 Feb 2021 12:38:19 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Mon, 01 Feb 2021 11:16:38 GMT]]></title><description><![CDATA[<p dir="auto">Reading the image from the micro SD card works, though this is very ugly ;-)</p>
<pre><code>with open('/sd/images/sled150.jpg') as fp:
    line = fp.readline()
    while line:
        print(line)
        line = fp.readline()
</code></pre>
<p dir="auto">So it seems to be an issue with the lcd.image(), not with the file system.</p>
]]></description><link>https://community.m5stack.com/post/12218</link><guid isPermaLink="true">https://community.m5stack.com/post/12218</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Mon, 01 Feb 2021 11:16:38 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Mon, 01 Feb 2021 10:28:59 GMT]]></title><description><![CDATA[<p dir="auto">Interesting, I thought that PNG is not supported.</p>
<pre><code>lcd.image(x, y, file [,scale, type])
Display the image from the file file on position (x,y)
    JPG and BMP can be displayed.
</code></pre>
<p dir="auto">Source: <a href="https://github.com/m5stack/M5Stack_MicroPython#lcd" target="_blank" rel="noopener noreferrer nofollow ugc">M5Stack_MicroPython</a></p>
<p dir="auto">I was not successful to display an image in PNG format. But also some JPGs were not displayed at all, the command was just ignored, no error message.</p>
<p dir="auto">I resized my original image and tried again, but with the same image from micro SD card the Core2 crashes.</p>
<pre><code>&gt;&gt;&gt; import os
    os.stat("/sd/images/sled150.jpg")
(32768, 0, 0, 0, 0, 0, 47158, 665489636, 665489636, 665489636)

&gt;&gt;&gt; from m5stack import *
    lcd.clear()
    lcd.image(lcd.CENTER, lcd.CENTER, "/flash/images/sled150.jpg")
    lcd.image(lcd.CENTER, lcd.CENTER, "/sd/images/sled150.jpg")

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4015b7d0  PS      : 0x00060e30  A0      : 0x8015c216  A1      : 0x3ffcf800  
A2      : 0x3f871ed0  A3      : 0x3ffcf8f0  A4      : 0x3ffcf908  A5      : 0x0f006900  
A6      : 0x00000006  A7      : 0x00000000  A8      : 0x0000002f  A9      : 0x3f4007d2  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3ffcfe2c  A13     : 0x3ffcfe10  
A14     : 0x34003243  A15     : 0x3ffcfe00  SAR     : 0x00000001  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x0f006920  LBEG    : 0x40093e48  LEND    : 0x40093e53  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x4015b7cd:0x3ffcf800 0x4015c213:0x3ffcf890 0x4015cb00:0x3ffcf8f0 0x40166cf3:0x3ffcf940 0x401706a9:0x3ffcfb90 0x400e4686:0x3ffcfd00 0x400e03a5:0x3ffcfd30 0x400e04e6:0x3ffcfd50 0x400eea49:0x3ffcfd70 0x400e4754:0x3ffcfe10 0x400e03a5:0x3ffcfe70 0x400e03ce:0x3ffcfe90 0x4017640e:0x3ffcfeb0 0x40176535:0x3ffcff40 0x400f83b1:0x3ffcff70 0x40096249:0x3ffcffa0

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:5276
load:0x40078000,len:14052
load:0x40080400,len:3792
entry 0x4008063c
</code></pre>
<p dir="auto">I tried to find the actual source code from lcd.image() but was not successful.</p>
]]></description><link>https://community.m5stack.com/post/12217</link><guid isPermaLink="true">https://community.m5stack.com/post/12217</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Mon, 01 Feb 2021 10:28:59 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Mon, 01 Feb 2021 08:52:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4834">@mb</a><br />
IIRC, M5stack has a limit of 50KB for images. Looks like your image is ~60KB, right? However, why it works with the image stored in flash and not from the SD card, I’m not sure. Can you try to compress the image to under 50KB to see if it works?</p>
<p dir="auto">Edit: Also try converting the image from jpg to png, keeping it under 50KB, to see if it helps.</p>
<p dir="auto"><img src="/assets/uploads/files/1612169542532-9b96338b-b51f-4265-9777-00e19ec9e5c1-resized.png" alt="0_1612169529929_9B96338B-B51F-4265-9777-00E19EC9E5C1.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/12215</link><guid isPermaLink="true">https://community.m5stack.com/post/12215</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Mon, 01 Feb 2021 08:52:26 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Mon, 01 Feb 2021 08:04:00 GMT]]></title><description><![CDATA[<p dir="auto">I checked the image from the micro SD card on my Mac, it seems ok.</p>
<p dir="auto">Reading a config file from the same micro SD card directory works, too:</p>
<pre><code>import ujson
with open('/sd/images/config.json') as fp:
    config = ujson.load(fp)
    print('Config: ', config)
</code></pre>
<p dir="auto">And at least the size of both files is equal:</p>
<pre><code>&gt;&gt;&gt; import os
    os.stat("/flash/images/sled240.jpg")
    os.stat("/sd/images/sled240.jpg")
(32768, 0, 0, 0, 0, 0, 59928, -281259708, -281259708, -281259708)
(32768, 0, 0, 0, 0, 0, 59928, 665424706, 665424706, 665424706)

</code></pre>
]]></description><link>https://community.m5stack.com/post/12214</link><guid isPermaLink="true">https://community.m5stack.com/post/12214</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Mon, 01 Feb 2021 08:04:00 GMT</pubDate></item><item><title><![CDATA[Reply to [Bug] Core2 loads JPG from flash but crashes with image from micro SD card on Sun, 31 Jan 2021 17:25:44 GMT]]></title><description><![CDATA[<p dir="auto">Tried a different (newer) micro SD card - same result.</p>
]]></description><link>https://community.m5stack.com/post/12209</link><guid isPermaLink="true">https://community.m5stack.com/post/12209</guid><dc:creator><![CDATA[mb]]></dc:creator><pubDate>Sun, 31 Jan 2021 17:25:44 GMT</pubDate></item></channel></rss>