[Resolved] False UART RX Trigger Once at Startup
I am currently using a PIC24FJ1024GA610, and I have implemented some UART code. Everything seems to be working fine, except at power up, where the RX interrupt will be falsely triggered once (URXDA is also set, implying that there is data).
I also tried removing the UART application code, so that the device only initializes the UART peripheral and doesn't do anything else. Same false RX trigger will occur.
Here is my UART initialize function. Please note that UTXEN is not set because I want to use the alternative method to start transmission ("The transmission can also be started by first loading the UxTXREG register and then setting the UTXEN enable bit" from Section 21.5 UART Transmitter in the PIC24F Family Reference Manual).
IEC0bits.U1RXIE = 0;
IEC0bits.U1TXIE = 0;
U1BRG = 25;//BRGH = 0, U1BRG = ((FCY/BaudRate)/16) - 1
U1STA = 0x0000;
U1STAbits.UTXISEL0 = 1;
U1STAbits.UTXISEL1 = 0;
U1MODE = 0x0000;
U1MODEbits.UARTEN = 1;
IEC0bits.U1RXIE = 1;
IEC0bits.U1TXIE = 1;
Also if applicable, this is what I used to set the pins.
RPINR18bits.U1RXR = 0x001A; //RG7->UART1:U1RX
RPOR10bits.RP21R = 0x0003; //RG6->UART1:U1TX
Thank you in advance for your help!
post edited by olochua - 2020/07/02 09:47:07