KW36 multitask

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

KW36 multitask

943 Views
jictannu
Contributor III

I try to add those sample code in frdmkw36_wireless_examples_bluetooth_w_uart_freertos wireless_uart.c:

void test_task(void* argument)
{

   while(1) {

      Serial_Print(gAppSerMgrIf, "\n\rtest_task \n\r", gAllowToBlock_d);

      OSA_TimeDelay(500);

      }
}

OSA_TASK_DEFINE(test_task, 1, 1, 50, 0)  ;

....

static void BleApp_Config()

{

   ...

   mBatteryMeasurementTimerId = TMR_AllocateTimer();

    OSA_TaskCreate(OSA_TASK(test_task), NULL);

}

At the begining, it could print "test_task". Then I press sw3 and sw2 to start advertising, it stop printing, I could not scan it. It looks like blocked. If I do not create this task, it could advertise. Did I do anything wrong?

Labels (1)
0 Kudos
3 Replies

725 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Mo Xinyu, I hope you're doing well!

 

The OS Abstraction component of the connectivity framework works as a way to manage tasks without directly using the FreeRTOS APIS.

 

To set up a new task, first it has to be defined with the OSA_TASK_DEFINE macro. As an example, you can see how the host task is defined in ble_host_tasks.c. The same source file also shows an example on initializing the task along with the creation of an event related to it.

 

Also, task priority should be taken into account when creating a new task, as the tasks used by the BLE framework need the highest priority for BLE stack timing and connection.

 

For more information about the OS Abstraction framework layer, could you please take a look at chapter 3.1 of the Connectivity Framework Reference Manual document included with the SDK? It can be found in the following path:

 

<…\SDK_2.2.2_FRDM-KW36\docs\wireless\Common\Connectivity Framework Reference Manual.pdf>

 

Please let me know if you need more information.

 

Best regards,

Sebastian

0 Kudos

725 Views
jictannu
Contributor III

Hi, Sebastian, have you read my code above? It seems like that test_task and ble task are conflicting . Did I do something wrong?

0 Kudos

725 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Mo Xinyu,

 

Could you please take a look at this document here?

 

It shows the process for setting up an additional task and queue in the OS Abstraction layer for the NXP Connectivity Stack.

 

Best regards,

Sebastian

0 Kudos