I only can receive 5 bytes from UART0 with JN5168. Who can tell what the reason is? Thank you!
void UartInit(void)
{
vAHI_UartSetRTSCTS(UART, FALSE);
vAHI_UartEnable(UART);
/* Reset UART */
vAHI_UartReset(UART, TRUE, TRUE);
vAHI_UartReset(UART, FALSE, FALSE);
vAHI_UartSetBaudRate(UART, E_AHI_UART_RATE_115200);
/* Set remaining settings */
vAHI_UartSetControl(UART, FALSE, FALSE, E_AHI_UART_WORD_LEN_8, TRUE, FALSE);
vAHI_UartSetInterrupt(UART, FALSE, FALSE, TRUE, TRUE, E_AHI_UART_FIFO_LEVEL_1);
vInitPrintf((void *)vPutChar);
}
PRIVATE void vProcessIncomingHwEvent(AppQApiHwInd_s *psAHI_Ind)
{
if (psAHI_Ind->u32DeviceId == E_AHI_DEVICE_UART0)
{
if ((psAHI_Ind->u32ItemBitmap & 0x000000FF) == E_AHI_UART_INT_RXDATA)
{
/* Store Data */
uart0_rxBuffer[uart0_rd] = (uint8)((psAHI_Ind->u32ItemBitmap & 0x0000FF00) >> 8);
uart0_rd = (uart0_rd + 1) % RX_BUFF_SIZE;
}
}
}
Hi Liang Guo,
You are enabling the interrupt. You could use the ISR.
PUBLIC void APP_isrUart(void)
{
unsigned int irq = ((*((volatile uint32 *)(UART_START_ADR + 0x08))) >> 1) & 0x0007;
uint8 u8Byte;
if (irq & E_AHI_UART_INT_RXDATA) {
uint8 u8Byte = u8AHI_UartReadData(UART);
if(ZQ_bQueueSend(&APP_msgSerialRx, &u8Byte) == FALSE)
{
/* Failed to send the message to queue */
}
}
if (irq & E_AHI_UART_INT_TX) {
if(ZQ_bQueueReceive(&APP_msgSerialTx, &u8Byte) == TRUE)
{
vAHI_UartWriteData(UART, u8Byte);
/* decrement activity counter for dequeued data */
} else {
/* disable tx interrupt as nothing to send */
UART_vSetTxInterrupt(FALSE);
}
}
}
Mario
Hi Liang Guo,
Did you solver the uart callback?
Regards,
Mario