<?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>LPC MicrocontrollersのトピックRe: freertos multiple task</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/freertos-multiple-task/m-p/1627244#M52103</link>
    <description>&lt;P&gt;what exactly is not running or working?&lt;/P&gt;&lt;P&gt;I suggest that you try a simpler example: just create a single task and run it. Set a breakpoint in the task to verify it is executed.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2023 03:08:10 GMT</pubDate>
    <dc:creator>ErichStyger</dc:creator>
    <dc:date>2023-04-04T03:08:10Z</dc:date>
    <item>
      <title>freertos multiple task</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/freertos-multiple-task/m-p/1626810#M52101</link>
      <description>&lt;P&gt;Hi, all&lt;/P&gt;&lt;P&gt;I am using lpc54so18 and i am trying rtos project using multiple task but it is not running multiple task how to solve these problem&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;sachin nadugeri&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;* Copyright (c) 2015, Freescale Semiconductor, Inc.&lt;BR /&gt;* Copyright 2016-2017 NXP&lt;BR /&gt;* All rights reserved.&lt;BR /&gt;*&lt;BR /&gt;* SPDX-License-Identifier: BSD-3-Clause&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;/* FreeRTOS kernel includes. */&lt;BR /&gt;#include "FreeRTOS.h"&lt;BR /&gt;#include "task.h"&lt;BR /&gt;#include "queue.h"&lt;BR /&gt;#include "timers.h"&lt;/P&gt;&lt;P&gt;/* Freescale includes. */&lt;BR /&gt;#include "fsl_device_registers.h"&lt;BR /&gt;#include "fsl_debug_console.h"&lt;BR /&gt;#include "pin_mux.h"&lt;BR /&gt;#include "board.h"&lt;BR /&gt;#include "fsl_usart.h"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#include &amp;lt;stdbool.h&amp;gt;&lt;BR /&gt;/*******************************************************************************&lt;BR /&gt;* Definitions&lt;BR /&gt;******************************************************************************/&lt;BR /&gt;#define DEMO_USART USART0&lt;BR /&gt;#define DEMO_USART_CLK_FREQ CLOCK_GetFlexCommClkFreq(0U)&lt;BR /&gt;#define ECHO_BUFFER_LENGTH 10&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#define USART_4 USART4&lt;BR /&gt;#define USART4_CLK_FREQ CLOCK_GetFlexCommClkFreq(0U)&lt;/P&gt;&lt;P&gt;/* Task priorities. */&lt;BR /&gt;#define USART0_task_PRIORITY (configMAX_PRIORITIES - 1)&lt;BR /&gt;#define USART1_task_PRIORITY (configMAX_PRIORITIES - 2)&lt;BR /&gt;#define USART2_task_PRIORITY (configMAX_PRIORITIES - 3)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*******************************************************************************&lt;BR /&gt;* Prototypes&lt;BR /&gt;******************************************************************************/&lt;BR /&gt;static void USART_0(void *pvParameters);&lt;BR /&gt;static void USART_1(void *pvParameters);&lt;BR /&gt;static void USART_2(void *pvParameters);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;uint8_t g_txBuffer[]={0};&lt;BR /&gt;uint8_t g_rxBuffer[]={0};&lt;/P&gt;&lt;P&gt;uint8_t g_txBuffer1[]={0};&lt;BR /&gt;uint8_t g_rxBuffer1[]={0};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;volatile bool rxBufferEmpty = true;&lt;BR /&gt;volatile bool txBufferFull = false;&lt;BR /&gt;volatile bool txOnGoing = false;&lt;BR /&gt;volatile bool rxOnGoing = false;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;volatile bool rxBufferEmpty1 = true;&lt;BR /&gt;volatile bool txBufferFull1 = false;&lt;BR /&gt;volatile bool txOnGoing1 = false;&lt;BR /&gt;volatile bool rxOnGoing1 = false;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* USART user callback */&lt;BR /&gt;void USART_UserCallback(USART_Type *base, usart_handle_t *handle, status_t status, void *userData);&lt;BR /&gt;void USART_UserCallback1(USART_Type *base, usart_handle_t *handle, status_t status, void *userData);&lt;/P&gt;&lt;P&gt;usart_handle_t g_uartHandle;&lt;BR /&gt;usart_handle_t g_uartHandle1;&lt;/P&gt;&lt;P&gt;uint8_t g_tipString[] ="START please input:-\r\n";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void USART_UserCallback(USART_Type *base, usart_handle_t *handle, status_t status, void *userData)&lt;BR /&gt;{&lt;BR /&gt;//PRINTF(" USART_UserCallback done kStatus_USART_TxIdle=&amp;gt;%d ,status -&amp;gt;%d kStatus_USART_RxIdle=&amp;gt;%d\n",kStatus_USART_TxIdle,status,kStatus_USART_RxIdle);&lt;BR /&gt;userData = userData;&lt;BR /&gt;//PRINTF("userData %d\n",*(int*)userData);&lt;/P&gt;&lt;P&gt;if (kStatus_USART_TxIdle == status)&lt;BR /&gt;{&lt;BR /&gt;txBufferFull = false;&lt;BR /&gt;txOnGoing = false;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (kStatus_USART_RxIdle == status)&lt;BR /&gt;{&lt;BR /&gt;rxBufferEmpty = false;&lt;BR /&gt;rxOnGoing = false;&lt;BR /&gt;// count=0;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;void USART_UserCallback1(USART_Type *base, usart_handle_t *handle, status_t status, void *userData)&lt;BR /&gt;{&lt;BR /&gt;//PRINTF(" USART_UserCallback done kStatus_USART_TxIdle=&amp;gt;%d ,status -&amp;gt;%d kStatus_USART_RxIdle=&amp;gt;%d\n",kStatus_USART_TxIdle,status,kStatus_USART_RxIdle);&lt;BR /&gt;userData = userData;&lt;BR /&gt;//PRINTF("userData %d\n",*(int*)userData);&lt;/P&gt;&lt;P&gt;if (kStatus_USART_TxIdle == status)&lt;BR /&gt;{&lt;BR /&gt;txBufferFull1 = false;&lt;BR /&gt;txOnGoing1 = false;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (kStatus_USART_RxIdle == status)&lt;BR /&gt;{&lt;BR /&gt;rxBufferEmpty1 = false;&lt;BR /&gt;rxOnGoing1 = false;&lt;BR /&gt;// count=0;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;/*******************************************************************************&lt;BR /&gt;* Code&lt;BR /&gt;******************************************************************************/&lt;BR /&gt;/*!&lt;BR /&gt;* @brief Application entry point.&lt;BR /&gt;*/&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;/* Init board hardware. */&lt;BR /&gt;usart_config_t config,config1;&lt;BR /&gt;usart_transfer_t xfer;&lt;/P&gt;&lt;P&gt;/* attach 12 MHz clock to FLEXCOMM0 (debug console) */&lt;BR /&gt;CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);&lt;BR /&gt;CLOCK_AttachClk(BOARD_DEBUG_UART4_CLK_FREQ);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BOARD_InitBootPins();&lt;BR /&gt;BOARD_InitBootClocks();&lt;BR /&gt;BOARD_InitDebugConsole();&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt;* config.baudRate_Bps = 115200U;&lt;BR /&gt;* config.parityMode = kUSART_ParityDisabled;&lt;BR /&gt;* config.stopBitCount = kUSART_OneStopBit;&lt;BR /&gt;* config.loopback = false;&lt;BR /&gt;* config.enableTx = false;&lt;BR /&gt;* config.enableRx = false;&lt;BR /&gt;*/&lt;/P&gt;&lt;P&gt;USART_GetDefaultConfig(&amp;amp;config);&lt;/P&gt;&lt;P&gt;config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;&lt;BR /&gt;config.enableTx = true;&lt;BR /&gt;config.enableRx = true;&lt;/P&gt;&lt;P&gt;USART_Init(DEMO_USART, &amp;amp;config, DEMO_USART_CLK_FREQ);&lt;BR /&gt;USART_TransferCreateHandle(DEMO_USART, &amp;amp;g_uartHandle, USART_UserCallback,&lt;BR /&gt;NULL);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;USART_GetDefaultConfig(&amp;amp;config1);&lt;/P&gt;&lt;P&gt;config1.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;&lt;BR /&gt;config1.enableTx = true;&lt;BR /&gt;config1.enableRx = true;&lt;/P&gt;&lt;P&gt;USART_Init(USART_4, &amp;amp;config, USART4_CLK_FREQ);&lt;BR /&gt;USART_TransferCreateHandle(USART_4, &amp;amp;g_uartHandle1, USART_UserCallback1,&lt;BR /&gt;NULL);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Send g_tipString out. */&lt;BR /&gt;xfer.data = g_tipString;&lt;BR /&gt;xfer.dataSize = sizeof(g_tipString) - 1;&lt;BR /&gt;txOnGoing = true;&lt;BR /&gt;PRINTF("\n");&lt;BR /&gt;USART_TransferSendNonBlocking(DEMO_USART, &amp;amp;g_uartHandle, &amp;amp;xfer);&lt;BR /&gt;USART_TransferSendNonBlocking(USART_4, &amp;amp;g_uartHandle1, &amp;amp;xfer);&lt;/P&gt;&lt;P&gt;/* Wait send finished */&lt;BR /&gt;while (txOnGoing)&lt;BR /&gt;{&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (xTaskCreate(USART_0, "Hello_task", configMINIMAL_STACK_SIZE + 100, NULL, USART0_task_PRIORITY, NULL) !=&lt;BR /&gt;pdPASS)&lt;BR /&gt;{&lt;BR /&gt;PRINTF("Task creation failed!.\r\n");&lt;BR /&gt;while (1)&lt;BR /&gt;;&lt;BR /&gt;}&lt;BR /&gt;if (xTaskCreate(USART_1, "Hello_task", configMINIMAL_STACK_SIZE + 100, NULL, USART1_task_PRIORITY, NULL) !=&lt;BR /&gt;pdPASS)&lt;BR /&gt;{&lt;BR /&gt;PRINTF("Task creation failed!.\r\n");&lt;BR /&gt;while (1)&lt;BR /&gt;;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (xTaskCreate(USART_2, "Hello_task", configMINIMAL_STACK_SIZE + 100, NULL, USART2_task_PRIORITY, NULL) !=&lt;BR /&gt;pdPASS)&lt;BR /&gt;{&lt;BR /&gt;PRINTF("Task creation failed!.\r\n");&lt;BR /&gt;while (1)&lt;BR /&gt;;&lt;BR /&gt;}&lt;BR /&gt;vTaskStartScheduler();&lt;BR /&gt;for (;;)&lt;BR /&gt;;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/*!&lt;BR /&gt;* @brief Task responsible for printing of "Hello world." message.&lt;BR /&gt;*/&lt;BR /&gt;static void USART_0(void *pvParameters)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;usart_transfer_t sendXfer;&lt;BR /&gt;usart_transfer_t receiveXfer;&lt;/P&gt;&lt;P&gt;sendXfer.data = g_txBuffer;&lt;BR /&gt;sendXfer.dataSize = sizeof(g_txBuffer);&lt;BR /&gt;receiveXfer.data = g_rxBuffer;&lt;BR /&gt;receiveXfer.dataSize = sizeof(g_rxBuffer);&lt;BR /&gt;PRINTF("start USART_0 TASK.\r\n");&lt;/P&gt;&lt;P&gt;for (;;)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* If RX is idle and g_rxBuffer is empty, start to read data to g_rxBuffer. */&lt;BR /&gt;if ((!rxOnGoing) &amp;amp;&amp;amp; rxBufferEmpty) {&lt;BR /&gt;rxOnGoing = true;&lt;BR /&gt;USART_TransferReceiveNonBlocking(DEMO_USART,&lt;BR /&gt;&amp;amp;g_uartHandle, &amp;amp;receiveXfer, NULL);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/* If TX is idle and g_txBuffer is full, start to send data. */&lt;BR /&gt;if ((!txOnGoing) &amp;amp;&amp;amp; txBufferFull) {&lt;BR /&gt;txOnGoing = true;&lt;BR /&gt;status_t val = USART_TransferSendNonBlocking(DEMO_USART,&lt;BR /&gt;&amp;amp;g_uartHandle, &amp;amp;sendXfer);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* If g_txBuffer is empty and g_rxBuffer is full, copy g_rxBuffer to g_txBuffer. */&lt;BR /&gt;if ((!rxBufferEmpty) &amp;amp;&amp;amp; (!txBufferFull)) {&lt;BR /&gt;// memcpy(g_txBuffer, g_rxBuffer,ECHO_BUFFER_LENGTH );//for fixed len&lt;BR /&gt;memcpy(g_txBuffer, g_rxBuffer, sizeof(g_rxBuffer)); // for dynamic len&lt;BR /&gt;rxBufferEmpty = true;&lt;BR /&gt;txBufferFull = true;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//vTaskSuspend(NULL);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;static void USART_1(void *pvParameters)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PRINTF("second task running.\r\n");&lt;BR /&gt;usart_transfer_t sendXfer1;&lt;BR /&gt;usart_transfer_t receiveXfer1;&lt;/P&gt;&lt;P&gt;sendXfer1.data = g_txBuffer1;&lt;BR /&gt;sendXfer1.dataSize = sizeof(g_txBuffer1);&lt;BR /&gt;receiveXfer1.data = g_rxBuffer1;&lt;BR /&gt;receiveXfer1.dataSize = sizeof(g_rxBuffer1);&lt;BR /&gt;PRINTF("start USART_1 TASK.\r\n");&lt;/P&gt;&lt;P&gt;for (;;)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* If RX is idle and g_rxBuffer is empty, start to read data to g_rxBuffer. */&lt;BR /&gt;if ((!rxOnGoing1) &amp;amp;&amp;amp; rxBufferEmpty1) {&lt;BR /&gt;rxOnGoing1 = true;&lt;BR /&gt;USART_TransferReceiveNonBlocking(DEMO_USART,&lt;BR /&gt;&amp;amp;g_uartHandle1, &amp;amp;receiveXfer1, NULL);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;/* If TX is idle and g_txBuffer is full, start to send data. */&lt;BR /&gt;if ((!txOnGoing1) &amp;amp;&amp;amp; txBufferFull1) {&lt;BR /&gt;txOnGoing1 = true;&lt;BR /&gt;status_t val = USART_TransferSendNonBlocking(DEMO_USART,&lt;BR /&gt;&amp;amp;g_uartHandle1, &amp;amp;sendXfer1);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/* If g_txBuffer is empty and g_rxBuffer is full, copy g_rxBuffer to g_txBuffer. */&lt;BR /&gt;if ((!rxBufferEmpty) &amp;amp;&amp;amp; (!txBufferFull)) {&lt;BR /&gt;// memcpy(g_txBuffer, g_rxBuffer,ECHO_BUFFER_LENGTH );//for fixed len&lt;BR /&gt;memcpy(g_txBuffer, g_rxBuffer, sizeof(g_rxBuffer)); // for dynamic len&lt;BR /&gt;rxBufferEmpty = true;&lt;BR /&gt;txBufferFull = true;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;// vTaskSuspend(NULL);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;static void USART_2(void *pvParameters)&lt;BR /&gt;{&lt;BR /&gt;for (;;)&lt;BR /&gt;{&lt;BR /&gt;PRINTF("USART_2.\r\n");&lt;BR /&gt;vTaskSuspend(NULL);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 10:50:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/freertos-multiple-task/m-p/1626810#M52101</guid>
      <dc:creator>sachinn434</dc:creator>
      <dc:date>2023-04-03T10:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: freertos multiple task</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/freertos-multiple-task/m-p/1627187#M52102</link>
      <description>&lt;P&gt;HI &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/213466"&gt;@sachinn434&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;You can find some examples of FreeRTOS that can guide you on your design on SDK&amp;nbsp; (&lt;/SPAN&gt; &lt;A href="https://mcuxpresso.nxp.com/en/welcome" target="_blank"&gt;&lt;SPAN&gt;https://mcuxpresso.nxp.com/en/welcome&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 01:39:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/freertos-multiple-task/m-p/1627187#M52102</guid>
      <dc:creator>CarlosGarabito</dc:creator>
      <dc:date>2023-04-04T01:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: freertos multiple task</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/freertos-multiple-task/m-p/1627244#M52103</link>
      <description>&lt;P&gt;what exactly is not running or working?&lt;/P&gt;&lt;P&gt;I suggest that you try a simpler example: just create a single task and run it. Set a breakpoint in the task to verify it is executed.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 03:08:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/freertos-multiple-task/m-p/1627244#M52103</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2023-04-04T03:08:10Z</dc:date>
    </item>
  </channel>
</rss>

