• AVR Freaks

Hot!PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion

Author
tedhuntington
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2010/06/20 11:20:18
  • Location: 0
  • Status: offline
2018/12/02 15:18:37 (permalink)
0

PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion

I am building a custom board for the PIC32MX675F256H using harmony and find that, the PIC32MX5xx6xx7xx datasheet (60001156J) shows on p74 
U2E IRQ: 37 Vector Number:31
U2RX IRQ: 38 Vector Number:31
U2TX IRQ: 39 Vector Number:31
U3E IRQ: 40 Vector Number:32
U3RX IRQ: 41 Vector Number:32
U3TX IRQ: 42 Vector Number:32
 
but the generated code has:
p32mx675f256.h
#define _UART_3_VECTOR                           31
#define _UART_2_VECTOR                           32
 
and
#define _UART3_ERR_IRQ                           37
#define _UART3_RX_IRQ                            38
#define _UART3_TX_IRQ                            39
#define _UART2_ERR_IRQ                           40
#define _UART2_RX_IRQ                            41
#define _UART2_TX_IRQ                            42
 
 
I do see similar definitions for UART3A that do have the correct IRQ and VECTOR but system_interrupt.c clearly uses:
_UART_3_VECTOR
 void __ISR(_UART_3_VECTOR, ipl5AUTO) _IntHandlerDrvUsartInstance0(void)
 
 
maybe I should just switch the system_interrupt.c code to use UART_3A_VECTOR?
 
This seems like it must be a mistake by Microchip somewhere in there either in Harmony or the datasheet.
 
Thanks,
Ted
 
#1

7 Replies Related Threads

    tedhuntington
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2010/06/20 11:20:18
    • Location: 0
    • Status: offline
    Re: PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion 2018/12/02 15:25:19 (permalink)
    0
    adding that when I swap UART2 and UART3 interrupt and vector definitions to be correct, clean and build again I get:
    nbproject/Makefile-default.mk:671: recipe for target 'build/default/production/_ext/1688732426/system_interrupt.o' failed
    /tmp/ccpiUw9Q.s: Assembler messages:
    /tmp/ccpiUw9Q.s:4179: Error: symbol `__vector_dispatch_32' is already defined
    make[2]: *** [build/default/production/_ext/1688732426/system_interrupt.o] Error 1
    #2
    tedhuntington
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2010/06/20 11:20:18
    • Location: 0
    • Status: offline
    Re: PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion 2018/12/02 16:20:15 (permalink)
    0
    Just to make clear that these definitions are defined in an xc32 include file (I am using v1.42, but it appears to be the same in earlier versions too). So this is not a Harmony generated include file, but is from the xc32 compiler folder.
    #3
    Mysil
    Super Member
    • Total Posts : 3330
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion 2018/12/02 19:54:07 (permalink)
    0
    Hi,
    Going back to a previous version of the datasheet, DS60001156H-page 133.
    Interrupt vector and request numbers correspond with what is in the device support include file:
    U3E – (UART2A) Error             IRQ: 37, Vector: 31
    U3RX – (UART2A) Receiver      IRQ: 38, Vector: 31
    U3TX – (UART2A) Transmitter  IRQ: 39, Vector: 31
    U2E – (UART3A) Error             IRQ: 40, Vector: 32
    U2RX – (UART3A) Receiver      IRQ: 41, Vector: 32
    U2TX – (UART3A) Transmitter  IRQ: 42, Vector: 32

    In my opinion, the A/B numbering of UART peripherals was a confusing mistake long time ago,
    UART2 != UART2A,  and  UART3 != UART3A
     
    Somehow, this seem to have confused even Microchip,
    and trying to change this have caused a mistake in updating the Datasheet revision J
     
    Also in XC32 device support file version 2.05, IRQ and Vector numbering is the same as in v1.42, and previous versions, and is still correct in my understanding.
     
    In my opinion, the interrupt vector table in Datasheet should be changed to:
    U3E   – UART3 Error           IRQ: 37, Vector: 31
    U3RX – UART3 Receiver      IRQ: 38, Vector: 31
    U3TX – UART3 Transmitter  IRQ: 39, Vector: 31
    U2E   – UART2 Error           IRQ: 40, Vector: 32
    U2RX – UART2 Receiver      IRQ: 41, Vector: 32
    U2TX – UART2 Transmitter  IRQ: 42, Vector: 32
     
    Regards,
        Mysil
     
    #4
    tedhuntington
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2010/06/20 11:20:18
    • Location: 0
    • Status: offline
    Re: PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion 2018/12/03 22:42:19 (permalink)
    0
    Thanks Mysil,
     
    I got the USART3 working- so the datasheet must be in error.
    #5
    tedhuntington
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2010/06/20 11:20:18
    • Location: 0
    • Status: offline
    Re: PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion 2018/12/03 22:42:40 (permalink)
    0
    adding- that I did not have to change the pic32 include file
     
    #6
    cvm
    Super Member
    • Total Posts : 293
    • Reward points : 0
    • Joined: 2011/09/16 05:16:15
    • Location: 0
    • Status: offline
    Re: PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion 2018/12/03 23:17:13 (permalink)
    0
    As a general rule- when in doubt, believe the headers. Datasheet mistakes don't seem to get high priority, but headers have to work right or (mostly) everybody has problems.
    #7
    headwolf_83
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2008/12/17 18:22:22
    • Location: 0
    • Status: offline
    Re: PIC32MX UART3 Harmony/Datasheet Interrupt and vector confusion 2019/08/14 23:51:51 (permalink)
    0
    You define  2  UART2  interrupt  ,will course this 。Such as
    void __ISR(_UART_2_VECTOR,ipl2) U2RX_DEAL(void)
    {}
    void __ISR(_UART_2_VECTOR,ipl3) U5RX_DEAL(void)  //error define
    {}
    #8
    Jump to:
    © 2019 APG vNext Commercial Version 4.5