S32K Flexio_Uart freertos

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K Flexio_Uart freertos

2,448 Views
173829023
Contributor I

Hello:

  I use FLEXIO to simulate UART serial port,  NXP support demo is ok, But I cann’t send and receive anything in free_rtos system , Specify system is dead when runing FLEXIO_UART_DRV_SendDataBlocking,Hope give flexio_uart demo about freertos .

pastedImage_1.png pastedImage_2.png

pastedImage_3.png

pastedImage_4.png

pastedImage_5.png

#if 1
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "clockMan1.h"
#include "pin_mux.h"
#include "flexio_uart_TX.h"
#include "osif1.h"
#include "flexio_uart_RX.h"
#include "dmaController1.h"
#if CPU_INIT_CONFIG
#include "Init_Config.h"
#endif

#include <stdint.h>
#include <stdbool.h>
#include <string.h>

#define WELCOME_MSG ("Hello World\r\n")


volatile bool g_dataReceived;

uint8_t rxBuffer;
uint8_t txBuffer;
flexio_device_state_t flexIODeviceState;
flexio_uart_state_t uartStateTX;
flexio_uart_state_t uartStateRX;

typedef struct {
uint8_t Cnt;
uint8_t Buff[50]; //
}STt_FlexUart;

STt_FlexUart TstFlexUart;


void flexio_uart_RX_Callback0(void *driverState, uart_event_t event, void *userData)
{
(void)userData;
(void)driverState;

if (event == UART_EVENT_RX_FULL)
{
/* Copy data received into the TX buffer */
txBuffer = rxBuffer;
/* Send received data */
FLEXIO_UART_DRV_SendData(&uartStateTX, &txBuffer, 1U);
/* Set new RX buffer */
FLEXIO_UART_DRV_SetRxBuffer(&uartStateRX, &rxBuffer, 1UL);
}
}

void Tst_FlexioUart(void)
{

CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);

/* Initialize pins
* - Init FlexIO UART RX and TX pins
* - See PinSettings component for more info
*/
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);

/* Init the FLEXIO device */
FLEXIO_DRV_InitDevice(INST_FLEXIO_UART_TX, &flexIODeviceState);

/* Init the FlexIO UART driver
* - 115200 baudrate
* - TX only
* - 8 bit per frame
* - Interrupt based
*/
FLEXIO_UART_DRV_Init(INST_FLEXIO_UART_TX, &flexio_uart_TX_Config0, &uartStateTX);

/* Init the FlexIO UART driver
* - 115200 baudrate
* - RX only
* - 8 bit per frame
* - Interrupt based
*/
FLEXIO_UART_DRV_Init(INST_FLEXIO_UART_RX, &flexio_uart_RX_Config0, &uartStateRX);

FLEXIO_UART_DRV_SendDataBlocking(&uartStateTX, (uint8_t * )WELCOME_MSG, strlen(WELCOME_MSG), 100);

FLEXIO_UART_DRV_ReceiveData(&uartStateRX, &rxBuffer, 1U);
}
#endif

#define oproad "deviloping "
void G4StdCommTXTask( void *pvParameters)
{
(void)pvParameters;
static u8 AccumulatTim = 0;
Type_stMSG MPUUartTxMessage;
Type_Universal_Return Result = RSLT_NG;
MPUUartTxMessage.Receiver = TASK_ID_MPU_UART_TX;
while(1)
{
Result = MsgQueueMgr_ReceiveMessage(&MPUUartTxMessage, 200);
if(Result == RSLT_OK)
{
if(1 == MPUUartTxMessage.What)
{
Tst_FlexioUart();
}
else if(2 == MPUUartTxMessage.What)
{
FLEXIO_UART_DRV_SendDataBlocking(&uartStateTX, (uint8_t * )oproad, 6, 100);
}
else if(3 == MPUUartTxMessage.What)
{
}
}
else if(Result == RSLT_TOUT)
{
}
}
}

Labels (1)
0 Kudos
Reply
3 Replies

1,932 Views
issta
Contributor I

Have you solved this problem? I got the same problem as you described:

https://community.nxp.com/t5/S32-SDK/Send-Data-using-Blocking-method-within-FreeRTOS-Fail/m-p/142599...

 

0 Kudos
Reply

2,281 Views
798023583
Contributor I

How to get NXP support demo as you show above?

0 Kudos
Reply

2,281 Views
lei_zhang1
Contributor I

Have you solved this problem? I encountered a similar problem.

Using LPUART_DRV_SendDataBlocking alone is good.

But if you use LPUART_DRV_SendDataBlocking function in FreeRTOS, it will not return. I had to use LPUART_DRV_SendData to output data.

0 Kudos
Reply