cancel
Showing results for 
Search instead for 
Did you mean: 

Created a thread but not getting any log of the thread subroutine in console

Asama.11
Associate

Hi All,

I am new to ST.

I am trying to create a thread in STM32L4 - discovery board from my main process. I am getting a non-NULL handle from the thread which means the thread is created successfully. However, I don't see any log from the thread in the console.

Can someone please help me understand what am I missing ?

I am providing my code details below

regards,

-----------------------------------------

//Thread definition :

void threadCtx (void *argument);

osThreadDef(notification, threadCtx, osPriorityNormal, 1, 128);

void threadCtx (void *argument)

{

  printf("\n Inside thread .....\n");

  while (1)

  {

   // do something

 }

printf("\n exiting thread .....\n");

}

//thread creation :

osThreadId threadStatus = NULL;

threadStatus = osThreadCreate (osThread(notification), NULL);

if ( NULL != threadStatus )

{

     printf ("thread created successfully..........threadStatus = %p\r\n", threadStatus);

 }

 else

{

     printf(" ERROR : thread creation failed \r\n");

}

mainCtx();

osKernelStart();

Console output :

.

.

thread created successfully..........threadStatus = 0x66284943

.

prints from mainCtx

.

.

.

.

NO prints from threadCtx () ---> why ?

1 REPLY 1
Asama.11
Associate

Hi All,

I investigated further and found that in the above code , the call osThreadCreate() is returning the ID of the main process.

I mean when I use the API osThreadGetId() in the main function, it returns the same thread ID as osThreadCreate() - so osThreadCreate() is not creating any separate thread - to me which is very strange.

Can someone please help me know how can i create a thread in this platform ?

Any clue or any old link from this forum discussing the same would greatly help.

thanks in advance