2021-06-08 01:10 PM
I have full IwIP functionality inside a RTOS task due to this knowledge article:
How to create project for STM32H7 with Ethernet and LwIP stack working
I am able to erase, write, and read the QSPI flash using a BSP_QSPI test function inside main. This causes the IwIP stack to not initialize though. When l relocated the BSP_QSPI test function, to inside the default task, it caused both to stop working. I tried options of separating them into different tasks, changed task priorities, enabled QUADSPI global interrupt and increased heap/stack to no avail.
Hopefully it is just a silly solution l am overlooking.
BSP_QSPI test function:
void qspi_test(){
uint32_t address = 0;
char * writeData = "My Time NEO!";
char data[50] = {};
// Erase sector
BSP_QSPI_EraseBlock(0, address, MT25TL01G_ERASE_4K);
// Write data
BSP_QSPI_Write(0, (uint8_t*)writeData, address, 4096);
// Read data
BSP_QSPI_Read(0, (uint8_t*)data, address, 4096);
printf("QSPI Device: %s\r\n", data);
}
BSP_QSPI Configuration:
BSP_QSPI_Init_t init;
init.InterfaceMode = MT25TL01G_SPI_MODE;
init.TransferRate = MT25TL01G_STR_TRANSFER;
init.DualFlashMode = MT25TL01G_DUALFLASH_DISABLE;
if (BSP_QSPI_Init(0, &init) != BSP_ERROR_NONE)
{
Error_Handler();
}
Task:
void IwIP_init(void *argument)
{
/* init code for LWIP */
MX_LWIP_Init();
/* USER CODE BEGIN 5 */
/* Test erase, write, and read of QSPI module */
qspi_test();
/* Infinite loop */
for(;;)
{
osDelay(1);
}
/* USER CODE END 5 */
}
Solved! Go to Solution.
2021-06-09 11:05 AM
I figured out that changing my BSP_QSPI configuration to QPI_Mode, and Dual_Transfer resolved the issue.
2021-06-08 02:57 PM
You're going to need to refine "not working" a tad.
Debugging indicates what?
Is it Hard Faulting? Do you have a useful routine reporting machine state?
Do you have sections of code expecting the QSPI to be memory mapped?
2021-06-08 04:48 PM
Debugging is being caught in the Invalidate D-Cache section of code. It only seems to happen when stepping through it.
It is not hard faulting, and there are no errors being thrown when compiling. Both work fine independently but not together.
I'm using the Micron QSPI Nor chip which is memory mapped.
2021-06-08 07:20 PM
Ok, so how is the switching between direct and memory mapping handled? Do you arbitrate usage? Does one of the tasks doing writing to this memory?
Reading 4096 bytes into a 50 byte array is going to be a problem.
You should use invalidate with caution, ideally use the "by address" version to limit side effects.
2021-06-08 07:47 PM
I am using the default indirect mode configured by the BSP, and don't think memory map mode is being used.
I originally had the QSPI test function inside the main, but that caused MX_LWIP_Init() to not initiate inside the default task.
The QSPI test function was moved to it's own task and then neither tasks worked.
I'll look into array issue to see if that is the root cause thank you.
The invalidate D-Cache was generated by the CubeIde. I'm hesitant to modify since l'm not experienced with it.
2021-06-09 11:05 AM
I figured out that changing my BSP_QSPI configuration to QPI_Mode, and Dual_Transfer resolved the issue.