This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF9160 Dynamic Threads

Hi,

I trying to integrate a thread inside a function to run in parallel with the main program.

I have tried the THEAD_DEFINE function and it works but it is static and has to run at the start of the program run time.

K_THREAD_DEFINE(thread1,STACKSIZE,funcation call,NULL,NULL,NULL,PRIORITY,0,0);
I am also trying with thread_create but when I flash the dk it goes in a dump and keep looping. I am not sure what is the problem there.

//k_thread_create(&my_thread_data, my_stack_area, K_THREAD_STACK_SIZEOF(STACKSIZE), funcation call, NULL, NULL, NULL, PRIORITY, 0, K_NO_WAIT);

Is there another thread call function that will run inside a function.
Parents Reply
  • Hi Didrik,


    Yes, followed the documentation and got a dump as I mentioned. If I try to run a gps thread this is how I have it.

    #define STACKSIZE 4096
    #define PRIORITY 7
    
    
    
    K_THREAD_STACK_DEFINE(my_stack_area, STACKSIZE);
    struct k_thread my_thread_data;
    extern int gps(void *, void *, void *);
    
    k_thread_create(&my_thread_data, my_stack_area, K_THREAD_STACK_SIZEOF(STACKSIZE), gps, NULL, NULL, NULL, PRIORITY, 0, K_NO_WAIT);



Children
Related