Hello,
I use FreeRTOS component and FlexCAN and LPUART, in order to communicated with HOST!
The MCU is S32K148 and SDK version is V3.0.3, IDE is S32 Design Studio for ARM v2.2.
I found that using XXXX_SendDataBlocking() will let the program stay where it called, and the function never get return. No matter I use CAN module Blocking method (LPUART_DRV_SendDataBlocking(....)) or LPUAR module Blocking method (FLEXCAN_DRV_SendBlocking(...)), the result is same!
It seems that within the XXXX_SendDataBlocking() function :
syncStatus = OSIF_SemaWait(&lpuartState->txComplete, timeout);
function OSIF_SemaWait() never get a return Sema-signal, so the program 'die' and wait forever there..
Below testing shows that: the character send successfully by LPUART, but the program still 'die'!
By the way ,the non-blocking method LPUART_DRV_SendDataPolling(....) and FLEXCAN_DRV_Send(.....) works fine!
Maybe the way of function calling I used under FreeRTOS is warong, or something else wrong! But I have no way...
Anyone who can Help me ?
The key function used is :
/*-----------------------------------------------------------*/
void rtos_start( void )
{
prvSetupHardware();
prvSetupSoftware();
printf("\n[2]: System Task Creating ...\n");
fflush((void*)stdout);
xTaskCreate(prvMasterRootTask, "RootStrt", configRTOS_BASIC_STACK_SIZE, NULL, mainROOT_START_TSK_PRIORITY, &RootStrtTask_TskHdl);
vTaskStartScheduler();
for (;; );
}
/*-----------------------------------------------------------*/
static void prvMasterRootTask(void* pvParameters)
{
/* Casting pvParameters to void because it is unused */
(void)pvParameters;
printf("\n[3]: Task Scheduler Is Now Running...\n");
fflush((void*)stdout);
uint8_t txBuff[40];
uint32_t nLen;
for( ;; )
{
nLen = snprintf((char*)txBuff, sizeof(txBuff), "\nh\n\r");
/* LPUART_DRV_SendDataPolling(INST_LPUART1, txBuff, nLen); */
LPUART_DRV_SendDataBlocking(INST_LPUART1, txBuff, nLen, 8000);
vTaskDelay(300 / portTICK_PERIOD_MS);
}
}
the Host can get the flowing result:
[0]: Hardware Initialize Completed...
[1]: App. Init. Finished!...
[2]: System Task Creating ...
[3]: Task Scheduler Is Now Running...
h