• AVR Freaks

Hot![Resolved] False UART RX Trigger Once at Startup

Author
olochua
Starting Member
  • Total Posts : 59
  • Reward points : 0
  • Joined: 2017/06/06 10:38:42
  • Location: 0
  • Status: offline
2020/07/02 09:35:27 (permalink)
0

[Resolved] False UART RX Trigger Once at Startup

Hey all,
 
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).
 
void UART1_Initialize(void)
{
    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
#1

1 Reply Related Threads

    olochua
    Starting Member
    • Total Posts : 59
    • Reward points : 0
    • Joined: 2017/06/06 10:38:42
    • Location: 0
    • Status: offline
    Re: False UART RX Trigger Once at Startup 2020/07/02 09:46:21 (permalink)
    4 (2)
    Never mind found the issue. My GPIO directions and A/D Configuration SFRs are not set correctly. Issue resolves after fixing those.
     
    Thanks anyways!
    #2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5