Lower priority task with getchar() halts higher task in FreeRTOS - how to fix that?
I have two functions:
shell() uses getchar() to get user input
playLED() plays a LED animation
I have two tasks running in FreeRTOS
xTaskCreate(
shell,
"shell",
512,
NULL,
1,
NULL);
xTaskCreate(
playLED,
"playLED",
512,
NULL,
15,
NULL );
vTaskStartScheduler();
Then I noticed the LED animation play become step-wise, it changes only when getchar() received input from user, instead of a smooth animation.
I've already set LED priority a lot higher, however this didn't fix the halt. Is there anything else that I should configure somewhere?
The code is run on NXP LPC54018 board with MCUXpresso. A similar problem on a different device can be found at https://os.mbed.com/questions/781/Skip-getchar-if-no-input-using-interrupt/
freertos
add a comment |
I have two functions:
shell() uses getchar() to get user input
playLED() plays a LED animation
I have two tasks running in FreeRTOS
xTaskCreate(
shell,
"shell",
512,
NULL,
1,
NULL);
xTaskCreate(
playLED,
"playLED",
512,
NULL,
15,
NULL );
vTaskStartScheduler();
Then I noticed the LED animation play become step-wise, it changes only when getchar() received input from user, instead of a smooth animation.
I've already set LED priority a lot higher, however this didn't fix the halt. Is there anything else that I should configure somewhere?
The code is run on NXP LPC54018 board with MCUXpresso. A similar problem on a different device can be found at https://os.mbed.com/questions/781/Skip-getchar-if-no-input-using-interrupt/
freertos
Can you better describe your environment (CPU, libraries, µC, toolset)?getchar()
is not part of FreeRTOS. So only answers specific to your environment can be given.
– Codo
Oct 27 '18 at 9:17
Thanks for the reply. I am using it with a MCUxpresso on NXP LPC 54018
– Suicide Bunny
Oct 29 '18 at 17:59
add a comment |
I have two functions:
shell() uses getchar() to get user input
playLED() plays a LED animation
I have two tasks running in FreeRTOS
xTaskCreate(
shell,
"shell",
512,
NULL,
1,
NULL);
xTaskCreate(
playLED,
"playLED",
512,
NULL,
15,
NULL );
vTaskStartScheduler();
Then I noticed the LED animation play become step-wise, it changes only when getchar() received input from user, instead of a smooth animation.
I've already set LED priority a lot higher, however this didn't fix the halt. Is there anything else that I should configure somewhere?
The code is run on NXP LPC54018 board with MCUXpresso. A similar problem on a different device can be found at https://os.mbed.com/questions/781/Skip-getchar-if-no-input-using-interrupt/
freertos
I have two functions:
shell() uses getchar() to get user input
playLED() plays a LED animation
I have two tasks running in FreeRTOS
xTaskCreate(
shell,
"shell",
512,
NULL,
1,
NULL);
xTaskCreate(
playLED,
"playLED",
512,
NULL,
15,
NULL );
vTaskStartScheduler();
Then I noticed the LED animation play become step-wise, it changes only when getchar() received input from user, instead of a smooth animation.
I've already set LED priority a lot higher, however this didn't fix the halt. Is there anything else that I should configure somewhere?
The code is run on NXP LPC54018 board with MCUXpresso. A similar problem on a different device can be found at https://os.mbed.com/questions/781/Skip-getchar-if-no-input-using-interrupt/
freertos
freertos
edited Oct 29 '18 at 18:02
Suicide Bunny
asked Oct 27 '18 at 0:08
Suicide BunnySuicide Bunny
142110
142110
Can you better describe your environment (CPU, libraries, µC, toolset)?getchar()
is not part of FreeRTOS. So only answers specific to your environment can be given.
– Codo
Oct 27 '18 at 9:17
Thanks for the reply. I am using it with a MCUxpresso on NXP LPC 54018
– Suicide Bunny
Oct 29 '18 at 17:59
add a comment |
Can you better describe your environment (CPU, libraries, µC, toolset)?getchar()
is not part of FreeRTOS. So only answers specific to your environment can be given.
– Codo
Oct 27 '18 at 9:17
Thanks for the reply. I am using it with a MCUxpresso on NXP LPC 54018
– Suicide Bunny
Oct 29 '18 at 17:59
Can you better describe your environment (CPU, libraries, µC, toolset)?
getchar()
is not part of FreeRTOS. So only answers specific to your environment can be given.– Codo
Oct 27 '18 at 9:17
Can you better describe your environment (CPU, libraries, µC, toolset)?
getchar()
is not part of FreeRTOS. So only answers specific to your environment can be given.– Codo
Oct 27 '18 at 9:17
Thanks for the reply. I am using it with a MCUxpresso on NXP LPC 54018
– Suicide Bunny
Oct 29 '18 at 17:59
Thanks for the reply. I am using it with a MCUxpresso on NXP LPC 54018
– Suicide Bunny
Oct 29 '18 at 17:59
add a comment |
2 Answers
2
active
oldest
votes
Does getchar() disable interrupts at all when receiving input? In that case the FreeRTOS scheduler will not be able to run the high priority task.
Thanks for the reply. That's what I suspect but I don't know how to fix that. My expectation that the interrupt should be isolated to this task only but somehow it affect everything
– Suicide Bunny
Oct 29 '18 at 17:58
add a comment |
I think vTaskDelay(1) in the beginning of the task with getChar will resolve the problem.
Also you can change order of creation of tasks, it can also help.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53017678%2flower-priority-task-with-getchar-halts-higher-task-in-freertos-how-to-fix-th%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Does getchar() disable interrupts at all when receiving input? In that case the FreeRTOS scheduler will not be able to run the high priority task.
Thanks for the reply. That's what I suspect but I don't know how to fix that. My expectation that the interrupt should be isolated to this task only but somehow it affect everything
– Suicide Bunny
Oct 29 '18 at 17:58
add a comment |
Does getchar() disable interrupts at all when receiving input? In that case the FreeRTOS scheduler will not be able to run the high priority task.
Thanks for the reply. That's what I suspect but I don't know how to fix that. My expectation that the interrupt should be isolated to this task only but somehow it affect everything
– Suicide Bunny
Oct 29 '18 at 17:58
add a comment |
Does getchar() disable interrupts at all when receiving input? In that case the FreeRTOS scheduler will not be able to run the high priority task.
Does getchar() disable interrupts at all when receiving input? In that case the FreeRTOS scheduler will not be able to run the high priority task.
answered Oct 27 '18 at 7:04
stathisvstathisv
38614
38614
Thanks for the reply. That's what I suspect but I don't know how to fix that. My expectation that the interrupt should be isolated to this task only but somehow it affect everything
– Suicide Bunny
Oct 29 '18 at 17:58
add a comment |
Thanks for the reply. That's what I suspect but I don't know how to fix that. My expectation that the interrupt should be isolated to this task only but somehow it affect everything
– Suicide Bunny
Oct 29 '18 at 17:58
Thanks for the reply. That's what I suspect but I don't know how to fix that. My expectation that the interrupt should be isolated to this task only but somehow it affect everything
– Suicide Bunny
Oct 29 '18 at 17:58
Thanks for the reply. That's what I suspect but I don't know how to fix that. My expectation that the interrupt should be isolated to this task only but somehow it affect everything
– Suicide Bunny
Oct 29 '18 at 17:58
add a comment |
I think vTaskDelay(1) in the beginning of the task with getChar will resolve the problem.
Also you can change order of creation of tasks, it can also help.
add a comment |
I think vTaskDelay(1) in the beginning of the task with getChar will resolve the problem.
Also you can change order of creation of tasks, it can also help.
add a comment |
I think vTaskDelay(1) in the beginning of the task with getChar will resolve the problem.
Also you can change order of creation of tasks, it can also help.
I think vTaskDelay(1) in the beginning of the task with getChar will resolve the problem.
Also you can change order of creation of tasks, it can also help.
answered Nov 22 '18 at 20:20
SG92SG92
416
416
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53017678%2flower-priority-task-with-getchar-halts-higher-task-in-freertos-how-to-fix-th%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you better describe your environment (CPU, libraries, µC, toolset)?
getchar()
is not part of FreeRTOS. So only answers specific to your environment can be given.– Codo
Oct 27 '18 at 9:17
Thanks for the reply. I am using it with a MCUxpresso on NXP LPC 54018
– Suicide Bunny
Oct 29 '18 at 17:59