Problem interrupt Psoc 4 - uC/OS

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
RoFr_4201436
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Hello there,

I implemented code in psoc 4 with uC / OS, where there are tasks and interruptions, but I had a problem with the interruption. The interrupt I created is a button. The interrupt works, but when the interruption comes to an end, the tasks return to where they left off and I would like them to return from the beginning, is there any function of uC / OS III that does this?

To access the project, open Psoc Create and then click on "file-> Open-> Project / workspace" and open the folder "Micrium\Examples\Cypress\CY8CKIT-044\OS3\PSoC\OS3.cywrk"

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @RoFr_4201436

When an interrupt occurs, the task context is saved and the ISR is serviced. After the execution of ISR is completed, the task is resumed at the point the execution was stopped. Do you want to reset the task so that it starts from first? Is my understanding correct? If that is the case, I believe it will be easier to change the logic to not execute the code when the interrupt occurs. I am not aware of an API that would reset the task.

One thing that I think can be done is create a task (say Task1) specifically to manage other tasks. Let us consider that a task (Task2) was running. When the interrupt occurs, delete Task2 that was executing before the interrupt using Task1 and then create Task2 again with a priority higher than Task1. This way Task1 will be blocked and Task2 will be reset.

Thanks and Regards,
Rakshith M B

View solution in original post

4 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @RoFr_4201436

When an interrupt occurs, the task context is saved and the ISR is serviced. After the execution of ISR is completed, the task is resumed at the point the execution was stopped. Do you want to reset the task so that it starts from first? Is my understanding correct? If that is the case, I believe it will be easier to change the logic to not execute the code when the interrupt occurs. I am not aware of an API that would reset the task.

One thing that I think can be done is create a task (say Task1) specifically to manage other tasks. Let us consider that a task (Task2) was running. When the interrupt occurs, delete Task2 that was executing before the interrupt using Task1 and then create Task2 again with a priority higher than Task1. This way Task1 will be blocked and Task2 will be reset.

Thanks and Regards,
Rakshith M B
lock attach
Attachments are accessible only for community members.

So, I tried to change the priority of the tasks as shown in the image: Then I changed the signals in the task: "App_Botao_Pedestre_1_Task" and then I came back with the original priorities, like the image:

RoFr_4201436_3-1614319838826.png

 

Then I changed the signals in the task: "App_Botao_Pedestre_1_Task" and then I came back with the original priorities, like the image:

RoFr_4201436_2-1614319602084.png

But after I press the interrupt button, the program simply stops. I even tried to delete the tasks, but without success! Can you help me?

0 Likes
RoFr_4201436
Level 3
Level 3
50 sign-ins 25 sign-ins 10 replies posted

Yes. You understand me very well. Can you put this in my code? 

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

From the private message that I received, I believe that you were able to implement the workaround. So, I will be marking the workaround as the solution. If that is not the case and you are still facing issues, please let us know.

Thanks and Regards,
Rakshith M B