Esp32 - getting to the core of the task

I posted the algorithm in @anon76350110's original thread in the other forum. I'll repeat it here:

A running task continues to run unless:

  1. It voluntarily blockes itself.
  2. A task of a higher priority becomes ready to run.
  3. Its tick time slice expires AND another task of equal priority is ready to run.

In the case of #3 above, if there are multiple tasks of equal priority that are ready to run, then task switching is handled in a Round Robin fashion.

3 Likes

Thank you for the information. I need time to understand through suitable experiments if I can design. In the meantime, I may come up with "data sharing between tasks using Notification" experiment.

I read somewhere that a task with higher priority level is given more service time (CPU cycles) than the task of lower priority level -- is it correct?

THIS:

3 Likes

It would be convenient for my understanding if you would answer "yes" or "no"!

What will happen if time slice expires and another task of lower priority is ready to run?

1 Like

I know you weren't , I was just mucking around and being a little comical
so as not to fall into the pit on insanity that is "Electronics Troubleshooting",
I feel like i should start another topic called

"Everything was Working Fine, i swear , Now nothing works" :stuck_out_tongue:

I was literally prepping to get a few things up and running

Starting Connecting LED Strips and DFRobot and i figured

  • A Quick test should do it , I know it'll be fine but let's confirm, even though i've tested
    this like 10 times in the past week

  • Then.......... "IT" HAPPENS !!
    2023-08-27 23_57_22-murphys law of electronics - Google Search

  • I'm Guilty of #5

Now let me explain it, There is a funny side to this
and there is a side

FOR BEGINNERS TO KNOW HOW TO SOLVE "Seemingly " UNSOLVABLE PROBLEMS

So there was a test project setup with 2 x WS2812B Strips, Last i know, they still work.
I hooked up my ESP32, I have a few of them, Some with USB-C Connectors others with mini USB the Type C Tend to Require CH340 Drivers and the mini USB tend to require CP2102

Side Topic
DATASHEETS
(For the benefit of others) I know you know this...)

This comes under the subject of USB to UART Controller Chips
Here is what a CP2102 and a CH340 Chip looks like
2023-08-28 00_14_17-CP2102 ESP32 - Google Search

CP2102-serial-communications-guide.pdf (710.7 KB)

CH340 DataSheet.pdf (243.9 KB)

it's an interesting and quick read for those that want to understand just a little bit more about

  • What the hell is a Driver
  • What the hell is CH340 and CP2102 Anyway
  • And why do i need a driver in the first place, why can't i just plug it in so it works.

Anyway....... that aside
I have several ESP32 Wroom32 Dev Boards and Several Arduino's MEGA, Nano and Uno

so I switch it on, the SD Card is all setup and loaded with files and............
it doesn't work

  • Checked the sketch, No problems there

  • Check the DFRobot Player, No initial obvious problems

  • Checked the LED's they seemed to work fine

  • Loaded a basic Blink Sketch to the ESP32's that worked fine
    Even added Serial Output to give verbose "ON" , "OFF" for inbuilt LED Blinking.

  • The ESP32's Seemed to work fine and work properly

the problem was occuring when i got to this point in the DFRobot Initialization

Now i have a DFRobot Test Sketch
Feel Free to use it
it's pretty straight forward and nothing to write home about
The sketch assumes no LED's are being used and only relies on
DFRobot, ESP32 and Serial output

/*/////////////////////////////////////////////////////////////////////////////////////////
 PROJECT INFORMATION
-----------------------------------------------------------------------------------------
 CREATED BY : B.T.O. Electronics
 DATE       : June 2022
 PROJECT    : DFRobot Player Mini Audio Test Platform
 VERSION    : ESP32 WRoom V2.2
 LAST EDIT  : 8th August 2023
*//////////////////////////////////////////////////////////////////////////////////////////

/*/////////////////////////////////////////////////////////////////////////////////////////
 WIRING INFORMATION
-------------------------------------------------------------------------------------------
 GPIO 16 - Tx (Transmit Line) 16
 GPIO 17 - Rx (Receive Line)  17
*//////////////////////////////////////////////////////////////////////////////////////////

