• AVR Freaks

Hot!SST26 driver example

Author
amg
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2014/02/15 11:19:58
  • Location: 0
  • Status: offline
2020/06/25 05:17:36 (permalink)
0

SST26 driver example

Hi all,
 
I launched the Harmony3 example "async_nvm_sst26_read_write_pic32mz_ef_sk" into my pic32mz starter kit with a SST25VF064C (notice is not a SST26!) and it executes the example successfully with erase, write and read operations.
 
In the original project it erases, writes and reads into 4 sectors of 4KB each, so it defines a buffer size like:
#define SST26_BUFFER_SIZE (16384U)

Now I would like to increase this buffer size into 9 sectors so the total amount would be:
#define SST26_BUFFER_SIZE (36864U)

But increasing any value above 16384 just causes the program go into the STATE_ERROR. I revised the code and everything seems to be fine like for example the sector or page size matches with my memory even is not the same model. The example has a function to calculate the required block sizes for its operations:
        case APP_SST26_STATE_GEOMETRY_GET:
        {
            geometry = DRV_MEMORY_GeometryGet(appSST26Data.memoryHandle);

            if (geometry == NULL)
            {
                appSST26Data.state = APP_SST26_STATE_ERROR;
                break;
            }

            appSST26Data.numReadBlocks = (SST26_BUFFER_SIZE / geometry->geometryTable[GEOMETRY_TABLE_READ_ENTRY].blockSize);
            appSST26Data.numWriteBlocks = (SST26_BUFFER_SIZE / geometry->geometryTable[GEOMETRY_TABLE_WRITE_ENTRY].blockSize);
            appSST26Data.numEraseBlocks = (SST26_BUFFER_SIZE / geometry->geometryTable[GEOMETRY_TABLE_ERASE_ENTRY].blockSize);
        }

I would expect that some incompatibility can cause errors or program halting but the original example works straight away, so I don't really know what I'm missing for increasing the erase/write/read buffer size...
 
Any suggestion?
 
Thanks in advance
#1

3 Replies Related Threads

    Antipodean
    Super Member
    • Total Posts : 1878
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re: SST26 driver example 2020/06/25 15:29:32 (permalink)
    0
    amg
    Now I would like to increase this buffer size into 9 sectors so the total amount would be:
    #define SST26_BUFFER_SIZE (36864U)

    But increasing any value above 16384 just causes the program go into the STATE_ERROR. 



    And how much memory does your PIC32 have?
     

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #2
    amg
    Starting Member
    • Total Posts : 58
    • Reward points : 0
    • Joined: 2014/02/15 11:19:58
    • Location: 0
    • Status: offline
    Re: SST26 driver example 2020/06/28 08:34:47 (permalink)
    0
    It's a PIC32MZ2048EFH144 with 2048 KB of program memory and 512 KB of data memory.
     
    The weird thing is that if I choose a number multiple of the sector size (4096 KB) lower than the default example value (16384) it works, but if it's higher it doesn't. Even if I choose 1 byte less the state machine fails only on the data verification but the program does everything else properly, while if I add 1 byte more the state machine goes into the error state.
     
     
     
    post edited by amg - 2020/06/28 09:13:29
    #3
    amg
    Starting Member
    • Total Posts : 58
    • Reward points : 0
    • Joined: 2014/02/15 11:19:58
    • Location: 0
    • Status: offline
    Re: SST26 driver example 2020/06/28 09:36:13 (permalink)
    4 (1)
    Fixed! It was necessary to change the below define value, if the desired buffer size is for example 36864 you have to divide it per the page size that is 256 bytes, the result then becomes:
     
    #define DRV_SST26_BUFF_DESC_NUMBER 144

    Thanks for the help!
    #4
    Jump to:
    © 2020 APG vNext Commercial Version 4.5