2019-07-27 09:42 AM
Hi Experts,
I am using STM32L476G MPU, (which sensortile board) and used the following SDK & sensortile BLE example.
~\STSW-STLKT01_V1.3.1\Projects\SensorTile\Applications\BLE_SampleApp
Added FreeRTOS support for multithread in my BLE example.
~\STSW-STLKT01_V1.3.1\Middlewares\Third_Party\FreeRTOS\Source
Here is the code used to run two LED threads.
Code is not running if I enable both threads, but its running if I disable any of thread.
Can you please suggest what to do on this.
Increased the heap/stack size in .ld file and decreased size of stack for thread, but no luck.
static void LED_Thread2(void const *argument)
{
(void) argument;
for (;;)
{
STLBLE_PRINTF("LED_Thread2 LOOP\r\n");
osThreadResume(LEDThread1Handle);
osThreadSuspend(NULL);
}
}
static void LED_Thread1(void const *argument)
{
(void) argument;
for (;;)
{
STLBLE_PRINTF("LED_Thread1 LOOP\r\n");
osThreadSuspend(NULL);
osThreadResume(LEDThread2Handle);
}
}
/* Thread 1 definition */
osThreadDef(LED1, LED_Thread1, osPriorityNormal, 0, 32);
/* Thread 2 definition */
osThreadDef(LED2, LED_Thread2, osPriorityNormal, 0, 32);
/* Start thread 1 */
LEDThread1Handle = osThreadCreate(osThread(LED1), NULL);
/* Start thread 2 */
LEDThread2Handle = osThreadCreate(osThread(LED2), NULL);
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
for (;;);