<?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 Re: Using the FreeRTOS BLE Abstraction Layer Stack to create Tasks and Queues in MCUXpresso SDK</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1185176#M2883</link>
    <description>&lt;P&gt;The problem was the serial baudrate.Changing the baudrate to 230400 in&lt;/P&gt;&lt;P&gt;wireless_uart.c BleApp_Init() as follows solved the problem.&lt;/P&gt;&lt;P&gt;(void)Serial_SetBaudRate(gAppSerMgrIf, (uint32_t)gUARTBaudRate230400_c);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2020 11:12:04 GMT</pubDate>
    <dc:creator>tufantakak</dc:creator>
    <dc:date>2020-11-18T11:12:04Z</dc:date>
    <item>
      <title>Using the FreeRTOS BLE Abstraction Layer Stack to create Tasks and Queues</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1179747#M2868</link>
      <description>&lt;P&gt;I am developing a ble application based on the wireless uart freertos demo of the sdk_2.x_frdm kw 36 sdk. version 2.2.5.&lt;/P&gt;&lt;P&gt;I am trying to create a new task and&amp;nbsp; a&amp;nbsp;&lt;SPAN&gt;queue&amp;nbsp; as described in the following document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.nxp.com/t5/NXP-Designs-Knowledge-Base/Using-the-QN908x-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create/ta-p/1100097" target="_blank"&gt;https://community.nxp.com/t5/NXP-Designs-Knowledge-Base/Using-the-QN908x-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create/ta-p/1100097&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;After the task creation, the method call to Init the ble host stack returns&amp;nbsp;gBleOsError_c.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if (Ble_Initialize(App_GenericCallback) != gBleSuccess_c)&lt;BR /&gt;{&lt;BR /&gt;panic(0,0,0,0);&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Disabling the newly created task makes the code initialize&amp;nbsp; the host stack.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Further debugging shows that&amp;nbsp; &amp;nbsp;task creation mHost_TaskId = OSA_TaskCreate(OSA_TASK(Host_Task), NULL); fails&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;in ble_host_tasks.c as mHost_TaskId is returned null.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help will be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2020 15:55:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1179747#M2868</guid>
      <dc:creator>tufantakak</dc:creator>
      <dc:date>2020-11-08T15:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using the FreeRTOS BLE Abstraction Layer Stack to create Tasks and Queues</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1179792#M2869</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I guess the stack you allocate for the task is too large. Reduce it. If not, please debug into the function&amp;nbsp;&lt;SPAN&gt;OSA_TaskCreate to make sense of why it returns NULL.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;
