2025-05-06 4:46 PM
Hello,
I am attempting to set up QSPI to operate in classic SPI mode so that I can transmit data to another STM32 processor. I have set up my code as followed and have connected my QSPI lines to an oscilloscope and a half duplex SPI slave on the same board for testing. I am unable to see any signals being sent over the QSPI lines. Have I setup my QSPI_CommandTypeDef incorrectly or am I missing necessary HAL commands?
QSPI_HandleTypeDef hqspi;
SPI_HandleTypeDef hspi1;
uint8_t test_data = 6;
uint8_t hold;
QSPI_CommandTypeDef cmd = {
.Instruction = QSPI_INSTRUCTION_NONE,
.InstructionMode = QSPI_INSTRUCTION_1_LINE,
.DummyCycles = 0,
.Address = QSPI_ADDRESS_NONE,
.AddressMode = QSPI_ADDRESS_1_LINE,
.AddressSize = QSPI_ADDRESS_24_BITS,
.AlternateByteMode = QSPI_ALTERNATE_BYTES_1_LINE,
.DataMode = QSPI_DATA_1_LINE,
.NbData = 0,
};
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_QUADSPI_Init(void);
static void MX_SPI1_Init(void);
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_QUADSPI_Init();
MX_SPI1_Init();
while (1)
{
HAL_QSPI_Command(&hqspi, &cmd, 100);
HAL_QSPI_Transmit(&hqspi, &test_data, 100);
HAL_Delay(100);
HAL_SPI_Receive(&hspi1, &hold, 1, 100);
}
}
2025-05-06 5:44 PM
Perhaps focus on the QSPI first.
Check the code initializing the pins.
Reflect on setting the data length correctly in NbData
Perhaps look at QSPI examples in the Cube F4 repo for send commands to a NOR FLASH, confirm you can see/capture that transaction on your scope/analyzer