K60 Multithreading

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

K60 Multithreading

574 Views
broccolee
Contributor III

Hi,

I am using TWR-K60N512, with PK60DN512Z VMD10 chip and Codewarrior 10.5. Can the K60 do multithreading in baremetal project? If so how do I accomplish that?

I'm not too sure if multithreading is the right term for this, I'm not a software/computer science/engineering major... Anyway, my desired application is to designate a thread to run a control loop at an interval 'x' ms, another thread to perform heavy duty calculations every 'y' ms, and another thread to listen for user input at a much slower rate. They all run simultaneously.

Thanks.

0 Kudos
2 Replies

422 Views
BlackNight
NXP Employee
NXP Employee

It all depends on your needs. So certainly you could do this, and you could write a mini scheduler based on one or more timers. Or do your three 'tasks' in three timer interrupts with the correct nesting (see for example the series starting with https://mcuoneclipse.com/2016/08/14/arm-cortex-m-interrupts-and-freertos-part-1/  about the NVIC nesting).

Using a small RTOS like FreeRTOS would be my preferred option for this as it simplies things a lot and costs your nearly no execution time. But again, it is up to your needs.

I hope this helps,

Erich

0 Kudos

422 Views
broccolee
Contributor III

Hi Erich,

Thanks for your suggestions! I think I have exhausted all the commonly used timers: PIT, FTM, LPTMR on the K60. Can I use the remaining timers: Programmable Delay Block (PDB), Carrier Modular Transmitter (CMT), and Real-Time Clock (RTC) to create three timer interrupts? 

Since I have no experience with scheduler, my next questions is: how do I create a mini scheduler based on one timer?

I'll definitely look into using FreeRTOS in my future research!

Thanks.

0 Kudos