cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H5 XSPI Not Setting TC Flag

chadcoonsGB
Associate

Hello,

I am using the STM32H563RGT6. I am using the OCTOSPI peripheral to connect a quad spi connection a flash chip. I can successfully read the status registers on the flash chip, send the write enable command, write an erase command to address 0x0, read status register 1 and wait for BUSY flag to clear, then send the write enable command again. However, when I go to erase the next block at addr 0x10000, and the HAL_XSPI_FLAG_TC never gets set in the HAL_XSPI_Command function.

All of the write commands to this point use the following regular command settings:

XSPI_RegularCmdTypeDef sCommand = { 0 };
sCommand.OperationType = HAL_XSPI_OPTYPE_COMMON_CFG;
sCommand.IOSelect = HAL_XSPI_SELECT_IO_3_0;
sCommand.Instruction = cmd;
sCommand.InstructionMode = HAL_XSPI_INSTRUCTION_1_LINE;
sCommand.InstructionWidth = HAL_XSPI_INSTRUCTION_8_BITS;
sCommand.InstructionDTRMode = HAL_XSPI_INSTRUCTION_DTR_DISABLE;
sCommand.Address = addr;
sCommand.AddressMode = HAL_XSPI_ADDRESS_1_LINE;
sCommand.AddressWidth = HAL_XSPI_ADDRESS_24_BITS;
sCommand.DataMode = HAL_XSPI_DATA_NONE;
sCommand.DataLength = 0;
sCommand.DummyCycles = num_dummy_cycles;
sCommand.DQSMode = HAL_XSPI_DQS_DISABLE;
sCommand.SIOOMode = HAL_XSPI_SIOO_INST_ONLY_FIRST_CMD;

 The command that returns a HAL_TIMEOUT (set to 5s for testing), is configured with Instruction mode, 24 bit address, and no data mode. I don't understand why the TC register flag never gets set and I have no idea what else to try.

Any advice on what to try next?

Thanks,
Chad

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Kaouthar,

I solved the issue. There was no description in the Memory Size field for the OctoSPI Parameters, I left this as the default value during hardware bringup. Updating that field to match my flash chip fixed the issue.

I spent way too much time missing this detail due to the lack of documentation and unclear error response. It doesn't make sense to me why the driver wouldn't return a more succinct error code (something like invalid parameter to indicate the address being outside of the configured memory bounds) or really just an error instead of never setting the TC flag and waiting for a timeout. 

I also think a description of the field in CubeMX would have helped me solve this issue more quickly.

Thanks,

Chad

View solution in original post

2 REPLIES 2
KDJEM.1
ST Employee

Hello @chadcoonsGB and welcome to the Community;

 

Could you please give more details about the memory and the mode (memory mapped mode or indirect mode)you used?

May this example OSPI_NOR_MemoryMapped can help you.

 

Thank you.

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Kaouthar,

I solved the issue. There was no description in the Memory Size field for the OctoSPI Parameters, I left this as the default value during hardware bringup. Updating that field to match my flash chip fixed the issue.

I spent way too much time missing this detail due to the lack of documentation and unclear error response. It doesn't make sense to me why the driver wouldn't return a more succinct error code (something like invalid parameter to indicate the address being outside of the configured memory bounds) or really just an error instead of never setting the TC flag and waiting for a timeout. 

I also think a description of the field in CubeMX would have helped me solve this issue more quickly.

Thanks,

Chad