• AVR Freaks

Hot!UART Dynamic Driver - Buffer Queue data transfer model - DMA - Overrun error

Author
dvvrcognizant
Starting Member
  • Total Posts : 34
  • Reward points : 0
  • Joined: 2019/03/13 07:48:11
  • Location: 0
  • Status: offline
2019/04/11 23:38:04 (permalink)
0

UART Dynamic Driver - Buffer Queue data transfer model - DMA - Overrun error

Hardware:
1. PIC32 USB Starter Kit III (with PIC32MX470F512L
2. Starter Kit I/O Expansion Board 

Setup: 
Tx Board       Rx Board 
UART1 Tx ---> UART1 Rx
GND ------------- GND 

Software:
1. MPLAB X IDE (v5.15)
2. Harmony (v2_06)

UART Driver:
UART Dynamic Driver - Buffer Queue Data Transfer Model with DMA. This driver code is generated by Harmony. 

Clocks configuration:
POSC is 8MHz. SYSCLK is 96MHz. PBCLK also 96MHz.
 
Issue:
From Tx Board one byte data is sent continuously. At Rx Board the data byte is received and checked to see if the correct data byte is received. Initially, 10 data bytes used to receive and there after no data is received. Added the API "USART_ReceiverOverrunErrorClear_Default()" the UART does not stop receiving data, but receives erroneous data. Randomly wrong data is received and it is frequent. This problem is observed at all baud rates from 9600 to 24Mbps.
 
PFA app.c files of the program that runs on Rx Board. I cannot attach the projects as it exceeds allowed file size limit.
 
I understand that this is a problem "UART Receiver Overrun Error"
 
Please suggest,
- if there are any mistakes in my code or there is any issue(s) with UART diver code generated by Harmony
- how to avoid "UART Receiver Overrun Error" in application code when "UART Dynamic Driver - Buffer Queue Data Transfer Model with DMA" generated by Harmony is used???
#1

4 Replies Related Threads

    Paul PortSol
    Super Member
    • Total Posts : 439
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: Newfoundland, Canada
    • Status: offline
    Re: UART Dynamic Driver - Buffer Queue data transfer model - DMA - Overrun error 2019/04/15 05:20:56 (permalink)
    0
    a) To bypass the large file limit use one of the file sharing websites, and share the link for the file here. (Dropsend.com, etc.)
     
    b1) In your interrupts and callbacks put counters, count number of times they were entered, how many bytes processed, etc. It can aid debugging by finding where it is working/failing.
    b2) Choose some spare pins and pulse them when code passes through certain points, then you can check real time flow with an Oscilloscope.
     
    c) To avoid overruns you must "service" the event before too much data is received. For a UART that "timing" would be the total bits/bytes to fill the FIFO at the baudrate (Ensure you have FIFO enabled in MHC, and check FIFO size in PIC's datasheets). Ensure anything involved (Interrupts, DMA, etc.) is set up before transfer begins, and ensure all priorities are such that other modules won't block the UART beyond your calculated timing.
     
    d) You need to totally avoid the overrun, not just fix it when it occurs. Get you code fast enough so overrun can't occur, that will give you reliability. Don't want one of those products that sometimes locks up in the field.
     
    Paul
     
    #2
    dvvrcognizant
    Starting Member
    • Total Posts : 34
    • Reward points : 0
    • Joined: 2019/03/13 07:48:11
    • Location: 0
    • Status: offline
    Re: UART Dynamic Driver - Buffer Queue data transfer model - DMA - Overrun error 2019/04/15 06:18:26 (permalink)
    0
    Hi Paul,
    Thanks for your inputs.
    These inputs are general guidelines.
    I am looking for some help in using the driver generated by harmony, to avoid overrun error.
     
    Today I tried the following:
    - Increased the number of buffers (from 1 to 10) to receive the data from UART Driver. UART Dynamic Driver - Buffer Queue Data Transfer Model with DMA. This driver code is generated by Harmony.
    - With this modification, I sent 5K Bytes in a burst. At the receiving end all the bytes are received correctly.
    But, if I remove the call to function "USART_ReceiverOverrunErrorClear_Default()" then the receiving program stops after receiving few bytes.
     
    PFA the latest code file.
     
    Can you please look into the code to check what could be the problem?
     
    Thanks & Regards,
    Vishnuvardhan
    #3
    Johnny0099
    Super Member
    • Total Posts : 156
    • Reward points : 0
    • Joined: 2015/06/20 00:33:20
    • Location: 0
    • Status: offline
    Re: UART Dynamic Driver - Buffer Queue data transfer model - DMA - Overrun error 2019/04/16 06:45:01 (permalink)
    0
    USART Driver has issues never solved by Harmony Development Team.
    I just suggest you to write a driver by yourself. I did it and problems disappeared. I was spending months before getting ris of this problem. I really hope that USART drivers in Harmony 3.0 will be better..
    #4
    dvvrcognizant
    Starting Member
    • Total Posts : 34
    • Reward points : 0
    • Joined: 2019/03/13 07:48:11
    • Location: 0
    • Status: offline
    Re: UART Dynamic Driver - Buffer Queue data transfer model - DMA - Overrun error 2019/05/09 23:22:44 (permalink)
    0
    Is Harmony 3.0 released?
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5