User-created Task in BLE project

cancel
Showing results for 
Search instead for 
Did you mean: 

User-created Task in BLE project

173 Views
Contributor III

Hello,

Using QN9080, I am trying to extend one of the BLE related sample projects (RTOS) to run code which consists of an infinite loop. For this matter, I am trying to define and run my own Task.

Question is, how?

I have noticed that the in the entry point function (int main(void), inside "framework/OSAbstraction/Source/fsl_os_abstraction_free_rtos.c") a task named "startup_task" is created... and I have tried to hack my way forward by duplicating the Task creation to run my own; but not only is altering source inside the "framework" directory is bad practice, it also interferes with the program in practice...

Tags (3)
0 Kudos
7 Replies

8 Views
NXP TechSupport
NXP TechSupport

Hello,

In this case I would recommend you to check and verify this community post 

https://community.nxp.com/docs/DOC-345523

You can use it as a base o reference in order to create you own task when using the connectivity framework.

Regards,
Estephania

8 Views
Contributor III

Thank you,

Basically the article describes the same actions as I have taken... But again, following exactly the directions mentioned in the article, I am still getting the same result: Once a new task is defined, "startup_task" sieses.

* However, new task runs

0 Kudos

8 Views
NXP TechSupport
NXP TechSupport

hello,

Something that is not clear, the task that you are adding, is an infinite loop? or do you mean the main one ?

If you are trying to add your own infinite task loop to the stack, I'm afraid that won't be possible to add as you are adding intrusive code and you are not letting the Bluetooth LE tasks follow the timing set in accordance to the specification.

regard,s
Estephania

8 Views
Contributor III

Thank you for you reply, 

Yes I have used an infinite loop in my task, and so does the reference code, see

void vfnTaskPWM(void* param)

0 Kudos

8 Views
NXP TechSupport
NXP TechSupport

hello,

As mentioned, you should not use a blocking task in the code as the Bluetooth LE will not follow the specification when doing so.

So please, try using the event based approach, you can check this post as well to verify if this helps you as a guide.

https://community.nxp.com/docs/DOC-344586 

Regards ,
Estephania

8 Views
Contributor III

Thank you for the reference, I will examine it.

Meanwhile, please see line 24 in file "pwmApplication.c" in 

https://community.nxp.com/docs/DOC-345523 

(last page) to see that the referene code uses an infinite loop in the user-defined task; I would like to clarify your last point the blocking tasks should not be used with BT

0 Kudos

8 Views
NXP TechSupport
NXP TechSupport

Hello,

If you check carefully the task, it is not a task that is consuming the processing of the MCU completely, this using as well the OSA and verifying as well this condition

while((OSA_MsgQGet(pwmTask_queue,(void*)&msgString,10)) == 0)

Those details are important when using the task, as well as if you check the way and parameters used n the creation of the task suck as the event based etc, you can check that besides it is a infinite loop is has it owns characteristics so it does not interfere with the BLE timings.

regards,

Etsephania

0 Kudos