• AVR Freaks

Hot!H2.06 Simple SQI SST26 Flash Driver

Author
jtzeng
Super Member
  • Total Posts : 463
  • Reward points : 0
  • Joined: 2003/11/07 12:42:20
  • Status: offline
2019/03/17 11:27:40 (permalink)
0

H2.06 Simple SQI SST26 Flash Driver

Using MPLABX 5.10, H2.06.
I have setup the SQI Flash Driver for SST26 and CS0. The default is CS1.
It get -1 for the handle when doing the open:
    appData.SST26_handle = DRV_SST26_Open(DRV_SST26_INDEX_0, DRV_IO_INTENT_READWRITE);


Is there an issue with the CS0 or is there something else I should be looking at?

Attached Image(s)


John Zigrang
JTZ Engineering, Inc.
#1

11 Replies Related Threads

    jtzeng
    Super Member
    • Total Posts : 463
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/18 19:22:29 (permalink)
    0
    Scoped out the SPI setup and I get the 66x with SCK running at 50MHZ.
    PBCLK5 is running at 100MHZ.
    No other traffic is seen.

    John Zigrang
    JTZ Engineering, Inc.
    #2
    bboehmer
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2017/06/01 11:32:22
    • Location: 0
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/20 07:52:01 (permalink)
    0
    Have you seen this:
    https://www.microchip.com/forums/FindPost/1072239
     
    It says it is for Harmony 2.04, but I had to do this on 2.06 and it fixed the SST26 SQI driver for me.
     
    Bob
     
    #3
    jtzeng
    Super Member
    • Total Posts : 463
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/20 08:18:56 (permalink)
    0
    Bob: thanks for the link.
    Did not find that in my search.
     
    Microchip has verified that there may be an issue with the CS0 in H2.06
     
    I will look at the changes.
    Did you have to add the pull-ups?  Did you use external or internal?
     

    John Zigrang
    JTZ Engineering, Inc.
    #4
    bboehmer
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2017/06/01 11:32:22
    • Location: 0
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/20 08:39:05 (permalink)
    5 (1)
    John -

    I did not need to add any pull-ups. I am using CS0 successfully. The only thing I needed to do was make the two code changes noted in Erik's post.
     
    Hope this helps,
    Bob
     
    #5
    jtzeng
    Super Member
    • Total Posts : 463
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/20 16:44:47 (permalink)
    0
    Just tried the two fix's in drv_sst26.c and I still came away with a -1 in my handle.
    This is done in APP_Initialize:
       appData.SST26_handle = DRV_SST26_Open(DRV_SST26_INDEX_0, DRV_IO_INTENT_READWRITE);



    John Zigrang
    JTZ Engineering, Inc.
    #6
    bboehmer
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2017/06/01 11:32:22
    • Location: 0
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/20 17:14:25 (permalink)
    0
    The only difference I see in my Harmony configuration vs. what you have in your first post is that under the SQI driver configuration I have "Send or receive least significant bit of a byte first" un-checked.  I believe that the SST26 driver does communicate with the flash chip before you call DRV_SST26_Open, so if the bit order is wrong the driver object status will never be set to SYS_STATUS_READY and DRV_SST26_Open will fail.
     
    First I'd try to clear the SQI driver configuration checkbox for bit order to see if that fixes it. If not, step through DRV_SST26_Open to see where it dies.
     
    Bob
     
    #7
    jtzeng
    Super Member
    • Total Posts : 463
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/23 12:07:09 (permalink)
    0
    Something else must be going on with my configuration.
    I was able to change to CS1 and run the sqi_fat to the end without issue on my target hardware.
    I added this to my app_sst26_Task code to try and wait for the driver to be ready to open and it did not help:
        case APP_SST26_WaitOpen:
            if(DRV_SST26_Status(sysObj.drvSst26Obj0) == SYS_STATUS_READY){
                appData.SST26_handle = DRV_SST26_Open(DRV_SST26_INDEX_0, DRV_IO_INTENT_READWRITE);
                if(appData.SST26_handle != DRV_HANDLE_INVALID){
                    appData.SST26_State = APP_SST26_GetFlashInfo;
                }
            }
    Never get Status is READY.
    This is with or without the fix I was pointed to.
     
    New configuration with SC1 attached.
     

    Attached Image(s)


    John Zigrang
    JTZ Engineering, Inc.
    #8
    jtzeng
    Super Member
    • Total Posts : 463
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/25 12:56:45 (permalink)
    0
    I redid the project for the pic 32mz EF SK and CS1.
    The code is attached. (don't know how to added it inside the post)
    It is able to open sst26 after waiting for the driver to be ready.
    I also setup the Event Task with my local routine.
     
    The when I do an erase it does not sent out any commands that I can capture.
    I get the completed indication and then issue a read in to my buffer.
    The data in that buffer is not changed, but I see a lot of traffic on the SQI.
     
    Any ideas out there.

    John Zigrang
    JTZ Engineering, Inc.
    #9
    jtzeng
    Super Member
    • Total Posts : 463
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/26 09:24:37 (permalink)
    0
    After going around with MC support I used the DRV_SST26_AddressGet and DRV_SST26_GeometryGet to get info on the part.
    This showed me that my assumption of the read was wrong.
    I though it was reading blocks not realizing that the read/write/and erase all have different size of blocks.
    Now I read 4096 bytes but I get gaps in my buffer. 
     

    John Zigrang
    JTZ Engineering, Inc.
    #10
    bboehmer
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2017/06/01 11:32:22
    • Location: 0
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/28 15:40:16 (permalink)
    0
    You may need the coherent attribute on your buffer. Also, I used aligned(16) rather than aligned(4) - not sure if that was necessary or not...
     
    static uint8_t __attribute__ ((coherent,aligned (16))) flash_buffer[XFER_SIZE];
     
    #11
    jtzeng
    Super Member
    • Total Posts : 463
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: H2.06 Simple SQI SST26 Flash Driver 2019/03/28 23:09:34 (permalink)
    0
    It looks like the coherent is needed.
    I can see aligned 4, but not sure why 16 would be needed but I did it as well.
    I now have to working well and have the steps to make it work.
    1.  The driver has to be ready or the open will return an invalid handle.
    You can call open over and over until you get a good one or wait for the read with the status call.
    2.  coherent is needed in the buffer,  which alignment 4, or 16 is not clear, I am use 16 at this time.
    3.  nBlocks or Number of Block got me as the functions are all different.
    Read  block size 1 bytes
    Write block size 256 bytes
    Erase block size 4096 bytes.
    So 16 write blocks in an Erase block,  4096 read blocks in an Erase block.
     
    The documentation on this is clearly lacking in the PDF and .h file.
    The examples need more real values for show how all three function work together.
    I do work on this with microchip case, and the tech had no better idea than I did.
    The best direction he gave me was the geometry call.  That show I was looking at nblock wrong.
    After that I worked it out.
    Thanks for all the input.

    John Zigrang
    JTZ Engineering, Inc.
    #12
    Jump to:
    © 2019 APG vNext Commercial Version 4.5