Hello,
nRF SDK 17.0.2, keil5
how to create a thread? for runing decode.
Best regards
Hello,
nRF SDK 17.0.2, keil5
how to create a thread? for runing decode.
Best regards
Hello,
Unfortunately, the nRF5 SDK does not natively feature an RTOS, and so there is no native support for threading either. The nRF5 SDK is a bare-metal/task-and-event based SDK by default, but there does however exists some examples in the SDK that incorporates the FreeRTOS which supports threading. In essence, if you need threading/RTOS in the nRF5 SDK you will have to utilize the FreeRTOS.
If you are starting a new project I would strongly recommend that you start out with the nRF Connect SDK instead, which is based on the Zephyr RTOS, which innately supports threading and all the other features and benefits that comes with a RTOS.
Best regards,
Karl
Hi,
thanks for reply, i'm not talk about RTOS.
in NCS i know to create a thread as follow;
but now i've a old project using SDK17 need add thread to do some thing.
//-------------------------create thread------------------------------------
// Define the thread function
void deal_thread_func(void)
{
while(true)
{
..........
k_msleep(1);
}
}
// Initialize and start the thread
K_THREAD_DEFINE(deal_thread, 1024, deal_thread_func, NULL, NULL, NULL, 3, 0, 0);
Best regards
Hi,
thanks for reply, i'm not talk about RTOS.
in NCS i know to create a thread as follow;
but now i've a old project using SDK17 need add thread to do some thing.
//-------------------------create thread------------------------------------
// Define the thread function
void deal_thread_func(void)
{
while(true)
{
..........
k_msleep(1);
}
}
// Initialize and start the thread
K_THREAD_DEFINE(deal_thread, 1024, deal_thread_func, NULL, NULL, NULL, 3, 0, 0);
Best regards
yoyou said:thanks for reply,
No problem at all, I am happy to help! :)
yoyou said:i'm not talk about RTOS.
Threading as a concept needs a scheduler to function, which is the very core of an RTOS.
A bare-metal application does not have any such scheduler, which is why you can not natively create threads in the nRF5 SDK.
yoyou said:in NCS i know to create a thread as follow;
but now i've a old project using SDK17 need add thread to do some thing.
As I said there is no native support for threading in the nRF5 SDK, unless you base your project on the FreeRTOS that I referenced.
If you are looking for functionality to defer processing of ISR to the main context then you could perhaps instead make use of the App scheduler library - it is not a thread but it will essentially function as a single workqueue in Zephyr.
Best regards,
Karl
Hi,
thanks for reply, i've try use scheduler library.
#include "app_scheduler.h"
void schedule_event_handler(void)
{
app_sched_event_put();
}
int main()
{
APP_SCHED_INIT(1024,1024);
while(true)
{
app_sched_execute();
}
return 0;
}
Error: L6218E: Undefined symbol APP_SCHED_INIT (referred from main.o).
above,got error!
i've no idea to do. are there some sample codes?
Best regards
Hello,
Please make sure that you have added the app scheduler source files to your project, and enabled the app scheduler in your sdk_config.h:
// <e> APP_SCHEDULER_ENABLED - app_scheduler - Events scheduler //========================================================== #ifndef APP_SCHEDULER_ENABLED #define APP_SCHEDULER_ENABLED 1 #endif
Hi,
yes, i've do it, but got a lot of error.

and how to connect to schedule_event_handler()?
Best regards
Please share the entire error log as text, not a screenshot.
You may do so by using the Insert -> Code option here on DevZone.
Best regards,
Karl