View unanswered posts | View active topics It is currently Thu Oct 23, 2014 4:22 am






Reply to topic  [ 2 posts ] 
Multitasking on EV3 
Author Message
Rookie

Joined: Thu Sep 25, 2014 8:34 pm
Posts: 2
Post Multitasking on EV3
This problem is similar to the thread started on June 1st with the topic: " ev3 program doesn't run directly from brick "

I have encountered the same problem using the Multitasking Sample Program. I am opening the sample program: Sample Programs > EV3 > Advanced Examples > Multitasking.

The program compiles just fine and downloads to the EV3 without any trouble. I can even run the program from the RobotC development environment on the computer. I press the "Start" button and it works just fine.

However, when I stop the program and try to run the very same program from the EV3 (you know, the one with the small LCD and left/right and up/down buttons) the program just hangs. It does not go any further than the blinking green LED and the message on the LCD that says: "Mindstorms: Multitasking demo".

I can re-start the program from the computer just fine. But for some reason, I am unable to start it from the EV3 brick once it has already been run once.

If the EV3 is connected to the computer via USB cable, there is an error box that appears with the title: RobotC Debugger Exception.
Exception Type: 'Bad integrity of internal task queues(42)'
Error at PC: +0x178B
Task PC: Task: main+0x0000,
TaskState: 'Exception'
[CANCEL]

Multitasking seems to work. But only if you start the program from the PC. There seems to be a problem if you try starting the program from the EV3.

Any ideas?

I forgot to mention one other thing. Once the EV3 hangs from this error, it is impossible to start ANY program that was downloaded to the brick. It will start the Demo program. But I cannot start any other program that I downloaded. The only way I can run a program from the EV3 is to reboot the EV3 itself. Then I can run the program again.


Thu Sep 25, 2014 8:49 pm
Profile
Rookie

Joined: Thu Sep 25, 2014 8:34 pm
Posts: 2
Post Re: Multitasking on EV3
I think I have found a reasonable solution.

To re-cap the original problem: Once you have exited from a program that implemented multitasking (for example, the Sample Multitasking program) you are unable to start any other programs from the EV3 brick. You can start other programs from the RobotC development environment--just not from the EV3 brick.

I found out that if you utilize the function: stopAllTasks(); to terminate the main program, then the program will stop and you can re-start any program from the EV3 brick without having to start them through the RobotC development environment.

If you terminate a multitasking program by using the "back" button on the EV3 (by the lower left corner of the LCD panel), the EV3 system will become corrupted in some way that prevents you from re-starting any other programs.

If you disable the "back" button with the function: setBlockBackButton(true); and then reassign the "left" key to perform the function: "stopAllTasks();" you should be able to have a program that performs multitasking and that also terminates properly enabling you to continue using the EV3 brick.

I would alter the Multitasking demo to include the following change to the mainTask:

task main() {
setBlockBackButton(true);
startTask(TOne); // Start Task TOne.
startTask(TTwo); // Start Task TTwo.

while(true) {
if (getButtonPress(buttonLeft)) stopAllTasks();
wait1Msec(300); // Allow for a short wait, freeing up the CPU for other tasks.
displayCenteredBigTextLine(0, "TASK M"); // Display that Main is running.
}
return;
}


Fri Sep 26, 2014 10:31 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.