wifi task on core0 influences precessing speed of core1 tasks

doglike
Posts: 63
Joined: Fri Aug 18, 2017 4:21 pm

wifi task on core0 influences precessing speed of core1 tasks

Postby doglike » Tue Oct 13, 2020 9:29 am

Hi,

I have following situation (see comment in code section).
Anybody an idea, why the processing of a http-request from a client (wifi_handler on core0) influences the task processing speed on core1 ?
I thought the cores are working independently...
Or is SPI the problem here?

I have to stop the wifi_AP, when the condition of loop task become TRUE, because of very high priority of loop.
If the condition become FALSE, then I restart wifi_AP.
The client has to reconnect everytime (very often) and that really suXX... I want to keep wifi on all the time.

Big thanks in advance! :)



Code: Select all


// Arduino Lib; using VSPI; SPI running @ 5MHz
my_vspi = new SPIClass(VSPI);	



void setup(void)
{
	xTaskCreatePinnedToCore (Wifi, "Wifi", 4096, NULL, 1, &xTaskHandle_Wifi, 0);
	xTaskCreatePinnedToCore (loop, "loop", 4096, NULL, 1, &xTaskHandle_loop, 1);
}


void IRAM_ATTR loop (void *arg)	
{
	while(1) 
	{
	   if (conditions == TRUE)
	   {
		/*  	Code:
		 *  	74HC595 shiftout register is attached to VSPI
		 * 	1. switch 74HC595 pin1 to HIGH
		 *	2. stay HIGH for 500us (not using vTaskDelay, not pausing the task!)
		 *	3. switch 74HC595 pin1 to LOW
		 *	4. stay LOW for 500us (not using vTaskDelay, not pausing the task!)
		 *  -----> 	Works perfectly and very precisely, measured with DSO, 
		 *		AS LONG AS nobody is requesting something from the wifi server 
		 *		(client can stay connected and doing nothing).
		 *  ----->	If client requests something (http-request),
		 *		then the 500us are not more precise and gets extended (600-700-800...1000us...), 
		 *		until the request is completely processed.
		 */
	     }
	}
}


void wifi_start(void);
void wifi_stop(void);
void wifi_handleClientRequest(void);


void Wifi (void *arg)					
{	 		
	while(1) 
	{ 
	  	// some logic...:  if conditions==TRUE, then stop wifi_ap and restart it, when conditions==FALSE
		wifi_handleClientRequest();   //wifi ap
	}
}


doglike
Posts: 63
Joined: Fri Aug 18, 2017 4:21 pm

Re: wifi task on core0 influences processing speed of core1 tasks

Postby doglike » Wed Oct 14, 2020 1:53 pm

Nobody an idea? :(
Or is this the normal behaviour and there is nothing to do...?

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: wifi task on core0 influences precessing speed of core1 tasks

Postby PeterR » Wed Oct 14, 2020 11:00 pm

Wifi/BT sucks IRAM.
Couple of years ago I was told that Wifi can now execute outside of IRAM (which is great as before you were otherwise stuffed through lack of IRAM) but now might introduces performance issue.
So maybe u max IRAM & then hit PSRAM issues.
So there are ways in which 'independent cores' might not be that independent i.e. dependency on RAM or other bus activity.
I keep meaning to look at ESP32 buses & performance (seems a lot less that an M4) but being chassed on deliveries have to put that indulgence in my backlog.
In the old days the supplier might have a technical note on the details & how to manage....
PS possible unfair as the M4s crew don't but then they seem to have a few more buses & a lot more bandwith?

Code: Select all

make size
make size-components
EDIT: I am not arduino literate but a cooperative loop does depend on components being 'cooperative'. Perhaps its much easier than I make out & you just need to move to preemptive tasking (IDF).
The examples are good so a show case should not take long.
& I also believe that IDF CAN should be fixed.

doglike
Posts: 63
Joined: Fri Aug 18, 2017 4:21 pm

Re: wifi task on core0 influences precessing speed of core1 tasks

Postby doglike » Tue Oct 20, 2020 11:45 am

Hi,
thanks for your reply.
I read your post several times (hard to understand)...
Do you mean, that it could help to kick out all wifi related functions out of IRAM ?
Any idea, how I could realize this?
Thanks in advance!

Who is online

Users browsing this forum: Bing [Bot], mtraven, netfox and 105 guests