Vybrid QSPI-flash status request issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vybrid QSPI-flash status request issue

Jump to solution
1,067 Views
tfe
Contributor V

I am having some issues with requesting the status of the S25FL128S QSPI-flash chip on the TWR-VF65GS10 dev-kit. I initialize the chip in MQX in the following manner:

     Open device

     Set single IO mode

     Get virtual memory base offset

     Get total memory length

     Get sector size

At first status request, reading status1 on S25FL128S gives:

     [INFO ]       QSPI0 status code: 0xAA

     [INFO ]       ... Write in progress ............... : False

     [INFO ]       ... Write enable latch .............. : True

     [INFO ]       ... Block protection 1 .............. : False

     [INFO ]       ... Block protection 2 .............. : True

     [INFO ]       ... Block protection 3 .............. : False

     [INFO ]       ... Erase error occurred ............ : True

     [INFO ]       ... Programming error occurred ...... : False

     [INFO ]       ... Status register Write Disable ... : True

This happens even after I have done a hard-reset prior to loading my program. After doing any operation (typically erase or write), the next status code is "0xFF"

I based my QSPI driver on the bundled MQX example and the MQX IO User Guide. My status read function is in the following manner:

     Build flash command: QuadSPI_READ_STATUS1, QuadSPI_READ_DATA(QuadSPI_SINGLE_PAD, 1), QuadSPI_LOOKUP_STOP

     Write command

     Read 1 byte

Does anyone have any input on this?

Labels (4)
0 Kudos
Reply
1 Solution
715 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

According to your original question I know you already checked the MQX I/O User Guide, but there you can find  that the extra byte is needed becuase you are reading only one byte:

fwrite Usage

fwrite provides two functionalities: sending command to the external flash and programing the external flash. The format of fwrite is:

          fwrite: Commands + Write Buffer Address + Write/Read Bytes (optional)

Sending a command to the flash:

          ioctl(qspifd, QuadSPI_IOCTL_SET_FLASH_ADDR, &addr); (optional)

          fwrite: Commands + Write Buffer Address (NULL)

Programing data to the flash:

          ioctl(qspifd, QuadSPI_IOCTL_SET_FLASH_ADDR, &addr);

          fwrite: Commands + Write Buffer Address + Write Bytes

Sending a read command to the flash

          ioctl(qspifd, QuadSPI_IOCTL_SET_FLASH_ADDR, &addr);

          fwrite: Commands + Write Buffer Address(NULL) + Read Bytes

/Alejandro

View solution in original post

4 Replies
715 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I just tested the qspi example found in the MQX installation folder and I am not facing that behavior.

Have you tried that example? Also I wonder if have tried to erase the entire memory first.

/Alejandro

0 Kudos
Reply
715 Views
tfe
Contributor V

Seems I removed what I considered a "mistake" in the example. The transmit buffer in the function "int32_t memory_read_status1(MQX_FILE_PTR qspifd, uint8_t *status)" is initialized

   uint8_t buffer[6 + QuadSPI_ADDR_BYTES] = {0};

But during write, fwrite seems to get one byte too many:

   result = fwrite(buffer, 1, 6 + QuadSPI_ADDR_BYTES + 1, qspifd);

When I did the same thing, the status request succeeded. How come this is necessary?

0 Kudos
Reply
716 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

According to your original question I know you already checked the MQX I/O User Guide, but there you can find  that the extra byte is needed becuase you are reading only one byte:

fwrite Usage

fwrite provides two functionalities: sending command to the external flash and programing the external flash. The format of fwrite is:

          fwrite: Commands + Write Buffer Address + Write/Read Bytes (optional)

Sending a command to the flash:

          ioctl(qspifd, QuadSPI_IOCTL_SET_FLASH_ADDR, &addr); (optional)

          fwrite: Commands + Write Buffer Address (NULL)

Programing data to the flash:

          ioctl(qspifd, QuadSPI_IOCTL_SET_FLASH_ADDR, &addr);

          fwrite: Commands + Write Buffer Address + Write Bytes

Sending a read command to the flash

          ioctl(qspifd, QuadSPI_IOCTL_SET_FLASH_ADDR, &addr);

          fwrite: Commands + Write Buffer Address(NULL) + Read Bytes

/Alejandro

715 Views
tfe
Contributor V

Thanks.

0 Kudos
Reply