如题,一次最多发送35个字节,超过35个打印信息那里就会卡死,IC就没反应了,并且连续发送35个字节的情况下发送间隔需在40ms以上,不然还是会卡死
void UartDataValid_Handler(UINT8* buf, UINT32 u32Len)
{
// sysPrintf("u32Len = %x\n\r", u32Len);
UINT32 u32Idx = 0;
static UINT32 g_u32Idx = 0;
static UINT8 recv_idx = 0;
static UINT8 packet_head_flag = 1;
static UINT8 packet_first_flag = 0;
static UINT8 packet_length = 0;
static UINT8 RxState = 0;
memcpy(&(pi8UartBuf[g_u32Idx]), buf, u32Len);
UINT8 RxData = pi8UartBuf[g_u32Idx];
// g_u32Idx = g_u32Idx + u32Len;
g_u32Idx = 0;
sysPrintf("RxData = %x, u32Len = %d\n\r", (*buf), u32Len);
}
void DemoAPI_HUART(void)
{
WB_UART_T uart;
UINT32 u32ExtFreq;
register_uart_device(0, &UART0);
pUART0 = &UART0;
pUART0->UartPort(0);
u32ExtFreq = sysGetExternalClock();
uart.uiFreq = u32ExtFreq*1000;
uart.uiBaudrate = 230400;
uart.uiDataBits = WB_DATA_BITS_8;
uart.uiStopBits = WB_STOP_BITS_1;
uart.uiParity = WB_PARITY_NONE;
uart.uiRxTriggerLevel = LEVEL_1_BYTE;
pUART0->UartInitialize(&uart);
pUART0->UartEnableInt(UART_INT_RDA);
pUART0->UartInstallcallback(0, UartDataValid_Handler);
pUART0->UartInstallcallback(1, UartDataTimeOut_Handler);
}
|