&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;
&lt;P&gt;- We are following threads for 7 days after the last post, later replies are ignored&lt;BR /&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 02:17:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1179792#M2869</guid>
      <dc:creator>nxf56274</dc:creator>
      <dc:date>2020-11-09T02:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using the FreeRTOS BLE Abstraction Layer Stack to create Tasks and Queues</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1179886#M2870</link>
      <description>&lt;P&gt;Thanks for the fast reponse.I will check and inform about the result.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 06:27:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1179886#M2870</guid>
      <dc:creator>tufantakak</dc:creator>
      <dc:date>2020-11-09T06:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using the FreeRTOS BLE Abstraction Layer Stack to create Tasks and Queues</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1180024#M2871</link>
      <description>&lt;P&gt;default host task stack size ( gHost_TaskStackSize_c in ble_host_task.h file) was 1500.reducing it solved the problem.&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 10:06:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1180024#M2871</guid>
      <dc:creator>tufantakak</dc:creator>
      <dc:date>2020-11-09T10:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using the FreeRTOS BLE Abstraction Layer Stack to create Tasks and Queues</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1183969#M2879</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;I previously marked your answer as solution but&amp;nbsp; as I proceeded&amp;nbsp; I figured out that&amp;nbsp; reducing the stack size for the newly created task did not solve my problem.&lt;/P&gt;&lt;P&gt;So I cancelled creating a new task.To explain briefly ,I get messages form android phone and try to send back particular responses through ble.&lt;/P&gt;&lt;P&gt;I receive data without any problem. I process the data form a response stream and send it as follows.&lt;/P&gt;&lt;P&gt;void SendMessage(uint8_t * pMsg,uint16_t msgLen){&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;uint8_t *pBuffer = NULL;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Allocate buffer for asynchronous write */&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pBuffer = MEM_BufferAlloc(msgLen);&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;if (pBuffer != NULL)&lt;BR /&gt;{&lt;BR /&gt;FLib_MemCpy(pBuffer , pMsg, (uint32_t)msgLen);&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;BR /&gt;(void)Serial_AsyncWrite(gAppSerMgrIf, pBuffer, msgLen, Uart_RxCallBack, pBuffer);&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Here are my callback functions&lt;/P&gt;&lt;P&gt;void Uart_RxCallBack(void *pData)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;uint16_t byteCount = 0;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;(void)Serial_RxBufferByteCount(gAppSerMgrIf, &amp;amp;byteCount);&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;if (byteCount &amp;lt; mAppUartBufferSize)&lt;BR /&gt;{&lt;BR /&gt;/* Restart flush timer */&lt;BR /&gt;(void)TMR_StartLowPowerTimer(mUartStreamFlushTimerId,&lt;BR /&gt;gTmrLowPowerSingleShotMillisTimer_c,&lt;BR /&gt;mAppUartFlushIntervalInMs_c,&lt;BR /&gt;UartStreamFlushTimerCallback, NULL);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;/* Post App Msg only one at a time */&lt;BR /&gt;if (!mAppDapaPending)&lt;BR /&gt;{&lt;BR /&gt;mAppDapaPending = TRUE;&lt;BR /&gt;(void)App_PostCallbackMessage(BleApp_FlushUartStream, NULL);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;static void UartStreamFlushTimerCallback(void *pData)&lt;BR /&gt;{&lt;BR /&gt;if (!mAppDapaPending)&lt;BR /&gt;{&lt;BR /&gt;mAppDapaPending = TRUE;&lt;BR /&gt;(void)App_PostCallbackMessage(BleApp_FlushUartStream, NULL);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;static void BleApp_FlushUartStream(void *pParam)&lt;BR /&gt;{&lt;BR /&gt;uint8_t *pMsg = NULL;&lt;BR /&gt;uint16_t bytesRead = 0;&lt;BR /&gt;uint8_t mPeerId = 0;&lt;BR /&gt;bool_t mValidDevices = FALSE;&lt;/P&gt;&lt;P&gt;/* Valid devices are in Running state */&lt;BR /&gt;for (mPeerId = 0; mPeerId &amp;lt; (uint8_t)gAppMaxConnections_c; mPeerId++)&lt;BR /&gt;{&lt;BR /&gt;if ((gInvalidDeviceId_c != maPeerInformation[mPeerId].deviceId) &amp;amp;&amp;amp;&lt;BR /&gt;(mAppRunning_c == maPeerInformation[mPeerId].appState))&lt;BR /&gt;{&lt;BR /&gt;mValidDevices = TRUE;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (mValidDevices)&lt;BR /&gt;{&lt;BR /&gt;/* Allocate buffer for GATT Write */&lt;BR /&gt;pMsg = MEM_BufferAlloc(mAppUartBufferSize);&lt;/P&gt;&lt;P&gt;if (pMsg != NULL)&lt;BR /&gt;{&lt;BR /&gt;/* Collect the data from the serial manager buffer */&lt;BR /&gt;if (Serial_Read(gAppSerMgrIf, pMsg, mAppUartBufferSize, &amp;amp;bytesRead) == gSerial_Success_c)&lt;BR /&gt;{&lt;BR /&gt;if (bytesRead != 0U)&lt;BR /&gt;{&lt;BR /&gt;/* Send data over the air */&lt;BR /&gt;BleApp_SendUartStream(pMsg, (uint8_t)bytesRead);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* Free Buffer */&lt;BR /&gt;(void)MEM_BufferFree(pMsg);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;mAppDapaPending = FALSE;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I simply send "pong" as an indicator of established ble link. I see first two letters of the pong message as "po" on serial terminal and immediately get&lt;BR /&gt;a hard fault.&lt;/P&gt;&lt;P&gt;These are my stack szie definitons&lt;BR /&gt;#define gHost_TaskStackSize_c 1200&lt;/P&gt;&lt;P&gt;#define gControllerTaskStackSize_c 1200&lt;/P&gt;&lt;P&gt;/* Defines Size for Serial Manager Task*/&lt;BR /&gt;#define gSerialTaskStackSize_c 500&lt;/P&gt;&lt;P&gt;/* Defines Size for TMR Task*/&lt;BR /&gt;#define gTmrTaskStackSize_c 600&lt;/P&gt;&lt;P&gt;I have been messing with nearly all available stack size combinations with no success.&lt;BR /&gt;Nay help will be appreciated.&lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 15:52:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1183969#M2879</guid>
      <dc:creator>tufantakak</dc:creator>
      <dc:date>2020-11-16T15:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using the FreeRTOS BLE Abstraction Layer Stack to create Tasks and Queues</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1185176#M2883</link>
      <description>&lt;P&gt;The problem was the serial baudrate.Changing the baudrate to 230400 in&lt;/P&gt;&lt;P&gt;wireless_uart.c BleApp_Init() as follows solved the problem.&lt;/P&gt;&lt;P&gt;(void)Serial_SetBaudRate(gAppSerMgrIf, (uint32_t)gUARTBaudRate230400_c);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 11:12:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/Using-the-FreeRTOS-BLE-Abstraction-Layer-Stack-to-create-Tasks/m-p/1185176#M2883</guid>
      <dc:creator>tufantakak</dc:creator>
      <dc:date>2020-11-18T11:12:04Z</dc:date>
    </item>
  </channel>
</rss>

