cancel
Showing results for 
Search instead for 
Did you mean: 

Solution

cagdasyet
Associate
Posted on June 24, 2015 at 15:04

To write multiple adress you sould use

Auto Address Increment (AAI) Word-Program Sequence

This is the code.

/************************************************************************/

/* PROCEDURE: EBSY                            */

/************************************************************************/

void EBSY()

{

    sFLASH_CS_LOW();            /* enable device */

    YYCM_SpiPut(0x70);        /* send EBSY command */

    sFLASH_CS_HIGH();            /* disable device */

}

/************************************************************************/

/* PROCEDURE: DBSY                            */

/************************************************************************/

void DBSY()

{

    sFLASH_CS_LOW();            /* enable device */

    YYCM_SpiPut(0x80);        /* send EBSY command */

    sFLASH_CS_HIGH();            /* disable device */

}

/************************************************************************/

/* PROCEDURE: WRDI                            */

/************************************************************************/

void WRDI()

{

    sFLASH_CS_LOW();            /* enable device */

    YYCM_SpiPut(0x04);        /* send WRDI command */

    sFLASH_CS_HIGH();            /* disable device */

}

/************************************************************************/

/* PROCEDURE:    Auto_Add_IncA                        */

//------Dikkat Sadece 2 nin katlari seklinde yazabiliyor AUTO increment

// Auto Address Increment (AAI) Word-Program Sequence with Software End-of-Write Detection

/************************************************************************/

void sFLASH_WritePage_AutoINC(uint8_t* pBuffer,unsigned long Dst,uint16_t NumByteToWrite)

{

    //EBSY();     /* Enable SO as RY/BY# output if in AAI */

    sFLASH_WriteEnable();

    

    sFLASH_CS_LOW();                /* enable device */

    YYCM_SpiPut(0xAD);            /* send AAI command */

    YYCM_SpiPut(((Dst & 0xFFFFFF) >> 16));     /* send 3 address bytes */

    YYCM_SpiPut(((Dst & 0xFFFF) >> 8));

    YYCM_SpiPut(Dst & 0xFF);

    YYCM_SpiPut(*pBuffer);            /* send 1st byte to be programmed */

    pBuffer++;    

    YYCM_SpiPut(*pBuffer);            /* send 2nd byte to be programmed */

    pBuffer++;

    sFLASH_CS_HIGH();                /* disable device */

    

    NumByteToWrite=NumByteToWrite-2;

    

    while (NumByteToWrite) //!!!Dikkat Bu Sekilde Calismiyor  Otomatik Aderss artt1rma vs yok!!!

  {

        sFLASH_CS_LOW();                /* enable device */

        YYCM_SpiPut(0xAD);            /* send AAI command */

        YYCM_SpiPut(*pBuffer);            /* send 1st byte to be programmed */

        pBuffer++;

        YYCM_SpiPut(*pBuffer);            /* send 2nd byte to be programmed */

        pBuffer++;

        sFLASH_CS_HIGH();                /* disable device */

        NumByteToWrite=NumByteToWrite-2;

    }

    

    WRDI();                 /* Exit AAI before executing DBSY */

    //DBSY();                    /* disable SO as RY/BY# output if in AAI */

    sFLASH_WaitForWriteEnd();

}
0 REPLIES 0