• AVR Freaks

Hot!Corrupt displaying images from external flash

Author
RUrbas
New Member
  • Total Posts : 9
  • Reward points : 0
  • Joined: 2018/07/03 10:55:47
  • Location: 0
  • Status: offline
2018/09/10 02:28:05 (permalink)
0

Corrupt displaying images from external flash

Hi there.
 
I need to display images from external (SPI) flash which have transparency. While in internal flash stored images seem to work without a problem, same images, stored in external flash do not work.
PNG files "freezes" whole MCU, while bmp files looks corrupt.
If image resolution is divisible by 32 (192x192 for example) . I get best results, how ever image is still flipped and shifted to one side.
If resolution is other, then its shifted almost at 45 degree angle.
 
I'm not sure how to fix, or get around it. I can shift image to the side, how ever i have no idea how to flip it. Maby someone has experienced this, have an idea ow to deal with it or what might be causing this?
 
I'm adding pictures of these deformations and original image for reference.
 
Thanks in advance
 
MPLAB v4.20
Harmony 2.05
PIC32 MZ2064DAH176

Attached Image(s)

#1

10 Replies Related Threads

    Ed@Microchip
    Super Member
    • Total Posts : 158
    • Reward points : 0
    • Joined: 2017/04/06 09:39:29
    • Location: 0
    • Status: offline
    Re: Corrupt displaying images from external flash 2018/09/10 09:09:19 (permalink)
    0
    PNG images require a large heap to decode. We typically recommend setting your heap to about 1.5x - 2x the size of the image when converted to RAW (about W*H*4 bytes).
     
    How are you generating the SPI image data and how are you storing it into the SPI flash? There is a couple of GFX demo applications that show how to generate a SPI image from MHGC and programming it to SPI flash - you can check out aria_external_resources and aria_flash. Refer to the Harmony help volume 1 - Applications Help -> Graphics Demonstrations in the doc/ directory of your Harmony installation.
    #2
    RUrbas
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2018/07/03 10:55:47
    • Location: 0
    • Status: offline
    Re: Corrupt displaying images from external flash 2018/09/10 09:34:15 (permalink)
    0
    SPI flash has FS and USB MSD. The main idea is that flash is accessed by USB, to edit, upload new images if needed. So i create, edit image on a PC and then upload it to flash through USB. Maby there is specific RAW format? I did look at aria_external_resources a while ago, but didn't look into how flash was programmed. Also, just making sure, only RAW images have option to "Color Masking"? FYI. 8 bit PNG is displayed very nice while there is enough heap. And JPG is also almost good (there is several columns of extra pixels to the right of the image).
    #3
    MHGC
    Super Member
    • Total Posts : 238
    • Reward points : 0
    • Status: offline
    Re: Corrupt displaying images from external flash 2018/09/10 09:47:19 (permalink)
    0
    Color masking is supported by RAW images (not JPEG nor PNGs).  For reduction in image storage size, RLE compression is supported by RAW images.  In general, depending on the design of the image, it does a comparable job to JPEGs.

    I notice you are using a PIC32MZ DA.  Are you preprocessing the images into DDR2 and then use the GPU to blit the images into the frame buffer?
    #4
    RUrbas
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2018/07/03 10:55:47
    • Location: 0
    • Status: offline
    Re: Corrupt displaying images from external flash 2018/09/10 10:18:27 (permalink)
    0
    I do not preprocess as i didn't see that done in any examples I looked at and don't really know how to use it
    #5
    RUrbas
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2018/07/03 10:55:47
    • Location: 0
    • Status: offline
    Re: Corrupt displaying images from external flash 2018/09/13 09:01:46 (permalink)
    0
    Found where in the driver i can flip the image too
    #6
    MHGC
    Super Member
    • Total Posts : 238
    • Reward points : 0
    • Status: offline
    Re: Corrupt displaying images from external flash 2018/09/14 09:12:59 (permalink)
    0
    Regarding Image Preprocessing, the feature exists in v2.05.  A documentation section on how to use the feature, as well as a tool known as the DDR Manager, were added in v2.06.
     
    The following sections may be helpful:
    1) Volume III: MPLAB Harmony Configurator (MHC) > MPLAB Harmony Graphics Composer User's Guide > Advanced Topics > GPU Hardware Accelerated Features
    2) Volume III: MPLAB Harmony Configurator (MHC) > MPLAB Harmony Graphics Composer User's Guide > Advanced Topics > GPU Hardware Accelerated Features > Image Preprocessing Memory Management

    You can also look at the function APP_PreloadImages() in aria_coffee_maker app.c for a c-code version of how to implement image preprocessing.
    #7
    GinAli
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2008/09/01 19:01:35
    • Location: Turkiye
    • Status: offline
    Re: Corrupt displaying images from external flash 2020/02/28 07:42:55 (permalink)
    0
    Hi,
     
    I am using MEBII with MZDA starterkit internal DDR.
    I have successfully implemented SQI flash to aria_coffee_maker app.
    Upload image.hex to SQI via aria_flash.
    I saw the APP_PreloadImages() function.
     
    My problem is external images are extremely slow. I suppose harmony print them pixel by pixel.
    I have tried Jpeg and RAW-RLE compressed. jpeg is much faster than RAW which is unexpected. 
     
    Is there any way to introduce external images to APP_PreloadImages()  to make them print faster ?
     
    Thanks 
    Oz.
     
     
    #8
    NKurzman
    A Guy on the Net
    • Total Posts : 18401
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Corrupt displaying images from external flash 2020/02/28 10:47:23 (permalink)
    0
    Harmony 2 or Harmony 3?
     
    If you have the external Flash Space storing them as BMPs will be faster since the will not need to be decoded.
    #9
    GinAli
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2008/09/01 19:01:35
    • Location: Turkiye
    • Status: offline
    Re: Corrupt displaying images from external flash 2020/03/01 23:07:31 (permalink)
    0
    Thanks NKurzman,
     
    Harmony 2.06.
    I have tried to print (from external SQI) BMPs , with or without RLE, JPEG, PNG (PNG failed because heap I suppose).
    JPEG looks much faster. I believe; to decode JPEG, harmony not only reads one pixel, instead reads chunks of data. 
     
    MPLAB v5.30
    Harmony 2.06
    MEBII with MZDA starterkit internal DDR
    PIC32 MZ2064DAG169
    #10
    Ed@Microchip
    Super Member
    • Total Posts : 158
    • Reward points : 0
    • Joined: 2017/04/06 09:39:29
    • Location: 0
    • Status: offline
    Re: Corrupt displaying images from external flash 2020/03/09 09:04:38 (permalink)
    4 (1)
    You are correct, for large images, JPG would usually render faster from external flash because they are a lot smaller than the RAW or RLE equivalent.
    #11
    Jump to:
    © 2020 APG vNext Commercial Version 4.5