Hello, Error writing to flash sector partially

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I use the flash S34ML08G1 in 8 bits databus.

When i read from even sectors it works ok.

When i read from odd sectors if fails.

Readed values does not match with writen values.

The first 64 bytes are ok but the rest are not.

It seems that the flash lost the connection after 64 bytes and it puts the bus in high impedance.

I check the status register after writing and is ok.

Any idea?

Best regards

Jesús Rubiralta

0 Likes
4 Replies
SudheeshK
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hello Jesús Rubiralta,

I would like to know more details about this issue. Could you please let me know the steps that you follow to reproduce this issue?

Are you facing this issue with all of the S34ML08G1 that you tested?

Thanks and Regards,

Sudheesh

0 Likes
Anonymous
Not applicable

Hello Sudheesh,

This is my code:

SECSIZ is 2048 bytes.

ECF_ErrorCode writeSector(unsigned long sector, unsigned char *src){

    int add = sector * (SECSIZ);

    int ret;

    GPIOB_MODER = 0x55555555;     //Put databus port as output

    WP_OFF;                                        //Disable write protection

    if((add & 0x1FFFF)==0)

        eraseBlock(add);

    CE_ON;                                             //Select the device

    sendCommand(0x80);

    sendAdd(add);

    int numbytes = SECSIZ;

    while(numbytes){

        WE_L; GPIOB_ODR = ((*(unsigned char*)origen++) & 0xff); WE_H;

        numbytes--;

    }

    sendCommand(0x10);

    while(!READY);

    sendCommand(0x70);

    RE_L; ret = GPIOB_IDR; RE_H;

    CE_OFF;                                        //Disable the device

    WP_ON;                                        //Enable write protection

    return((ret & 1) == 0) ? ECFERR_SUCCESS : ECFERR_FAILED;

}

ECF_ErrorCode readSector(unsigned long sector, unsigned char *dest){

    int add = sector * (SECSIZ);

    GPIOB_MODER = 0x55555555;          //Put databus port as output

    CE_ON;                                               //Select the device

    sendCommand(0x00);

    sendAdd(add);

    sendCommand(0x30);

    int numbytes = SECSIZ;

    while(!READY);

    GPIOB_MODER = 0;                              //Put databus port as input

    while (numbytes){

        RE_L;

        *(char*)destino++ = (GPIOB_IDR & 0xff);          // !!!!! After 64 bytes the bus goes to hi impedance !!!!!!

        RE_H;

        numbytes--;

    }

    CE_OFF;                                                  //Disable the device

    GPIOB_MODER = 0x55555555;               //Put databus port as output

    return(ECFERR_SUCCESS);

}

Many thanks

Jesús Rubiralta

0 Likes
Anonymous
Not applicable

Hello Sudheesh,

I am facing this issue with all of the S34ML08G1 that i have tested.

Jesús Rubiralta

0 Likes
SudheeshK
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hello Jesús Rubiralta,

I checked the program snippet that you provided. Could you please let me  know the number of address bytes that you sent to our device using the function " sendAdd(add);". Is it 4 bytes or 5 bytes?

Thanks and Regards,

Sudheesh

0 Likes