• AVR Freaks

Helpful ReplyHarmony 3 UART Woes

Author
jimctr7
New Member
  • Total Posts : 13
  • Reward points : 0
  • Joined: 2020/04/09 10:34:40
  • Location: 0
  • Status: offline
2020/05/21 16:56:08 (permalink)
0

Harmony 3 UART Woes

I am in the process of moving a project ( a fully functional project ) from Harmony 2 to Harmony 3.  Strangely, when I use the configurator, U1MODE = 0x0 (disabled UART) and no Interrupts are set (even though I clearly specified I wanted interrupts enabled).  That's fine, I went into the code and changed these thing manually.  When I transmit data from the PC, I can see that the interrupt is triggered and I end up in the UART1_RX_InterruptHandler as I hoped I would.  But that is about as far as I make it.   I never get past the first line: uart1Obj.rxBusyStatus apparently is never true, so I get kicked to the bottom of the procedure - simple "nop", and never get to receive data and reach my callback function.  Clearly I received data.  Otherwise I would not be in the RxInterruptHandler, but code is acting as if nothing was received.
 
 

Attached Image(s)

#1
nigelwright7557
Super Member
  • Total Posts : 424
  • Reward points : 0
  • Joined: 2006/11/06 08:15:51
  • Location: 0
  • Status: offline
Re: Harmony 3 UART Woes 2020/05/21 17:39:20 (permalink)
0
Standard way to test UART is to transmit 1's then 0's alternately and check baud rate on a scope.
Also look for parity bit and right number of stop bits etc.
If Tx is right then Rx should follow.
 
 
 
#2
ric
Super Member
  • Total Posts : 27022
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: Harmony 3 UART Woes 2020/05/21 17:54:15 (permalink)
5 (1)
jimctr7
...
Strangely, when I use the configurator, U1MODE = 0x0 (disabled UART) and no Interrupts are set (even though I clearly specified I wanted interrupts enabled).  That's fine, I went into the code and changed these thing manually. 

This should be a hint that things are not quite as you imagine.
I'm not a Harmony user, but have seen other posts where people found that there is an "init" function that sets up the pins, but does not enable the peripheral, and an "open" function that actually enables the peripheral.
I would guess you are not calling the "open" function.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#3
arpananand
Super Member
  • Total Posts : 488
  • Reward points : 0
  • Joined: 2009/11/18 04:35:42
  • Location: 0
  • Status: offline
Re: Harmony 3 UART Woes 2020/05/22 01:12:19 (permalink)
0
which device are you working on? i would recommend to have a look into existing UART demos first if you haven't already. you can find those in csp/apps directory.
#4
vgandhi
Junior Member
  • Total Posts : 27
  • Reward points : 0
  • Joined: 2016/10/24 21:28:35
  • Location: 0
  • Status: offline
Re: Harmony 3 UART Woes 2020/05/22 01:33:14 (permalink) ☄ Helpfulby jimctr7 2020/05/22 14:47:28
5 (1)
The UART PLIB saves data only when there is a read request from the application/client. Any data received in the absence of a pending read request will be lost as the PLIB does not have any buffer to save the incoming data. To receive the incoming data you will need to submit a read request using the "DRV_USART_ReadBufferAdd", which will cause the busy flag to become true; and save the data in the application buffer. A callback will be given out when requested bytes have been received.
Having said that, there is a ring buffer mode added to the UART PLIB in the latest v3.7.0 release. The ring buffer mode of UART is always in the receive mode and saves the incoming data into its internal ring buffers (size of ring buffers is MHC configurable). Application can read out the data from the ring buffer using the APIs provided.
Note that the UART driver only works with the non-ring buffer mode of the underlying UART PLIB.
#5
jimctr7
New Member
  • Total Posts : 13
  • Reward points : 0
  • Joined: 2020/04/09 10:34:40
  • Location: 0
  • Status: offline
Re: Harmony 3 UART Woes 2020/05/22 14:55:22 (permalink)
0
latest Harmony version only goes to v3.5 as far as I can tell
#6
Jump to:
© 2020 APG vNext Commercial Version 4.5