cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L431KB can only read four bytes as indirect read mode and only if the address is all zeros

JSanz.1
Associate III

If I configure more than four bytes, the qspi do nothing, it also happens if I set as address any other value than zero.

I carefully read the application note 'AN4760' and it doesn't seem I'm doing anything wrong

s_command.InstructionMode  = QSPI_INSTRUCTION_1_LINE;

s_command.Instruction    = QUAD_INOUT_FAST_READ_CMD;

s_command.AddressMode    = QSPI_ADDRESS_4_LINES;

s_command.AddressSize    = QSPI_ADDRESS_24_BITS;

s_command.Address      = 0x000000; //address;

s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;

s_command.DataMode     = QSPI_DATA_4_LINES;

s_command.DummyCycles    = 6;

s_command.NbData      = 4; //length;

s_command.DdrMode      = QSPI_DDR_MODE_DISABLE;

s_command.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;

s_command.SIOOMode     = QSPI_SIOO_INST_EVERY_CMD;

The flash I'm using is 16 Mbyte 'W25Q128JV', it support all possible reading modes

Thanks in advance for your help

1 ACCEPTED SOLUTION

Accepted Solutions
JSanz.1
Associate III

I have found the problem in the QSPI initialization,

Thanks for your help

 hqspi.Instance = QUADSPI;

 hqspi.Init.ClockPrescaler = 255;

 hqspi.Init.FifoThreshold = 1;

 hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;

 hqspi.Init.FlashSize = 1; --> must be 0x18;

 hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;

 hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;

 hqspi.Init.FlashID = QSPI_FLASH_ID_1;

 hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;

View solution in original post

4 REPLIES 4

Prove out that 1-bit commands/addressing work, move to 2-bit.

Check you can read status, write to configuration/mode registers.

Make sure you're using the right command and mix of command, address and data bits, and that's consistent with how the QSPI is configured.

Then move to 4-bit.

Use a logic analyzer to review bus traffic if you can't explain behaviour having moved through the prior steps.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JSanz.1
Associate III

Thanks for your early answer,

All seems to work, I been wrote '0xbebacafe' string into the first four flash bytes ok, and read the status ok, and move to on line as you suggest, it seems to do the same, only read four bytes at zero address if only read four bytes.

s_command.InstructionMode  = QSPI_INSTRUCTION_1_LINE;

s_command.Instruction    = READ_CMD;

s_command.AddressMode    = QSPI_ADDRESS_1_LINE;

s_command.AddressSize    = QSPI_ADDRESS_24_BITS;

s_command.Address      = 0x000000;//address;

s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;

s_command.DataMode     = QSPI_DATA_1_LINE;

s_command.DummyCycles    = 0;

s_command.NbData      = 4;//length;

s_command.DdrMode      = QSPI_DDR_MODE_DISABLE;

s_command.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;

s_command.SIOOMode     = QSPI_SIOO_INST_EVERY_CMD;

0693W000003BDkQQAW.bmp

I joined a plot of initialize function, it looks like everithing is ok, there are signals in all wires

JSanz.1
Associate III

I have found the problem in the QSPI initialization,

Thanks for your help

 hqspi.Instance = QUADSPI;

 hqspi.Init.ClockPrescaler = 255;

 hqspi.Init.FifoThreshold = 1;

 hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;

 hqspi.Init.FlashSize = 1; --> must be 0x18;

 hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;

 hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;

 hqspi.Init.FlashID = QSPI_FLASH_ID_1;

 hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;

Glad you were able to find this.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..