LockedUART1ClearErrors()

Author
idurham
Junior Member
  • Total Posts : 93
  • Reward points : 0
  • Joined: 2004/06/02 16:44:37
  • Status: offline
2008/09/18 16:56:51 (permalink)
0

UART1ClearErrors()

I am working on UART code for a PIC32MX340F256H using MPLAB v8.14.  In my interrupt routine I am using several UART routines including ReadUART1() and mU1RXGetIntFlag().  However, when I add a call to UART1ClearErrors(), I get the compiler error "undefined reference to `UART1ClearErrors'".  Why is that?
Thanks

 
#1

3 Replies Related Threads

    hexreader
    Super Member
    • Total Posts : 992
    • Reward points : 0
    • Joined: 2008/05/04 03:06:55
    • Location: England
    • Status: offline
    RE: UART1ClearErrors() 2008/09/18 17:22:09 (permalink)
    0
    Assuming that you are using C32 and including <plib.h>:
     
    I think that the function you want might be UART1ClearAllErrors();
     
     
    The text description in file uart.h seems to contradict the definitions below, but presumably the definitions are the important part:
     
    /******************************************************************************
     * Function:        int UARTxGetErrors(void)
     *     void UARTxClearErrors(void)
     *
     * Description:  UARTxGetErrrors() retrives bitmap of various error values
     *     UARTxClearAllErrors() clears all error flags.
     *                  UART1ClearError(error) clear specific error flag.
     *
     * PreCondition:    None
     *
     * Inputs:
     *
     * Output:          Overflow Error - _UxSTA_OERR_MASK
     *     Frame error - _UxSTA_FERR_MASK
     *     Parity error - _UxSTA_PERR_MASK
     *
     * Example:   // hande an overflow error on UART 1
     *                  if(UART1GetErrors() & _U1STA_FERR_MASK)
     *                  {
     *                     // handle error...
     *                      UARTClearError(_U1STA_FERR_MASK);
     *                  }
     *
     * NOTES: See device header file for output defines
     *
     *****************************************************************************/
    #if defined(_UART1)
    #define UART1GetErrors()  (U1STA & (_U1STA_OERR_MASK | _U1STA_FERR_MASK | _U1STA_PERR_MASK))
    #define UART1ClearAllErrors() (U1STACLR = (_U1STA_OERR_MASK | _U1STA_FERR_MASK | _U1STA_PERR_MASK))
    #define UART1ClearError(error) (U1STACLR = (error))
    #endif

    Hope this helps,     Robin
    #2
    idurham
    Junior Member
    • Total Posts : 93
    • Reward points : 0
    • Joined: 2004/06/02 16:44:37
    • Status: offline
    RE: UART1ClearErrors() 2008/09/19 07:52:06 (permalink)
    0
    Thanks.  That's it.  Apparently there is a mistake in the 32-bit-Peripheral-Library-Guide.pdf on page 244.
     
    #3
    PIC32 Support
    Junior Member
    • Total Posts : 81
    • Reward points : 0
    • Status: offline
    RE: UART1ClearErrors() 2008/09/19 09:17:26 (permalink)
    0
    Thank you for the reporting this and to those who assisted in resolving it.  The documentation error will be fixed in the next release.  
    #4
    Jump to:
    © 2017 APG vNext Commercial Version 4.5