• AVR Freaks

Hot!SQI problem with SST26ReadArray

Author
PastrelloMarco
Starting Member
  • Total Posts : 67
  • Reward points : 0
  • Joined: 2013/08/30 12:26:20
  • Location: Venezia, Italy
  • Status: offline
2020/05/15 13:33:36 (permalink)
0

SQI problem with SST26ReadArray

Hi everybody,
I'm still working with a custom board with an PIC32MZ2048EFG100, a SST26VF032B memory and a LCC display.
My project is made with MplabX 5.30 with Harmony 2_06.. and compiler XC 2.30.
I connected successfully to the memory via SQI: I can read the JEDEC-ID code and single bytes from it.
The problem instead is that I can't use void SST26ReadArray(...) because this routine return always blank array: it doesn't read nothing.
I copied "drv_nvm_flah_sqi_sst26.c" (and its header file) from aria example apps into my progect, then I added GFX_Result app_externalMediaRead() . I try also to slowdown the communication frequency from 100Mhz to 10Mhz without any improvements.

Does someone had got the same problem? Must I enabled some other configuration with harmony configurator?

Tomorrow I want to create a routine to allow to read n bytes without using DMA: I want to see if there there are some difference.
(I'm sure about EEPROM content because I write and read the memory with a professional programmer)

Best regards


#1

8 Replies Related Threads

    Luca Pascarella
    Junior Member
    • Total Posts : 100
    • Reward points : 0
    • Joined: 2007/05/28 00:53:17
    • Location: The Netherlands
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/16 04:45:43 (permalink)
    0
    Did you check that your array declaration prevents cache use?
     
    FYI, you can declare a global array in uncached space with:
    static uint8_t __attribute__((coherent)) myArray[128];

    or you may convert a cacheable address to an un-cacheable address when working with malloc and DMA:
    #include <sys/kmem.h>
     
    uint8_t *no_cache, ptr* = malloc(128 * sizeof(uint8_t));
    if (ptr)
        no_cache = KVA0_TO_KVA1(ptr);
    free(ptr);
    macros 
    #2
    PastrelloMarco
    Starting Member
    • Total Posts : 67
    • Reward points : 0
    • Joined: 2013/08/30 12:26:20
    • Location: Venezia, Italy
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/16 06:50:40 (permalink)
    3 (1)
    Hi Luca,
    I tried with
    static uint8_t __attribute__((coherent)) sqiCache[SQI_CACHE_SIZE];

    but nothing change!
     
     
    #3
    Luca Pascarella
    Junior Member
    • Total Posts : 100
    • Reward points : 0
    • Joined: 2007/05/28 00:53:17
    • Location: The Netherlands
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/16 08:12:56 (permalink)
    4 (1)
    Just in case, try to double-check with debugger that sqiCache is in non-cache space.
     
    __attribute__((coherent)) works only for global variables, you cannot declare uncacheable variables on the stack.
     
    I was able to get an SST26VF032B working with a PIC32 MZ just doing these small changes.
    But perhaps your problem is different.
    #4
    PastrelloMarco
    Starting Member
    • Total Posts : 67
    • Reward points : 0
    • Joined: 2013/08/30 12:26:20
    • Location: Venezia, Italy
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/16 09:54:36 (permalink)
    0
    I retry with
    static uint8_t __attribute__((coherent)) sqiCache[SQI_CACHE_SIZE];

    but nothing change! With debugger I see that sqiCache is placed into a "different type of ram", so it seems correct.
     (see attachment)

    at the moment, I found a workaround to solve that problem. I use:

    for (nbytes = 0; nbytes < SQI_CACHE_SIZE; nbytes++)
          sqiCache[nbytes] = SST26ReadByte(sqiCacheAddress + nbytes);

    instead of:
     SST26ReadArray(sqiCacheAddress, sqiCache, SQI_CACHE_SIZE); 


    Is not elegant, it's slow... I know it, but at the moment it works.
    I must verify what happens with DMA, but at the moment its difficult for me because I never used SQI and DMA.
    I need some days to learn how they works together and understand how to solve the problem.
    It seems strange that nobody see/has this problem.

    Attached Image(s)

    #5
    Luca Pascarella
    Junior Member
    • Total Posts : 100
    • Reward points : 0
    • Joined: 2007/05/28 00:53:17
    • Location: The Netherlands
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/18 09:50:05 (permalink)
    0
    The address's buffer seems correctly placed into no-cache space. I would exclude a cache issue.
     
    I never used the SST26ReadByte API, therefore, I won't exclude an issue with it.
    I refer to DRV_MEMORY wrapper because I use the same code to read and write both SST26 than SST25 flashes with a unified API. Maybe it's different but with DRV_MEMORY you may deal with async calls (when async mode is enabled).
    In my case, I call DRV_MEMORY_Read and wait that the read ends. Usually setting and a callback function.
     
     
    #6
    PastrelloMarco
    Starting Member
    • Total Posts : 67
    • Reward points : 0
    • Joined: 2013/08/30 12:26:20
    • Location: Venezia, Italy
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/23 10:16:21 (permalink)
    0
    Hi,
    in those days a made some test and I discovered some problems about SQI.

    1) an errata corrige tell us that is not possibile to use CLKDIV != 0; is necessary to set REFCLK2 with a "slow" frequency and keep CLKDIV = 0(I tried from 50Mhz to 2Mhz- nothing change)
    2) I make a test with H2_06 application examples (flash_read_dma.X) inside drivers example folder, but also this code doesn't work form me.
    3) I set the destination buffer like :
    uint8_t __attribute__((coherent)) readBuffer[FLASH_PAGE_SIZE];

    4) I used a logic analyzer to display all the signals and I saw some problems(see attachment_1 for locig signals, and attchment_2 for data present in memory)
    5) I confirm that JEDEC_ID is always readable, such as singles bytes.


    If I remove the CS management from SQI, the communication doesn't work: I can't read JEDEC_ID.
    Sincerely, is the first time I use SQI and DMA peripherical, and is too difficult solve this problem.
    If nobody hasn't some ideas, In the next days I would like to ask help to Microchip.

    Attached Image(s)

    #7
    PastrelloMarco
    Starting Member
    • Total Posts : 67
    • Reward points : 0
    • Joined: 2013/08/30 12:26:20
    • Location: Venezia, Italy
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/24 05:34:52 (permalink)
    0
    Today I insert a 1k Ohm pullup for eah signal (WP, CS, SQI0 --> SQI3): nothing change.
    I tryed also with APP_SQI_PIO_PageRead and it doesn't wotk: nothing is read.
    I tryed with APP_SQI_XIP_Read and it  wotk only for the first read: Ie : if I want to Read 256 Bytes it works.
    If I want read 8Kbytes = all bytes are readed without problems. But if I want to use more times APP_SQI_XIP_Read, from 2nd times it read always 0x00 or 0xff; So I can't use it! Now I'm trying to understand what happen inside: at least CS is drived correctly.
    #8
    friesen
    Super Member
    • Total Posts : 2126
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: SQI problem with SST26ReadArray 2020/05/25 05:49:20 (permalink)
    4 (1)
    Here is one issue I found with the MZ DA series.
     
    https://bitbucket.org/erikfriesen/harmony-2.04/diff/driver/sqi_flash/sst26/src/dynamic/drv_sst26.c?at=master&diff2=43d8be86155bff9070fc2230c0c4dd4ce5f93054
     
    There are some other 'fixes' according to me in this repo.  Mainly in drv_sst26.c and drv_sqi.c

    Erik Friesen
    #9
    Jump to:
    © 2020 APG vNext Commercial Version 4.5