Trouble Creating a Thread on AVR32UC with Zephyr – Any Tips?

Hey guys, I'm trying to create a new thread on my AVR32UC using Zephyr OS, but the thread isn't being created as expected. Here's my code:
#include <zephyr.h>

void thread_function(void) {
printk("Thread started\n");
}

K_THREAD_DEFINE(my_thread, STACK_SIZE, thread_function, NULL, NULL, NULL, PRIORITY, 0, 0);
The error:
#include <zephyr.h>

void thread_function(void) {
printk("Thread started\n");
}

K_THREAD_DEFINE(my_thread, STACK_SIZE, thread_function, NULL, NULL, NULL, PRIORITY, 0, 0);
The error:
error: Thread creation failed due to insufficient resources
error: Thread creation failed due to insufficient resources
I've tried increasing the stack size and lowering the priority, but the issue persists. Any advice?
Solution:
Yes, this is the code for creating the thread. I don't have any complicated initialization code that might be causing a lock. thankz tho
Jump to solution
4 Replies
Dark AI
Dark AI4mo ago
Hi @Dtynin in other to fix the thread creation issue, first make sure your STACK_SIZE is large enough. Check your memory settings in prj.conf and confirm that the PRIORITY is set correctly. Also, ensure the thread is initialized properly and consider tweaking Zephyr settings like CONFIG_MAIN_STACK_SIZE and CONFIG_MAX_THREAD_BYTES. If it still doesn't work, use debugging tools to identify any resource problems
melta101
melta1014mo ago
Is this the only code anything else?
melta101
melta1014mo ago
seems like something is locking it
Solution
Dtynin
Dtynin4mo ago
Yes, this is the code for creating the thread. I don't have any complicated initialization code that might be causing a lock. thankz tho
Want results from more Discord servers?
Add your server