/*//////////////////////////////////////////////////////////////////////////////////////////
 AUDIO FILE INFORMATION
-------------------------------------------------------------------------------------------
 0001 - Track 1.mp3
 0002 - Track 2.mps
 0003 - Track 3.mp3
 0004 - Track 4.mp3
 0005 - Track 5.mp3
 0006 - Track 6.mp3
 0007 - Track 7.mp3
*//////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// Libraries to include
//-----------------------------------------------------------------------------------------
#include "DFRobotDFPlayerMini.h" //Controls DFRobot MP3 Player (Audio)
#include "SoftwareSerial.h"      //Serial Communication Controller (EspSoftwareSerial)
///////////////////////////////////////////////////////////////////////////////////////////

/*/////////////////////////////////////////////////////////////////////////////////////////
 SERIAL DATA LINE SETUP (RX/TX)
*///-----------------------------------------------------------------------------------------
SoftwareSerial mySoftwareSerial(17, 16); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

void printDetail(uint8_t type, int value);
///////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
// BEGIN SETUP
///////////////////////////////////////////////////////////////////////////////////////////
void setup() 
{  // OPENS the void setup
int value; //Controls the Serial Print Values
/*/////////////////////////////////////////////////////////////////////////////////////////
 DF ROBOT MP3 PLAYER (AUDIO) SETUP
-------------------------------------------------------------------------------------------
 Baud Rate Setup
*///---------------------------------------------------------------------------------------
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);
/*//---------------------------------------------------------------------------------------
 Audio Initialization Sequence - Serial Monitor Output
*///---------------------------------------------------------------------------------------
  Serial.println();
  Serial.println(F("======================================================"));
  Serial.println(F("                  CREATED BY : "));
  Serial.println(F("              B.T.O. Electronics"));
  Serial.println(); 
  Serial.println(F("    PROJECT :  DFRobot Player Mini Audio Test Platform"));
  Serial.println(F("======================================================"));  
  Serial.println();
  Serial.println();
  Serial.println(F("======================================================"));
  Serial.println(F("    WELCOME     - DF ROBOT PLAYER STARTUP SEQUENCE"));
  Serial.println(F("======================================================"));
  Serial.println(F("    PLEASE WAIT - INITIALIZING DFROBOT PLAYER "));
  Serial.println(F("______________________________________________________"));
  Serial.println();
/*//---------------------------------------------------------------------------------------
 IF ERROR - Serial Monitor Output
*///---------------------------------------------------------------------------------------
  if (!myDFPlayer.begin(mySoftwareSerial)) 
  {
    Serial.println();
    Serial.println(F("======================================================"));
    Serial.println(F("    **** AN ERROR OCCURRED ****"));
    Serial.println(F("======================================================"));
    Serial.println(F("    ERROR - MP3 DID NOT START "));
    Serial.println(F("    ERROR - MP3 DEVICE IS NOT PRESENT"));
    Serial.println(F("    ERROR - SD CARD ISSUE"));
    Serial.println(F("______________________________________________________"));
    while (false);
  }
/*//---------------------------------------------------------------------------------------
 IF NO ERROR - Serial Monitor Output
*///---------------------------------------------------------------------------------------
  Serial.println(F("======================================================"));
  Serial.println(F("    AUDIO ONLINE - DFROBOT PLAYER STARTED SUCCESSFULLY"));
  Serial.println(F("======================================================"));
  Serial.println();  
  Serial.println(F("======================================================"));
  Serial.println(F("    - SETTING DEFAULT AUDIO DEVICE")); 
  myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);
  Serial.println(F("    - Default Device_SD --------> SET SUCCESSFULLY")); 
/*//---------------------------------------------------------------------------------------
 SET THE OVERALL SYSTEM VOLUME
*///---------------------------------------------------------------------------------------
  Serial.println(F("    - Setting System VOLUME Controls"));
  myDFPlayer.volume(25);  // Value = From 0 to 30
  Serial.println(F("    - Volume -------------------> SET SUCCESSFULLY"));
