<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic KW45 Timer Manager issue on BLE beacon example in Wireless MCU</title>
    <link>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2054618#M19535</link>
    <description>&lt;P&gt;Hi, first some background, i'm using the KW45B41Z Eval Board with SDK version 24.12.00. With this configuration i'm trying to modify the beacon app, in this case by adding a periodic timer.&lt;BR /&gt;&lt;BR /&gt;However i'm having some issues where the timer callback does not trigger and by debugging the application i can see that the program goes into panic for the&amp;nbsp;&lt;SPAN&gt;gAdvertisingCommandFailed_c or the&amp;nbsp;gInternalError_c reason.&lt;BR /&gt;&lt;BR /&gt;The BLE stack has not been modified, the timer initialization is the default one in the&amp;nbsp;PLATFORM_InitTimerManager function (No issues detected there). Afater this in the main i have the following configuration:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Define the timer manager handle
uint32_t timerHandle[((TIMER_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))];
//support variable to toggle the timer
static bool ledState = true;
// Define a callback for time
void my_timer_callback(void *param) {
    (void)param;  // Explicitly ignore unused parameter
	if (ledState == true) GPIO_PinWrite(GPIOA, 19U, 0);
	else GPIO_PinWrite(GPIOA, 19U, 1);
	ledState = !ledState;
}
...
int main(void)
{
...
    GPIO_PinWrite(GPIOA, 19U, 1);
    /* Start Host stack */
    BluetoothLEHost_AppInit();
    
    timer_status_t checkTM = TM_Open(timerHandle);
    if (checkTM =! kStatus_TimerSuccess){
    	//TODO, Do something if timer manager does not open
    };
    checkTM = TM_InstallCallback(timerHandle,(timer_callback_t) my_timer_callback,NULL);
    if (checkTM =! kStatus_TimerSuccess){
       	//TODO, Do something if timer manager does not open
    };
    my_timer_callback(NULL);
    checkTM = TM_Start(timerHandle,kTimerModeIntervalTimer,1000);
    if (checkTM =! kStatus_TimerSuccess){
        	//TODO, Do something if timer manager does not open
     };

    BleApp_Start();
uint8_t check =  TM_IsTimerActive(timerHandle);
    if (checkTM =! 1){
       //TODO, Do something if timer manager does not open
	 };
...
&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;Here i have omitted the unmodified section of code that are in the beacon example. As far i can tell by following the SDK documentation the timer configuration should be correct so i'm having some issue fixing the error.&lt;BR /&gt;&lt;BR /&gt;Thank you in advance.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Mar 2025 10:00:30 GMT</pubDate>
    <dc:creator>mattia-morabito</dc:creator>
    <dc:date>2025-03-03T10:00:30Z</dc:date>
    <item>
      <title>KW45 Timer Manager issue on BLE beacon example</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2054618#M19535</link>
      <description>&lt;P&gt;Hi, first some background, i'm using the KW45B41Z Eval Board with SDK version 24.12.00. With this configuration i'm trying to modify the beacon app, in this case by adding a periodic timer.&lt;BR /&gt;&lt;BR /&gt;However i'm having some issues where the timer callback does not trigger and by debugging the application i can see that the program goes into panic for the&amp;nbsp;&lt;SPAN&gt;gAdvertisingCommandFailed_c or the&amp;nbsp;gInternalError_c reason.&lt;BR /&gt;&lt;BR /&gt;The BLE stack has not been modified, the timer initialization is the default one in the&amp;nbsp;PLATFORM_InitTimerManager function (No issues detected there). Afater this in the main i have the following configuration:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Define the timer manager handle
uint32_t timerHandle[((TIMER_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))];
//support variable to toggle the timer
static bool ledState = true;
// Define a callback for time
void my_timer_callback(void *param) {
    (void)param;  // Explicitly ignore unused parameter
	if (ledState == true) GPIO_PinWrite(GPIOA, 19U, 0);
	else GPIO_PinWrite(GPIOA, 19U, 1);
	ledState = !ledState;
}
...
int main(void)
{
...
    GPIO_PinWrite(GPIOA, 19U, 1);
    /* Start Host stack */
    BluetoothLEHost_AppInit();
    
    timer_status_t checkTM = TM_Open(timerHandle);
    if (checkTM =! kStatus_TimerSuccess){
    	//TODO, Do something if timer manager does not open
    };
    checkTM = TM_InstallCallback(timerHandle,(timer_callback_t) my_timer_callback,NULL);
    if (checkTM =! kStatus_TimerSuccess){
       	//TODO, Do something if timer manager does not open
    };
    my_timer_callback(NULL);
    checkTM = TM_Start(timerHandle,kTimerModeIntervalTimer,1000);
    if (checkTM =! kStatus_TimerSuccess){
        	//TODO, Do something if timer manager does not open
     };

    BleApp_Start();
uint8_t check =  TM_IsTimerActive(timerHandle);
    if (checkTM =! 1){
       //TODO, Do something if timer manager does not open
	 };
...
&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;Here i have omitted the unmodified section of code that are in the beacon example. As far i can tell by following the SDK documentation the timer configuration should be correct so i'm having some issue fixing the error.&lt;BR /&gt;&lt;BR /&gt;Thank you in advance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2025 10:00:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2054618#M19535</guid>
      <dc:creator>mattia-morabito</dc:creator>
      <dc:date>2025-03-03T10:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: KW45 Timer Manager issue on BLE beacon example</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2056556#M19552</link>
      <description>&lt;P style="margin: 0in; font-family: Poppins; font-size: 12.0pt; color: #2c2f31;" lang="es-MX"&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Poppins; font-size: 12.0pt; color: #2c2f31;" lang="es-MX"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Poppins; font-size: 12.0pt; color: #2c2f31;"&gt;&lt;SPAN&gt;gAdvertisingCommandFailed_c event is received when advertising could not be enabled or disabled. Reason should be contained in gapAdvertisingEvent_t.eventData.failReason.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Poppins; font-size: 12.0pt; color: #2c2f31;" lang="es-MX"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Poppins; font-size: 12.0pt; color: #2c2f31;"&gt;&lt;SPAN&gt;For the control of Timers Manager and Callback, &lt;/SPAN&gt;&lt;SPAN&gt;I will strongly recommend you to check the &lt;/SPAN&gt;&lt;SPAN&gt;Connectivity Framework Reference Manual Chapter 3.4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in;"&gt;&lt;SPAN&gt;Here is a link for it-&amp;gt; &lt;/SPAN&gt;&lt;A href="https://www.nxp.com/docs/en/reference-manual/CONNFWKRM.pdf" target="_blank"&gt;&lt;SPAN&gt;Connectivity Framework Reference Manual&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Poppins; font-size: 12.0pt; color: #2c2f31;" lang="es-MX"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Poppins; font-size: 12.0pt; color: #2c2f31;" lang="es-MX"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 21:46:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2056556#M19552</guid>
      <dc:creator>luis_maravilla</dc:creator>
      <dc:date>2025-03-05T21:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: KW45 Timer Manager issue on BLE beacon example</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2056873#M19553</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;Thanks for the documentation but it does not reflect the current API, it also lacks any example code.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It would be great if i could get a feedback on the timer creation and enabling procedure, and if any additional action is required to make the callback work within the OSA Context.&lt;BR /&gt;&lt;BR /&gt;As per the fail reason the reported error is&amp;nbsp;&lt;SPAN&gt;gInternalError_c. however the app still transmit fine. I would also like to add that without starting the BLE app the timer works fine.&lt;BR /&gt;&lt;BR /&gt;Thank you in advance,&lt;BR /&gt;Mattia&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 08:52:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2056873#M19553</guid>
      <dc:creator>mattia-morabito</dc:creator>
      <dc:date>2025-03-06T08:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: KW45 Timer Manager issue on BLE beacon example</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2061642#M19584</link>
      <description>&lt;P&gt;Hi Mattia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the late response&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some recommendations and comments for creating a timer that update with periodic time would be:&lt;/P&gt;
&lt;P&gt;-Create a handle using the TIMER_MANAGER_HANDLE_DEFINE and declare and define a timer callback.&lt;/P&gt;
&lt;P&gt;-Install Callback (TM_InstallCallback)&lt;/P&gt;
&lt;P&gt;-Allocate timer (TM_Open)&lt;/P&gt;
&lt;P&gt;-Timer can be started by using TM_Starter&lt;/P&gt;
&lt;P&gt;-Review the gAdvertisignStateChanged_c for debug if the device is not advertising.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I would strongly recommend using fsl_component_timer_manager.h library implemented in app_advertiser.c and cheking the APIs in \kw45b41zevk_beacon_bm\component\timer_manager\fsl_component_timer_manager&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For working with OSA context, I would recommend moving to FreeRTOS beacon Example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Luis&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 00:08:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/KW45-Timer-Manager-issue-on-BLE-beacon-example/m-p/2061642#M19584</guid>
      <dc:creator>luis_maravilla</dc:creator>
      <dc:date>2025-03-14T00:08:59Z</dc:date>
    </item>
  </channel>
</rss>

