AnsweredAssumed Answered

can not enter the callback function about UART0

Question asked by Gao Lei on Sep 18, 2018
Latest reply on Sep 25, 2018 by Gao Lei

I am working on the JN-AN-1189, and I want receive data from UART0.

 

The code as below:

PRIVATE void vUart_Init(void)
{
vAHI_UartEnable(E_AHI_UART_0);
vAHI_UartReset(E_AHI_UART_0, TRUE, TRUE);
vAHI_UartReset(E_AHI_UART_0, FALSE, FALSE);
vAHI_UartSetBaudRate(E_AHI_UART_0, E_AHI_UART_RATE_115200);
vAHI_UartSetRTSCTS(E_AHI_UART_0, FALSE);
vAHI_UartSetControl(E_AHI_UART_0, FALSE, FALSE, E_AHI_UART_WORD_LEN_8, TRUE, FALSE); /* [I SP001222_P1 279] */
vAHI_Uart0RegisterCallback ( APP_myisrUart );
vAHI_UartSetInterrupt(E_AHI_UART_0, FALSE, TRUE, TRUE, TRUE, E_AHI_UART_FIFO_LEVEL_1);
}

 

PUBLIC void APP_myisrUart(uint32 u32Device, uint32 u32ItemBitmap)
{
unsigned int irq = ((*((volatile uint32 *)(UART_START_ADR + 0x08))) >> 1) & 0x0007;
uint8 u8Byte;
vAHI_UartWriteData(E_AHI_UART_0, 0x33);
vAHI_UartWriteData(E_AHI_UART_0, 0x33);
if (irq & E_AHI_UART_INT_RXDATA)
{
u8Byte = u8AHI_UartReadData(E_AHI_UART_0);
vAHI_UartWriteData(E_AHI_UART_0, u8Byte);
//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(E_AHI_UART_0, u8Byte);
decrement activity counter for dequeued data
}
else
{
disable tx interrupt as nothing to send
UART_vSetTxInterrupt(FALSE);
}*/
}
}

 

Note: I have seen the suggestions in JN5168 UART vAHI_Uart0RegisterCallback() Using, but it no effects.

Outcomes