Did that. Thanks.
Here’s the setup code. the snapshot shows from the ST provided hardware inits. User code section 2 sets the board LEDS to identify the section. The QuadMode and MemMappedQuadMode modify the QSPI memory from SPI mode to QSPI mode and map it into the processor’s memory at 0x90000000. There’s also a section that checks and validates memory reads and writes. The section _PERCEPIO is the complete initialization of the trace system.
You can see that the osKernel is then initialized. CPP_LINK sets up the infrastructure and then calls the application setup, which initializes such things as displays, mesh networking and the like. It also sets up an application task.
So I may have set up the application wrongly.
MX_USART2_UART_Init();
MX_TIM2_Init();
MX_TIM4_Init();
MX_TIM7_Init();
MX_TIM1_Init();
/* USER CODE BEGIN 2 */
// USER CODE BEGIN 2
// turn off red, amber, green LEDS turn on Blue LEDS
// red off
#if (defined _LED) && (defined _DIRECT_LED) && (defined RED_LED_Pin)
if (RED_ON_HIGH)
{
HAL_GPIO_WritePin(RED_LED_GPIO_Port, RED_LED_Pin, GPIO_PIN_RESET);
}
else
{
HAL_GPIO_WritePin(RED_LED_GPIO_Port, RED_LED_Pin, GPIO_PIN_SET);
}
#endif
#if (defined _LED) && (defined _DIRECT_LED) && (defined BLUE_LED_Pin)
// blue on
if (BLUE_ON_HIGH)
{
HAL_GPIO_WritePin(BLUE_LED_GPIO_Port, BLUE_LED_Pin, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(BLUE_LED_GPIO_Port, BLUE_LED_Pin, GPIO_PIN_RESET);
}
#endif
#if (defined _LED) && (defined _DIRECT_LED) && (defined GREEN_LED_Pin)
// green off
if (GREEN_ON_HIGH)
{
HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_RESET);
}
else
{
HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_SET);
}
#endif
#if (defined _LED) && (defined _DIRECT_LED) && (defined AMBER_LED_Pin)
// amber off
if (AMBER_ON_HIGH)
{
HAL_GPIO_WritePin(AMBER_LED_GPIO_Port, AMBER_LED_Pin, GPIO_PIN_RESET);
}
else
{
HAL_GPIO_WritePin(AMBER_LED_GPIO_Port, AMBER_LED_Pin, GPIO_PIN_SET);
}
#endif
/* Enter Quad Mode 4-4-4 --------------------------------------------- */
EnterQuadMode();
/* Enable Memory mapped in Quad mode -------------------------------- */
EnableMemMappedQuadMode();
// while (1)
// {
address = 0;
/* Writing Sequence of 1Mbyte --------------------------------------- */
mem_addr = (__IO uint8_t *)(OCTOSPI1_BASE + address);
for (index2 = 0; index2 < EXTENDEDBUFFERSIZE/BUFFERSIZE; index2++)
/*Writing 1Mbyte (256Byte BUFFERSIZE x 4096 times) */
{
for (index1 = 0; index1 < BUFFERSIZE; index1++)
{
*(mem_addr) = aTxBuffer[index1];
mem_addr++;
}
}
/* Reading Sequence of 1Mbyte ---------------------------------------- */
mem_addr = (__IO uint8_t *)(OCTOSPI1_BASE + address);
for (index2 = 0; index2 < EXTENDEDBUFFERSIZE/BUFFERSIZE; index2++)
/*Reading 1Mbyte (256Byte BUFFERSIZE x 4096 times)*/
{
for (index1 = 0; index1 < BUFFERSIZE; index1++)
{
if (*(mem_addr) != aTxBuffer[index1])
{
/*can toggle led here*/
// turn on blue LED
#if (defined _LED) && (defined _DIRECT_LED) && (defined BLUE_LED_Pin)
if (BLUE_ON_HIGH)
{
HAL_GPIO_WritePin(RED_LED_GPIO_Port, RED_LED_Pin, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(RED_LED_GPIO_Port, RED_LED_Pin, GPIO_PIN_RESET);
}
#endif
Error_Handler();
}
mem_addr++;
}
}
/*can toggle led here*/
// turn off RED and Blue LEDS
// red off
#if (defined _LED) && (defined _DIRECT_LED) && (defined RED_LED_Pin)
if (RED_ON_HIGH)
{
HAL_GPIO_WritePin(RED_LED_GPIO_Port, RED_LED_Pin, GPIO_PIN_RESET);
}
else
{
HAL_GPIO_WritePin(RED_LED_GPIO_Port, RED_LED_Pin, GPIO_PIN_SET);
}
#endif
#if (defined _LED) && (defined _DIRECT_LED) && (defined BLUE_LED_Pin)
// blue on
if (BLUE_ON_HIGH)
{
HAL_GPIO_WritePin(BLUE_LED_GPIO_Port, BLUE_LED_Pin, GPIO_PIN_RESET);
}
else
{
HAL_GPIO_WritePin(BLUE_LED_GPIO_Port, BLUE_LED_Pin, GPIO_PIN_SET);
}
#endif
#if (defined _LED) && (defined _DIRECT_LED) && (defined GREEN_LED_Pin)
// green on
if (GREEN_ON_HIGH)
{
HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_RESET);
}
// vTaskDelay(100);
// // green off
// if (GREEN_ON_HIGH)
// {
// HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_RESET);
// }
// else
// {
// HAL_GPIO_WritePin(GREEN_LED_GPIO_Port, GREEN_LED_Pin, GPIO_PIN_SET);
// }
#endif
#if (defined _PERCEPIO)
xTraceSetBuffer( (RecorderDataType*) &trace_buffer[0]);
/*Initialise the trace recorder library*/
xTraceInitialize();
// trace_init();
if (xTraceEnable(TRC_START) != TRC_SUCCESS)
{
/* treat error */;
ERROR1(__FILE__, __LINE__, (char*)"Trace Start Error");
}
#ifdef _PERCEPIO_EVENT
Trace_Channel = xTraceRegisterString("EventChannel");
#endif
#endif
// #ifdef _CPP_LINK
// cpp_link();
// #endif
//#include "../INCLUDE FILES\USER_CODE_BEGIN_2.inc"
/* USER CODE END 2 */
/* Init scheduler */
osKernelInitialize();
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Create the thread(s) */
/* creation of defaultTask */
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
/* USER CODE BEGIN RTOS_THREADS */
#ifdef _CPP_LINK
cpp_link();
#endif
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_EVENTS */
/* add events, ... */
/* USER CODE END RTOS_EVENTS */
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}