Closed arnebdr closed 2 weeks ago
@arnebdr your patch fixing the error for winbond NOR flash, should not affect other NOR flash. this has to be tested on stm32 disco boards with octo spi bus.
Note that The winbond NOR flash is W25Q512 is not octo but quad NOR spi flash. On the stm32U5 you probably have a configuration of the octospi peripheral in quad mode
That configuration might require customization in the ospi driver : by default the octal-spi mode is selected and IO[0-7] are used for transfer.
spi-bus-width = <OSPI_QUAD_MODE>;
The 4bytes address mode is already enabled on the stm32 qspi driver by qspi_program_addr_4b() function with a particular check on the JESD216, the bit0 of dw16.enter_4ba portion :
/*
* According to JESD216, the bit0 of dw16.enter_4ba
* portion of flash description register 16 indicates
* if it is enough to use 0xB7 instruction without
* write enable to switch to 4 bytes addressing mode.
* If bit 1 is set, a write enable is needed.
*/
I wonder if a similar test is relevant in the stm32 ospi driver, because with a simple stm32_ospi_enter_fourbyte_address_mode(), the samples/drivers/spi_flash fails on the b_u585i_iot02a (octospi config)
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.
Describe the bug QSPI Flash Winbond W25Q512 connected to STM32U5 is not working correctly. The Flash test fails and the bytes written are misaligned.
To Reproduce Steps to reproduce the behavior: Use a board with STM32 controller that has an octo spi port and connect the Flash in QSPI mode (Only CLK, CS, D0...D3 used of Octo SPI port).
Expected behavior Flash Test passes, data written is identical to data read.
Impact Showstopper, Flash device not usable
Logs and console output Log Output:
Environment (please complete the following information):
Solution I have traced this down to flash_stm32_ospi.c It uses 4 Byte Address mode for this flash (which is correct), but misses to send the "Enter 4-Byte Address Mode" Command to the Flash. By default this Flash chip starts in 3 Byte Address mode, which causes the data misalignment. With this patch the flash is working correctly, but I don't know if this is ok/required for all QSPI flash types: 0001-Patch-for-4-Byte-Address-activation-on-Winbond-Flash.patch
Log Output with patch above: