cancel
Showing results for 
Search instead for 
Did you mean: 

QSPI of STM32L496A

Vsv.1
Associate II

Hi I have interfaced STM32L4 qspi with Winbond(W25N01GV). I am using HAL api's. The problem is erase/write to a page(2KB) address(say 0x0) repeats to the page after 512 KB(Say 0x80000) and so on.

This is a 128 MiB NAND flash and erase command(D8h) only available for erasing 128KiB block. But what I experienced like it is erasing 2KiB.

I will put my initialization below. I dig so much time on it to find where I goes wrong,

 hqspi.Instance = QUADSPI;

 hqspi.Init.ClockPrescaler = 2;

 hqspi.Init.FifoThreshold = 4;

 hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;

 hqspi.Init.FlashSize = 26;

 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;

 if (HAL_QSPI_Init(&hqspi) != HAL_OK)

 {

  Error_Handler();

 }

24 REPLIES 24

@Community member​ . Yes, It will be like that for where ever the page address comes to play , ryt?. I have now modified it as what Dave suggested(command instruction and address as data transmit). Will check with 24b addressing as you said (so not needed dummy and data)

Hi @Vsv.1​!

I think it is a problem with the addresses you are using.

I create the page address as follows:

uint8_t block_add[2];
uint32_t addr = (block << 6) | page;
block_add[0] = (uint8_t) (addr >> 8);
block_add[1] = (uint8_t) addr ;

Moreover, I don't understand the calculation you do of the column address. I alwais use the column address 0x0 because you have to write the whole page. So I think it doesn't make much sense to put an address other than 0x0 (unless you fill the data buffer little by little and, at the end, you perform the "program execute" instruction).

Hi @David Garcia​ . Even if we calculate the address separately(block, page and then shifting block to 6 right) or dividing with page size(address/2048(page size)) , will calculate same Value, ryt?.

i.e. for Block 1 page 1 real address is 0x20800. (block 1<<6 | 1 = 0x41) and if you divide (0x20800/0x800 = 0x41). Then adding this to the byte field as we transmit it as a data is required.

( Note: I checked for address '0' , block 0, column 0, so until block is 1, this should never affect. But this fails at start now)

I calculate column address because I require to write up to the middle of a page and continuous from there chunk by chunk writing. But When When I read I will read it page by page from buffer.

Ahmet Yasin CİVAN
Associate III

is this problem solved?

Same question also! Did you find any clues? I have posted a new question https://community.st.com/s/question/0D53W00001JBS3aSAH/stm32h750bxqspi-issue-with-w25n01gvzeig-nand-flash-driver