• AVR Freaks

Simultaneous UART and CAN communication

Author
ABaum89
New Member
  • Total Posts : 19
  • Reward points : 0
  • Joined: 2015/08/20 14:16:52
  • Location: 0
  • Status: offline
2019/11/07 15:47:53 (permalink)
0

Simultaneous UART and CAN communication

Hello!
I've run into an issue wherein I can use either UART or CAN, however whenever the CAN interface is running, the U1RXREG registers a read, but appears to be empty.  Has anyone else had experience with this?
 
Beyond this, the UART interface fails to transmit any information while the CAN interface is running.
 
I am using a PIC16/32 Explorer Board with a PIM that contains a PIC32MZ2048EFH100.
 
The UART interface is bare-metal, using only the registers available, however the CAN utilizes the Harmony driver.
#1

2 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 17916
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Simultaneous UART and CAN communication 2019/11/07 16:44:55 (permalink)
    0
    Register can’t contain nothing.
    Is the data flag set? Are you reading zero?
    Overrun clear?

    I am running several serial ports and CAN.
    Either your drivers are clashing.
    Or you are not servicing them fast enough.
    #2
    ABaum89
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2015/08/20 14:16:52
    • Location: 0
    • Status: offline
    Re: Simultaneous UART and CAN communication 2019/11/08 09:10:01 (permalink)
    0
    The UART port is operated on an interrupt, though it is a lower interrupt than most other interrupts on the board.  The code checks the URXDA flag and if it is high, reads from the buffer.
     
    There is no overrun error detected.
     
    Sometimes zero is read, sometimes a strange value is read.
     
    What do you mean by the drivers are clashing?  How can they clash?
    How fast do I need to service them?  The UART register is 8 levels deep and should be cleared as the bytes are read, correct?
    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5