Running BLE in xTaskCreate is not working

Posts: 11
Joined: Mon Jun 12, 2017 9:34 am

Running BLE in xTaskCreate is not working

Postby san27deep » Tue Aug 01, 2017 2:55 pm

I am able to run, BLE on main thread. It is working perfectly.
But when I am trying to run it by creating as a one separate task it is giving me errors.

I want to ask, whether it is possible to run on task other than main thread?
If yes then what precautions we need to take. ? what is minimum stack space that we need to allocate.? or any specific priority that we need to give?

User avatar
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Running BLE in xTaskCreate is not working

Postby kolban » Tue Aug 01, 2017 4:24 pm

It isn't clear what you mean by run BLE on a separate thread. In the ESP32 the BLE support is a set of APIs that can be called. I know of no restrictions that would constrain invoking BLE APIs from multiple threads. This has worked just fine for me.

You said you ran it and got errors ... but didn't spend time describing the nature of those errors.

I usually give a new task 20K of stack space (as a default) and haven't had any issues. Obviously the minimum stack space you need will be a function of what your application does and how it uses stack storage. It is like asking "how much paint do I need to paint my house" without knowing anything about your house.

I have not seen anything related to FreeRTOS task priority being an issue.
Free book on ESP32 available here:

Posts: 262
Joined: Sun Jun 19, 2016 12:00 am

Re: Running BLE in xTaskCreate is not working

Postby BuddyCasino » Tue Aug 01, 2017 4:27 pm

Depends on which core you run it on. You can't do interrupts on both imho.

Who is online

Users browsing this forum: Google [Bot] and 14 guests