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.
Hi Gao,
Did you set the direction for that specific pins as an input?
Please look the next community post.
https://community.nxp.com/thread/461239
Regards,
Mario
Thank you for your reply.
I have set the direction for the DIO7 as an input, but it no effects.
I am working on the JN-AN-1189.
Have you reproduced this problem on the JN-AN-1189?
Can you normally use UART0 to receive data on JN-AN-1189?
The codes as follow:
#define UART0_RXD (1<<7)
#define UART0_TXD (1<<6)
PRIVATE void vUart_Init(void)
{
vAHI_DioSetDirection(0, UART0_TXD);
vAHI_DioSetDirection(UART0_RXD, 0);
vAHI_DioSetPullup(0, UART0_TXD);
vAHI_DioSetPullup(UART0_RXD, 0);
vAHI_UartSetRTSCTS(E_AHI_UART_0, FALSE);
vAHI_UartEnable(E_AHI_UART_0);
vAHI_UartReset(E_AHI_UART_0, TRUE, TRUE);
vAHI_UartReset(E_AHI_UART_0, FALSE, FALSE);
vAHI_Uart0RegisterCallback ( os_vAPP_myCoordisrUart );
vAHI_UartSetBaudRate(E_AHI_UART_0, E_AHI_UART_RATE_9600);
vAHI_UartSetControl(E_AHI_UART_0, FALSE, FALSE, E_AHI_UART_WORD_LEN_8, TRUE, FALSE); /* [I SP001222_P1 279] */
vAHI_UartSetInterrupt(E_AHI_UART_0, FALSE, FALSE, TRUE, TRUE, E_AHI_UART_FIFO_LEVEL_1);
}
Hi Gao Lei,
DId you modify the makefile? Are you seeing the debug UART?
What is the example that you are selecting in the JN-AN-1189? I will try by my side.
Regards,
Mario