cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L452 QUAD SPI - wrong address on bus

Alex Mach
Associate III
Posted on January 16, 2018 at 11:32

Hello,

I use STM32L452 QUAd SPI for communicate with Winbond w25n01g NAND Flash.

My init code is

page = 0x30;

  /* Initialize the read command */

  sCommand.InstructionMode   = QSPI_INSTRUCTION_1_LINE;

  sCommand.Instruction       = PAGE_DATA_READ_CMD;

  sCommand.AddressMode       = QSPI_ADDRESS_1_LINES;

  sCommand.AddressSize       = QSPI_ADDRESS_16_BITS;

  sCommand.Address           = page;

  sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;

  sCommand.DataMode          = QSPI_DATA_NONE;

  sCommand.DummyCycles       = 8;

  sCommand.DdrMode           = QSPI_DDR_MODE_DISABLE;

  sCommand.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;

  sCommand.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;

  

  /* Configure the command */

  if (HAL_QSPI_Command(&QSPIHandle, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)

  {

    return QSPI_ERROR;

  }

but on bus I see the address byte 0x30  is hi byte of 16-bit address and lo byte is 0xFF. So, how can I fix this?

Thanks,

Alex
1 REPLY 1
whereverimwalking
Associate

According to the ST's documentation (AN4760: Quad-SPI (QSPI) interface on STM32 microcontrollers, p.13), dummy phase always goes after address phase. Therefore, what you are actually seeing is 0x00 and 0x30 of the address and then 0xFF of the 8 dummy cycles.

For the w25n01g's commands that need address and dummy phases swapped I simply widened the address field from 2 bytes to 3 so w25n01g would interpret the first received address byte (MSB) as 8 dummy cycles.

ST's phases:

0690X000006C29TQAS.png

Example w25n01g's command phases:

0690X000006C29dQAC.png