2024-05-31 02:14 AM - edited 2024-05-31 02:16 AM
I am trying to use second half of OCTOSPI pins in single memory mode by setting MSEL bit for QUAD SPI communication with Flash memory. Even though i set the MSEL bit to send the data through 7 to 4 pins, still data is going through the 3 to 0 pin only. Am i missing something in configuration? Please see the below code for your reference.
uint8_t
XSPI_WriteEnable_IO_7_4(void) {
XSPI_RegularCmdTypeDef sCommand;
XSPI_AutoPollingTypeDef sConfig;
/* Enable write operations ------------------------------------------ */
sCommand.OperationType = HAL_XSPI_OPTYPE_COMMON_CFG;
sCommand.IOSelect = HAL_XSPI_SELECT_IO_7_4;
sCommand.Instruction = WRITE_ENABLE_CMD;
sCommand.InstructionMode = HAL_XSPI_INSTRUCTION_1_LINE;
sCommand.InstructionWidth = HAL_XSPI_INSTRUCTION_8_BITS;
sCommand.InstructionDTRMode = HAL_XSPI_INSTRUCTION_DTR_DISABLE;
sCommand.Address = HAL_XSPI_ADDRESS_NONE;
sCommand.AddressMode = HAL_XSPI_ADDRESS_NONE;
sCommand.AddressWidth = HAL_XSPI_ADDRESS_24_BITS;
sCommand.AddressDTRMode = HAL_XSPI_ADDRESS_DTR_DISABLE;
sCommand.AlternateBytes = 0;
sCommand.AlternateBytesMode = HAL_XSPI_ALT_BYTES_NONE;
sCommand.AlternateBytesWidth = HAL_XSPI_ALT_BYTES_8_BITS;
sCommand.AlternateBytesDTRMode = HAL_XSPI_ALT_BYTES_DTR_DISABLE;
sCommand.DataMode = HAL_XSPI_DATA_NONE;
sCommand.DataLength = 0;
sCommand.DataDTRMode = HAL_XSPI_DATA_DTR_DISABLE;
sCommand.DummyCycles = 0;
sCommand.DQSMode = HAL_XSPI_DQS_DISABLE;
sCommand.SIOOMode = HAL_XSPI_SIOO_INST_EVERY_CMD;
if (HAL_XSPI_Command(&hospi1, &sCommand, HAL_MAX_DELAY) != HAL_OK) {
return HAL_ERROR;
}
return HAL_OK;
}
/* OCTOSPI1 init function */
void MX_OCTOSPI1_Init(void)
{
/* USER CODE BEGIN OCTOSPI1_Init 0 */
/* USER CODE END OCTOSPI1_Init 0 */
/* USER CODE BEGIN OCTOSPI1_Init 1 */
/* USER CODE END OCTOSPI1_Init 1 */
hospi1.Instance = OCTOSPI1;
hospi1.Init.FifoThresholdByte = 1;
hospi1.Init.MemoryMode = HAL_XSPI_SINGLE_MEM;
hospi1.Init.MemoryType = HAL_XSPI_MEMTYPE_APMEM;
hospi1.Init.MemorySize = HAL_XSPI_SIZE_128MB;
hospi1.Init.ChipSelectHighTimeCycle = 1;
hospi1.Init.FreeRunningClock = HAL_XSPI_FREERUNCLK_DISABLE;
hospi1.Init.ClockMode = HAL_XSPI_CLOCK_MODE_0;
hospi1.Init.WrapSize = HAL_XSPI_WRAP_NOT_SUPPORTED;
hospi1.Init.ClockPrescaler = 32;
hospi1.Init.SampleShifting = HAL_XSPI_SAMPLE_SHIFT_NONE;
hospi1.Init.DelayHoldQuarterCycle = HAL_XSPI_DHQC_DISABLE;
hospi1.Init.ChipSelectBoundary = HAL_XSPI_BONDARYOF_NONE;
hospi1.Init.DelayBlockBypass = HAL_XSPI_DELAY_BLOCK_BYPASS;
hospi1.Init.Refresh = 0;
if (HAL_XSPI_Init(&hospi1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN OCTOSPI1_Init 2 */
/* USER CODE END OCTOSPI1_Init 2 */
}
Solved! Go to Solution.
2024-06-04 06:53 AM
Hello @Nagarajan ,
Thank you for updating post and glad to know the issue is solved :).
Could you please refer to the STM32H563 datasheet and precisely Table 63. Output timing characteristics (HSLV OFF)(1) and Table 64. Output timing characteristics (HSLV ON)(1) for speed configuration.
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.
2024-06-03 01:58 AM - edited 2024-06-03 01:59 AM
Hello @Nagarajan ,
Are you able to send data through the 3 to 0 pins only?
Is the MSEL bit set correctly in debug?
Which AP memory are you using?
Could you please check the OCTOSPI1 configuration?
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.
2024-06-03 02:55 AM
Are you able to send data through the 3 to 0 pins only?
Yes, Even though i chose IOSELECT 7 to 4 pins, data is going through the 3 to 0 pins.
Is the MSEL bit set correctly in debug?
This is the only place i am selecting the 7 to 4 pins.
sCommand.IOSelect = HAL_XSPI_SELECT_IO_7_4;
Which AP memory are you using?
I am using IS25LP128 Flash in ISSI brand which is not in the existing list of memory type. Is that memory type really important for data transfer?
Could you please check the OCTOSPI1 configuration?
Which part of OCTOSPI1 configuration should i check?
2024-06-04 05:34 AM
Hello @Nagarajan ,
The memory type has no impact in Quad-SPI mode.
Could you please check:
- Chip select high time (CSHT) defines the chip-select minimum high time in number of clock cycles, configured depending
on the memory datasheet.
- Sample shifting (SSHT) recommended to be enabled in STR mode and disabled in DTR mode.
- Delay hold quarter cycle (DHQC) enabled in DTR mode and disabled in STR mode.
Are you able to read the ID?
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.
2024-06-04 06:26 AM
I am not clear how its working now after changing the pin frequency configuration from Very high to Low. I changed like below and its started working.
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
I configured OCTOSPI clock as a 1MHz. Is it really considered as low frequency in QSPI communication?
2024-06-04 06:53 AM
Hello @Nagarajan ,
Thank you for updating post and glad to know the issue is solved :).
Could you please refer to the STM32H563 datasheet and precisely Table 63. Output timing characteristics (HSLV OFF)(1) and Table 64. Output timing characteristics (HSLV ON)(1) for speed configuration.
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.