///////////////////////////////////////////////////////////////////////////////////////////  
  Serial.println(F("================================================================"));
  Serial.println(F("              READING SD CARD ATTRIBUTES"));
  Serial.println(F("================================================================")); 
  Serial.print(F("    - READ STATE = "));   
  Serial.print(myDFPlayer.readState()); //read mp3 state . Reading or Not Reading 
  value = myDFPlayer.readState();
  Serial.println(F(" (1 = Reading/ 0 = NOT Reading)"));
//-----------------------------------------------------------------------------------------     
  Serial.print(F("    - STORAGE VOLUME CAPACITY = "));  
  Serial.print(myDFPlayer.readVolume()); //read current volume capacity
  Serial.print(F(" MB"));
  Serial.println(F(""));
//-----------------------------------------------------------------------------------------  
//  Serial.print(F("    - EQ SETTINGS =  "));   
//  Serial.println(myDFPlayer.readEQ()); //read EQ setting
//-----------------------------------------------------------------------------------------
  Serial.print(F("    - READ FILE COUNTS "));
  Serial.println(myDFPlayer.readFileCounts()); //read all file counts in SD card //Produces 0
  value = myDFPlayer.readFileCounts(); //read all file counts in SD card
//-----------------------------------------------------------------------------------------  
  Serial.print(F("    - READ CURRENT FILE NUMBER "));
  Serial.println(myDFPlayer.readCurrentFileNumber()); //read current play file number
  value = myDFPlayer.readCurrentFileNumber();
//-----------------------------------------------------------------------------------------  
  Serial.print(F("    - readFileCountsInFolder"));
  Serial.println(myDFPlayer.readFileCountsInFolder(1)); //read file counts in folder SD:/03 PRODUCES ERROR
  Serial.println(F("================================================================")); 

  Serial.println(F("================================================================"));
  Serial.println(F("           BEGINNING SOUND AND LIGHT SEQUENCE"));
  Serial.println(F("================================================================")); 
  Serial.println(F("  - DETAILS :"));
  Serial.println("AUDIO ONLY - Started");  
///////////////////////////////////////////////////////////////////////////////////////////

/*/////////////////////////////////////////////////////////////////////////////////////////
 STARTUP -  AUDIO SEQUENCE
-------------------------------------------------------------------------------------------
 SUMMARY : MP3 (0003)
*///---------------------------------------------------------------------------------------
myDFPlayer.playMp3Folder(3); // Play MP3 File (0003)
//delay(3); 
Serial.println("AUDIO FILE: <0005>");
Serial.println("AUDIO ONLY - Completed");
//-----------------------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////////////////
}  //Closes the Void Setup

 
void loop()
{ //Opens the Void Loop
     
} //Closes the Void Loop

As you can see there really is not a lot to it .

  • I have included a few Diagnostics in there with Serial Verbose Output for the sake of ticking
    a few boxes to know everything started properly, the Steps are as follows....

THIS PART...
Proves nothing more that
Serial was setup, and if i have Visual Confirmation of this then i knew Serial.begin()115200; has started successfully
This is Step 1 - But still gives no indication of anything to do with the MP3 Player or SD Card
2023-08-28 00_55_36-Esp32 - getting to the core of the task - Community _ Bar Sport - Arduino Forum

