cancel
Showing results for 
Search instead for 
Did you mean: 

Why the STM32L4A6VGT HAL_QSPI_Receive() miss FLAGS or return TIMEOUT error if USB MSD is configured?

Fabsch
Associate II

Hello,

I have a problem with with the HAL_QSPI_Receive() function:

If I configure USB MSD on the device the code bellow does not work anymore. The code stops with an error at i = 64. Code work for exact 64 iterations. If I don't configure the USB-MassStorageDevice code the below code works fine.

Feels like an Interrupt could make the qspi routine miss some flags?

The error occures in the HAL_QSPI_Receive() -> QSPI_WaitFlagStateUntilTimeout() function . 

Error returened is a TIMEOUT error. 

So the Flags are not catched anymore or no data is recieved. After error hqspi->Instance.SR register has the value 0x05.

In the real application I don't read 8 byte in a for loop in a 4096 byte array. I know i can read 4096 byte in one shot.

uint8_t memData[4096] = {0};
mem_address address = { .val = 0 };
for(uint16_t i = 0; i < 200; i++){
flash_err err = 0;
err = IS25mem_readData(&memData[i*8], address, 8);
if(err != MEM_OK){
printf("ERROR READ FLASH %x\n", err);
}
address.val += 8;
}

Has anybody an idea why this happend? Or how I can prevent the QSPI miss the flags ?

1 REPLY 1
Fabsch
Associate II

[Solved]

After setting up the USB-MSD driver I have to reset the memory so they together

as desired.