KW36 user task

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KW36 user task

Jump to solution
1,359 Views
JiCheng_ZhangXiang
Contributor II

Hello, NXP

I try to creat my task on the wirelessuart example from SDK_2.2.5_FRDM-KW36. But I found there's as strange problem as below:

(1) If the priority of my task is higher than the startup_task, my task work but BLE broadcast don't work. I found the function OSA_TaskCreate(OSA_TASK(Host_Task) in the the startup_task will return fail, it cause BLE broadcast don't work

(2 If the priority of my task is lower than the startup_task, the startup_task work, and I can see BLE broadcast work use my cellphone. but my task don't work.

as we know, SDK used the FreeRTOS. If the priority value of the task is bigger, the priority is higher. Now I puzlled, so my question is how to define user task correctly?

0 Kudos
1 Solution
1,327 Views
nxf56274
NXP Employee
NXP Employee

Hi,

I made a test. If your task priority is lower than main task and your stack for your own task is larger, your task won't work. Increasing the value of gTotalHeapSize_c in app_preinclude.h will solve this problem.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

3 Replies
1,328 Views
nxf56274
NXP Employee
NXP Employee

Hi,

I made a test. If your task priority is lower than main task and your stack for your own task is larger, your task won't work. Increasing the value of gTotalHeapSize_c in app_preinclude.h will solve this problem.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,296 Views
JiCheng_ZhangXiang
Contributor II

yes, before you reply, I tried change the heapsize and creat my task successfully!

Thank you all the same.

Tags (1)
0 Kudos
1,343 Views
Xiang_Li
NXP Employee
NXP Employee

The function OSA_TaskCreate() returns either a task ID, if the task is created successfully, or returns Null if "The task cannot be created."

If the task cannot be created, the first thing I'd check is whether or not you allocate enough resources for the task.

Could it be possible that you create your task, but forgot to allocate resources, and then the Host_Task is failed at creation?

To allocation resource there is something like:
OSA_TASK_DEFINE( Job1, OSA_PRIORITY_HIGH, 1, 800, 0);

 

Below is the function header I copied:

/*!
* @brief Creates a task.
*
* This function is used to create task based on the resources defined
* by the macro OSA_TASK_DEFINE.
*
* @param thread_def pointer to the osaThreadDef_t structure which defines the task.
* @param task_param Pointer to be passed to the task when it is created.
*
* @retval taskId The task is successfully created.
* @retval NULL The task can not be created..
*
* Example:
@code
osaTaskId_t taskId;
OSA_TASK_DEFINE( Job1, OSA_PRIORITY_HIGH, 1, 800, 0);;
taskId = OSA__TaskCreate(OSA__TASK(Job1), (osaTaskParam_t)NULL);
@endcode
*/

0 Kudos