Then there is a stage that most of the time never happesn because there is no problem,
it's the stage that says this...
If myDFPlayer has not begun (as signified by ! (NOT) m then print out the following Errors.
FYI, These Error Messages

  1. Were grabbed from the main website As Is and have not been attended to
    Even though i have every intention of making them more specific

  2. They DO NOT by any stretch Mean that the Device is not present
    Nor that the SD Card has an issue . they don't actually check anything.

BUT THIS ERROR MESSAGE DID SHOW UP
and stopped at this point.

/*//---------------------------------------------------------------------------------------
 IF ERROR - Serial Monitor Output
*///---------------------------------------------------------------------------------------
  if (!myDFPlayer.begin(mySoftwareSerial)) 
  {
    Serial.println();
    Serial.println(F("======================================================"));
    Serial.println(F("    **** AN ERROR OCCURRED ****"));
    Serial.println(F("======================================================"));
    Serial.println(F("    ERROR - MP3 DID NOT START "));
    Serial.println(F("    ERROR - MP3 DEVICE IS NOT PRESENT"));
    Serial.println(F("    ERROR - SD CARD ISSUE"));
    Serial.println(F("______________________________________________________"));
    while (false);
  }
/*//---------------------------------------------------------------------------------------

OK, so this is easy then

A TIP FOR BEGINNERS.....
When you encounter a seemingly Impossible problem

  • STAY CALM - This should always be a first step of confirmation as being stressed or upset
    or sad ABSOLUTELY AND GREATLY will hinder your ability to think efficiently.

  • REVERT TO FUNDAMENTAL KNOWLEDGE AND TEACHINGS -
    The Principle here is... When you learn something , Learn it well, Test it, Scrutinize it,
    then Test it again, then say Oh yeah but what about this and then test it again and again
    and over time keep challenging that knowledge . I have done this for some 40 years and
    I have found that when you do this it solidifies your "Foundational Knowledge"
    and as a result you are able to solve any problem .

    This forum conveniently is a great place to gain this foundational knowledge for beginners.

  • Side Note of HOW NOT TO APPROACH THIS....
    There will always be someone here who will say "That's not true, You're wrong, it's like this."

    Now if you take this personally YOU LEARN NOTHING.

    You see the point is.. YOU ARE SUPPOSED TO BE CHALLENGED ON WHAT YOU KNOW.
    that is literally the point of knowing what you know.
    If you want to learn something , But you don't want to be challenged, Expect to have many
    problem in life that won't be solved.

    You should approach this like this.....
    Say someone says "You're an idiot, that's stupid where the hell did you get that from"
    (granted this is an exaggerated example) but still valid because some people are like this,

    if you say ""what the hell is your problem why are you so rude" THAT'S WRONG
    if you say "I'm not wrong and i'll remind you to watch your tone" THAT'S WRONG

    Taking this personally is irrelevant , FOCUS ON YOUR GOAL (To solve the problem)
    Not to get into a heated debate.

so, Revert to your foundational knowledge , Get back to Basics, Go Step by Step

  • Lastly, i cannot stress how important it is to have a drink of water and healthy meal.
    Seriously.. I can't count how many times i've done this..

    You're stuck on a problem it's been hours, you're racking your brain and the solution won't come.
    ANSWER : Stop and take a 20min break,
    Have 1 or 2 Glasses of water or Juice
    Have a HEALTHY Meal or some fruit or something

You go back you sit down and wham, Magically the answer hits you.
I'ts because you gave you body and your brain what it needs to work efficiently

No Stress
Nutrients
Hydration

No back to it....... so i'm getting this error and you would think...

  • Have a quick look at the code - Code is good, No much to look at as it is

  • Check if i can play the mp3 files on my PC so i take out the SD Card test it in computer,
    it shows up normally in Disk Management and plays the files properly and the partition is
    FAT32 - all good

  • You check the wiring, The wiring seems fine

  • Ok so i change out a few other DFRobot Players , Brand New.
    Error still Happens

  • I Check the voltage Vcc and GND to the DFPlayer and i'm getting my 5V approx, all good

  • I checked the speaker outside of the circuit, the speakers works properly

  • So now the Tx and Rx are in Question.
    I Hook up my Scopes to the lines , Both Rx and Tx seem to be behaving Correctly
    and i can see Data packets being Transmitted

  • Checked that i didn't cross the Wiring of Rx and Tx (about 20 Times) Nope, Absolutely the right
    way around

  • Touched the Housing of the DFRobot Player with my finger to see if it's hot (indicating short circuit). No, No S.C. and besides if there was there wouldn't be the presence of 5V

  • Tried running the sketch a few more times and fiddled around with the wiring a bit
    and checked it some more..
    NOW HERE IS THE WEIRD PART....

it then progresses to this part

2023-08-28 01_25_44-Esp32 - getting to the core of the task - Community _ Bar Sport - Arduino Forum

so.... Great,, PROGRESS !
Or........ Not

See, to get to this section

  1. No Error must occur because The condition of the DFRobotplayer.begin must be True.
    if it's False (!) the Error would occur and not proceed.

  2. To get to this stage DFRobotplayer.begin must have returned TRUE and secondly

  3. It sets up the Device, If it didn't see the device and ` myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD); failed then the next line wouldn't
    have been printed to the serial monitor. but it was.

Not only that...

But this next stage which was specifically integrated into these diagnostics so i had evidence
of the SD Card being read , Not just the DFPlayer starting up and then Assuming the card is read
or having to wait for the Audio confirmation.

All the rest of this completes

Serial.println(F("================================================================"));
  Serial.println(F("              READING SD CARD ATTRIBUTES"));
  Serial.println(F("================================================================")); 
  Serial.print(F("    - READ STATE = "));   
  Serial.print(myDFPlayer.readState()); //read mp3 state . Reading or Not Reading 
  value = myDFPlayer.readState();
  Serial.println(F(" (1 = Reading/ 0 = NOT Reading)"));
//-----------------------------------------------------------------------------------------     
  Serial.print(F("    - STORAGE VOLUME CAPACITY = "));  
  Serial.print(myDFPlayer.readVolume()); //read current volume capacity
  Serial.print(F(" MB"));
  Serial.println(F(""));
//-----------------------------------------------------------------------------------------  
//  Serial.print(F("    - EQ SETTINGS =  "));   
//  Serial.println(myDFPlayer.readEQ()); //read EQ setting
//-----------------------------------------------------------------------------------------
  Serial.print(F("    - READ FILE COUNTS "));
  Serial.println(myDFPlayer.readFileCounts()); //read all file counts in SD card //Produces 0
  value = myDFPlayer.readFileCounts(); //read all file counts in SD card
//-----------------------------------------------------------------------------------------  
  Serial.print(F("    - READ CURRENT FILE NUMBER "));
  Serial.println(myDFPlayer.readCurrentFileNumber()); //read current play file number
  value = myDFPlayer.readCurrentFileNumber();
//-----------------------------------------------------------------------------------------  
  Serial.print(F("    - readFileCountsInFolder"));
  Serial.println(myDFPlayer.readFileCountsInFolder(1)); //read file counts in folder SD:/03 PRODUCES ERROR
  Serial.println(F("================================================================")); 

  Serial.println(F("================================================================"));
  Serial.println(F("           BEGINNING SOUND AND LIGHT SEQUENCE"));
  Serial.println(F("================================================================")); 
  Serial.println(F("  - DETAILS :"));
  Serial.println("AUDIO ONLY - Started");  
///////////////////////////////////////////////////////////////////////////////////////////

Now i know i can rely on 3 things here
READ STATE = 1 (Indicating the SD Card has ACTUALLY Been Read) Because it would be 0 if it wasn't, I've tested this by removing the card during reading

STORAGE VOLUME CAPACITY - Normally i see 512 here even though my SD Card is 16GB.
Haven't worked that out yet but the fact we have a value means something was read.

READ FILE COUNTS IN FOLDER - This return 7 which correct , and i have tested removing files
and it ALWAYS gives the correct number

So if nothing else , but Read File Counts in Folder , we know

Serial Started
Tx and Rx Lines work
There is the appropriate voltage
There are no Short Circuits
The SD Card is inserted correctly and setup properly
The files are on the card and in the correct format
The speaker has been tested to work and connected correctly

and yet we still hear no sound
and... THE BLUE LIGHT ON THE DFRobot Player does not light up
(Indicating that it's not reading from the card)

Now that's weird isn't it

so i go down the road of assuming the DFRobot is faulty
I crack out another 7 of them that i have in my stock
EVERY SINGLE ONE RETURNS THE SAME ERROR

something is weird
Murphy is Messing with me

so i decide to hook this test circuit up

  • I do this on Breadboard

  • Taking note to test my Momentary Switch Reading 0.2Ohm in the C.C. Position and OL in the
    O.C. Position

  • and Taking note that a SHORT PRESS will go to the next file on the SD Card

I try this out
EVERYTHING WORKS PERFECTLY AND FLAWLESSLY

Now.....
Go work that one out
2023-08-28 01_46_47-Mindblowing - Google Search

So here is what we ABSOLUTELY KNOW

  • We have a pinout of the DFRobot Player
    2023-08-26 20_25_50-DFPlayer Mini Mp3 Player - DFRobot Wiki

  • Vcc - This works and is tested

  • Rx -

  • Tx

  • DAC_R - Never used , Not Relevant

  • DAC_I - Never used , Not Relevant

  • SPK_1 This works and is tested

  • GND - Grounds are common and tone out and have low resistance between them.
    and the tone does not appear on any other pins

  • SPK_2 This works and is tested

  • BUSY - Never used , Not Relevant

  • USB - - Never used , Not Relevant

  • USB + - Never used , Not Relevant

  • ADKEY_2 - Never used , Not Relevant

  • ADKEY_1 - Never used , Not Relevant

  • IO_2 - Not connected or needed

  • GND - As Above

  • IO_1- Absolutely works and skips to next track Flawlessly

Now Regarding Rx and Tx

  1. if the lines are faulty then we would not have gotten to the stage of reading the SD Card Attributes and the file count of 7 could not appear

  2. I did test the lines with my Oscilloscope and Data Packets did appear
    However i can't confirm YET if they were correct

I THINK 2 THINGS NEED TO HAPPEN HERE

  1. I need to thoroughly test and interrogate the Tx and Rx Pins of the DFRobot player because so far the only thing that makes sense is...

The Device is Not Faulty on the I/O Pins but is Faulty on Tx and Rx or one or the other.

  1. I need to build a Vero Board Test Circuit for future use to test the DFRobot Player
    as a breadboard is unreliable

3, While i'm at it, I also suspect the ESP32 for no other reason other than "" It's Possible"
I have not yet tested the possibility that my pins 16 and 17 may be faulty

I Plan to also build a Vero Board Test Circuit to test Every Pin on the ESP32
as follows

The Pins that can have an LED Attached to them and just blink an LED
I will create a circuit with a standard LED on each pin
I will write a program to cycle through each pin and blink each LED 3 times to confirm working
with a delay of ... let's say 500ms (we'll see)

I can even use the Multi Tasking concepts that we are discussing here to have the lighting up of each data pin to be 1 Task
Overkill...?? YES
COOL..........YES
GOOD EXPERIENCE........ YES

Further to this , if i want to focus on specific pins to be set first
I Can apply priorities to do those first

As for the other pins , i'll have to see what their functionalies are and how to test them

But i think it'll be beneficial to have a test board for DFRobot and for ESP32

My gut feeling is for some reason , Maybe it's still the wiring
But ... this is one of those .... I've tested everything scenario's

All that is left now is.....
Have a rest, Pick it up tomorrow.

Feel free to share your thoughts

We should submit that there should be a badge for that :stuck_out_tongue:

1 Like

I'm almost there , don't worry, I'll be joining you soon.

1 Like

May i suggest trying this at some stage,
Of course finish your test and don't change anything so that results are not tarnished
but AT SOME POINT try this

void setup()
{
  Serial.begin(115200);
  analogReadResolution(12);

  xTaskCreate(Task10, "Task-10", 2048, NULL, 1, &Task10Handle);
  xTaskCreate(Task11, "Task-11", 2048, NULL, 2, &Task11Handle);
}

Your priorites with remain the same
there realistically should be no difference in your results, Based on what i have observed through testing so far

1 Like

Yes, All Tasks of varying priorities are also served on a "round Robin" basis.
After reading up to a decent degree on the Round Robin Algorithm i think what happens is this..

We initially make the assumption that you are making because we are told by the Docs
that round robil DISTRIBURES TIME SLICES EQUALLY AND FAIRLY

Yes it does, Assuming that all tasks were not running and started running now and all of them
have the same priority level .

but it doesn't happen like that, Priority tasks are dealt with in a Round Robin fashion but round robin does consider priority,

The CPU basically Distributes time slices on a "first come first served" basis, Not necessarily on an
"I'm going to assume that all tasks have equal priority" basis.

Have a read of this..
https://en.wikipedia.org/wiki/Round-robin_scheduling
I have learned that there are resources that cover this subject on a basic level and then there are others that go in depth.

Check this out

1 Like

NO it is just allowed to run before tasks that have a lower priority

Watch the video...
However , if a task is in RUNNING State and another task of lower priority is in READY State.
and the scheduler does not have time slices to give that task will wait until a time slice is available.
if the reason is because a higher priority task is running then it will stay in READY state

if it was the reverse and the higher priority task was in Ready state, it would be put in RUNNING State adn if necessary the other task would be stopped.

1 Like

Alarm bells ringing on reading "SoftwareSerial"!

Ready tasks of different priorities are listed in their own Round Robin lists. Tasks are assigned runtime starting with the highest priority list

Exercise: Find out yourself whether an unblocked task is moved to the head or tail of its Round Robin list.

2 Likes

Drop the software serial, esp32 has 3 hardware serials, memory getting a bit old but thinking 16 and 17 are serial1, so you are creating a software serial on a hardware serial..
good luck.. ~q

3 Likes

In your scenerio Task10 is not given more time because more time is not needed. You have it delaying one second, that puts the task in the "blocked" state and the next equal or higher priority task in the "ready" state is run, that would be Task11. It does its thing and then hits the delay instruction. This places Task11 into the "blocked" state. At this time no equal or higher priority tasks are in the "ready" state so the "idle" task is run doing nothing.

When Task10 delay times out Task10 is placed in the "ready" state. Since there is no equal or higher task running it gets placed in the "run" state and is run again. This continues forever.

3 Likes

OK, I wasn't aware of that

I've also found that 1 of my ESP32 Boards has developed and Error

Exit Status 2
Apparently it's stuck , Not in download Mode

the fix apparently is to hold down both BOOT and EN
Then Release EN
and the verbose on serial monitor will be
Downloading Now

You then release BOOT
and then you are supposed to upload your sketch,

Did that, Didn't work
Suspect faulty Dev Board

Now.. THAT would explain the issues i've been having.

The following pin out diagram (Fig-1) of ESP32 Dev Module shows: UART0 (1, 3) and UART2 (16, 17); it does not show UART1. Does it exist?


Figure-1:

1 Like

remember something about having to hold down boot but not enable..
look here at #4. esp32-troubleshooting-guide

good luck.. ~q

2 Likes

Yes, it's there, but if i remember correctly one of its pins is in use for something, don't remember exactly what though, sorry..
so you could only send or receive, i forget which..
~q

My experience with these diagrams is...

  1. The pin numbers that are stated on the diagram are not always the numbers that end up on your board

  2. there are only like 2 or 3 of these diagrams that people actually use

  3. As a result of the pin numbers being different the functions may change and you may have issues

  4. and all that in mind, then people come to forums asking...
    I looked at the diagram but my pin doesn't work

  5. and then you consider, is the diagram accurate, does it pertain to my model.
    there are fakes out there etc etc
    and it's no so reliable anymore , I have found you actually have to test things
    for your own board to get reliability.

I've seen this diagram over 100 times and i have a copy
it hasn't applied correctly to every ESP32 board that i've had

Arduino on the other hand was more accurate

2 Likes

That is with ESP8266. It is the TXD1-pin -- for sending only.