How to get TaskID

Hey all,

I’ve been looking for a way to get the task ID (uxTaskNumber), and have only stumbled across this link: Hoe to get the Task Number? - FreeRTOS

It no longer works (or my implementation is bad), and I was wondering if there was another method of accessing that value?

I’ve also attempted to directly access it via the following:

TaskHandle_t xTask;
UBaseType_t tasknum;

tasknum = xTask->uxTaskNumber

But end up with “dereferencing pointer to incomplete type ‘struct tskTaskControlBlock’”

Cheers!

I feel dumb, it does work, just set configUSE_TRACE_FACILITY to 1 instead of configUSETRACEFACILITY in FreeRTOSConfig.h.

1 Like