<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic C++ - LWIP+FreeRTOS - Unable to create more threads in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/C-LWIP-FreeRTOS-Unable-to-create-more-threads/m-p/1765664#M216546</link>
    <description>&lt;P&gt;Hi fellas,&lt;/P&gt;&lt;P&gt;I've created a sample c++ project - with lwip+freeRTOS - for two threads. It works fine as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252110iEF88DC438BEF6404/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tried to add 3rd thread - the build was successful - yet the none of the threads are being scheduled.&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252113iCD092BC314CC22C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be very specific, the 3rd task creation itself failed. Hence, I think scheduler is not even called. Why it happens so?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The threads are as follows,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;void delay(){
    volatile static int i,j;
    for (i=0;i&amp;lt;10000;i++)
        for (j=0;j&amp;lt;10000;j++);
}

void ledOn(void){
	GPIO_WritePinOutput(GPIO1,9,0);
    PRINTF("LED turned on\r\n");
}

void ledOFF(void){
	GPIO_WritePinOutput(GPIO1,9,1);
    PRINTF("LED turned off\r\n");
}

static void BLINKY(void * arg){
while(1){
	ledOn();
	delay();
	ledOFF();
	delay();
	taskYIELD();
}
}

static void SERIALL(void * arg){
   while(1){
	PRINTF("inside Serial loop");
	delay();
    PRINTF(".");
	delay();
    PRINTF(".\r\n");
	taskYIELD();
   }
}

static void testIoT(void * arg){
   while(1){
	PRINTF("inside iot loop");
	delay();
    PRINTF(".");
	delay();
    PRINTF(".\r\n");
	taskYIELD();
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Nov 2023 11:38:48 GMT</pubDate>
    <dc:creator>GanesanGuru</dc:creator>
    <dc:date>2023-11-29T11:38:48Z</dc:date>
    <item>
      <title>C++ - LWIP+FreeRTOS - Unable to create more threads</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/C-LWIP-FreeRTOS-Unable-to-create-more-threads/m-p/1765664#M216546</link>
      <description>&lt;P&gt;Hi fellas,&lt;/P&gt;&lt;P&gt;I've created a sample c++ project - with lwip+freeRTOS - for two threads. It works fine as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252110iEF88DC438BEF6404/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tried to add 3rd thread - the build was successful - yet the none of the threads are being scheduled.&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/252113iCD092BC314CC22C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be very specific, the 3rd task creation itself failed. Hence, I think scheduler is not even called. Why it happens so?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The threads are as follows,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;void delay(){
    volatile static int i,j;
    for (i=0;i&amp;lt;10000;i++)
        for (j=0;j&amp;lt;10000;j++);
}

void ledOn(void){
	GPIO_WritePinOutput(GPIO1,9,0);
    PRINTF("LED turned on\r\n");
}

void ledOFF(void){
	GPIO_WritePinOutput(GPIO1,9,1);
    PRINTF("LED turned off\r\n");
}

static void BLINKY(void * arg){
while(1){
	ledOn();
	delay();
	ledOFF();
	delay();
	taskYIELD();
}
}

static void SERIALL(void * arg){
   while(1){
	PRINTF("inside Serial loop");
	delay();
    PRINTF(".");
	delay();
    PRINTF(".\r\n");
	taskYIELD();
   }
}

static void testIoT(void * arg){
   while(1){
	PRINTF("inside iot loop");
	delay();
    PRINTF(".");
	delay();
    PRINTF(".\r\n");
	taskYIELD();
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 11:38:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/C-LWIP-FreeRTOS-Unable-to-create-more-threads/m-p/1765664#M216546</guid>
      <dc:creator>GanesanGuru</dc:creator>
      <dc:date>2023-11-29T11:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: C++ - LWIP+FreeRTOS - Unable to create more threads</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/C-LWIP-FreeRTOS-Unable-to-create-more-threads/m-p/1768449#M216823</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;I hope you are well.&lt;/P&gt;
&lt;P&gt;Is the same issue present if you increase the stack size for the task? Which status is returning sys_thread_new()?&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Omar&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 18:31:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/C-LWIP-FreeRTOS-Unable-to-create-more-threads/m-p/1768449#M216823</guid>
      <dc:creator>Omar_Anguiano</dc:creator>
      <dc:date>2023-12-04T18:31:22Z</dc:date>
    </item>
  </channel>
</rss>

