S25FL064L WIP always busy

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

cross mob
user_2847636
Level 2
Level 2

Hi There,

I notice the WIP always busy non stop. May I know what happened?

pastedImage_1.png

here is my code

#define CMD_S25FLXX_WRITE_ENABLE      0x06  /* write Enable */

#define CMD_S25FLXX_READ_STATUS_REG   0x05  /* read Status Register */

#define CMD_S25FLXX_PAGE_PROGRAM      0x02  /* Page Program */

#define ADDRESS_1 12304

static uint8_t buf_data[34] = {0};

int main()

{

     uint8_t test_data[7] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07};

S25FLXX_write_data(ADDRESS_1 ,test_data,7);

S25FLXX_wait_ready();

}

/* CHECK CHIP READY*/

void S25FLXX_wait_ready(void)

{

do

{

        nrf_delay_ms(10);

buf_cmd[0] = CMD_S25FLXX_READ_STATUS_REG;

/* reset transfer done flag */

spi_xfer_done = false;

APP_ERROR_CHECK(nrf_drv_spi_transfer(&S25FLXX, buf_cmd, 1, buf_data, 2));

S25FLXX_spi_wait_until_transfer_is_completed();

                printf("buf_data:%d\r\n",buf_data[1]);

}

while ((buf_data[1] & S25FLXX_BUSY) == S25FLXX_BUSY);

}

/* WRITE FUNCTION */

uint8_t S25FLXX_write_data(uint32_t address, uint8_t* buf, uint16_t length)

{

if (! S25FLXX_is_busy())

{

uint16_t i;

uint16_t len;

uint8_t offset;

/* Write Enable */

buf_cmd[0] = CMD_S25FLXX_WRITE_ENABLE;

/* reset transfer done flag */

spi_xfer_done = false;

APP_ERROR_CHECK(nrf_drv_spi_transfer(&S25FLXX, buf_cmd, 1, buf_data, 1));

S25FLXX_spi_wait_until_transfer_is_completed();

/* Page Program */

buf_cmd[0] = CMD_S25FLXX_PAGE_PROGRAM;

buf_cmd[1] = (uint8_t)((address & 0x00FF0000) >> 16);

buf_cmd[2] = (uint8_t)((address & 0x0000FF00) >> 8);

offset = (uint8_t)(address & 0x000000FF);

len = ((S25FLXX_PAGE_SIZE - offset) < length) ? (S25FLXX_PAGE_SIZE - offset) : length;

// len = length;

buf_cmd[3] = offset;

len += 4;

for (i = 4; (i < len); i++)

{

buf_cmd = buf[i-4];

}

/* reset transfer done flag */

spi_xfer_done = false;

APP_ERROR_CHECK(nrf_drv_spi_transfer(&S25FLXX, buf_cmd, len, buf_data, 1));

S25FLXX_spi_wait_until_transfer_is_completed();

return S25FLXX_OK;

}

else

{

return S25FLXX_BUSY;

}

}

0 Likes
1 Solution

Hi,

We have discover its caused by the device's interrupt issue. Therefore we would like to close this topics.

View solution in original post

0 Likes
5 Replies
BacemD_61
Employee
Employee
50 replies posted 50 sign-ins 25 replies posted

Hello,

Here is how the program command sequence should look like:

pastedImage_0.png

Please attach a Logic analyzer to the flash interface to capture the flash traces. We need to check that the flash is receiving the right commands at the right time. I'm not clear about the parameters of your function nrf_drv_spi_transfer(). Please check these as well.

Additionally, the WIP can be stuck at 1 in case of a program or erase error. In that case the corresponding P_ERR or E_ERR bits in SR2V will be set accordingly. You need to check these bits as well and send a CLSR command to clear the Status Register WIP bit in case of error.

You need to send an erase command to erase the sector before reprogramming it (Program: changing bits from 1 to 0; Erase: changing back the bits from 0 to 1).

Best regards,

Bacem

0 Likes

Hi There,

Thanks for the input. I read SR2V during the WIP hang issue. it seem that Erase suspend and program suspend flag is enable. May I know what condition this will happen? The P_ERR or E_ERR bits in SR2V is not set.

pastedImage_0.png

0 Likes

Hello,

This happens when you send Erase/Program suspend command (75h) to the flash.

This looks quite suspicious since both bits are set at the same time and the WIP bit is still set to 1. I would expect the WIP to be reset to 0 once the P/E operations gets suspended.

Something suspicious is happening here. Only LA traces will help to solve it, as noted in my previous comment.

Best regards,

Bacem

0 Likes
BushraH_91
Moderator
Moderator
Moderator
750 replies posted 50 likes received 250 solutions authored

Hello

We are still waiting for the LA traces. Please send us so we can resolve the issue.

Thank you

Regards,

Bushra

0 Likes

Hi,

We have discover its caused by the device's interrupt issue. Therefore we would like to close this topics.

0 Likes