• AVR Freaks

Hot!Issue with USART library

New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2016/02/15 06:13:34
  • Location: 0
  • Status: offline
2018/08/29 00:34:04 (permalink)

Issue with USART library

Hi forum,
I'm using Harmony to build a new project (using Harmony v2.06, Mplab X v5.05, XC32 v2.10 on PC). I try to use the USART library but I still face an issue when trying to use commands DRV_USART_Write / DRV_USART_Read.
I can initialize and open ports, but can't send or receive data. Build always fails with error message "undefined reference to `DRV_USART_Write'"
My file includes "app.h", which includes "system_definitions.h". In this file, "driver/usart/drv_usart.h" is included and when pushing Ctrl + clic, I'm able to see the file.
I also tried to build the harmony project as standalone (all lib files are in the project directory), but the issue is still there.
If I use the same function in another file (like app.c), it still doesn't work. But when I use another function from the same file (DRV_USART_ReadByte), it works... I don't get it ;-)
What am I missing? Or is there any new known bug in the last MHC / Mplab / compiler?
Issue happens in file BLE.c.
Thank you in advance for your very appreciate support!
post edited by jrebetez - 2018/08/29 01:17:13
Paul PortSol
Super Member
  • Total Posts : 471
  • Reward points : 0
  • Joined: 2015/07/03 11:52:03
  • Location: Newfoundland, Canada
  • Status: offline
Re: Issue with USART library 2018/08/29 07:18:47 (permalink)
a) Pins assigned in pin manager?
b) Correct Clocks?
c) Look at Tx with scope to see if anything output, even at wrong datarate
d) Flow Control: Set for only Tx/Rx (Don't enable CTS/RTS unless needed and connected)
e) Interrupt or Polled or Callback? (I use: Polled Tx, and Interrupt Callback Rx)
f) Each Driver Opened/Enabled?
Maybe screen capture your MHC settings and post here.
Part of my init for multiple UARTS (Wish the forum didn't eat tabs):
for(eU=0; eU<EuListend; eU++)//Check all UARTs for Rx Data
sUart.psUarts[eU].uIndex = puUartInitIndex[eU];
printf(" %s", ppcUartNames[eU]);
sUart.psUarts[eU].handle = DRV_USART_Open(sUart.psUarts[eU].uIndex, DRV_IO_INTENT_READWRITE|DRV_IO_INTENT_NONBLOCKING);//ToDo: Intents do nothing in HarmonyV202b
if(DRV_HANDLE_INVALID == sUart.psUarts[eU].handle)/* Open Error? Check if the handle is valid */
D_PRINTFn_NoLog_ERROR("UartInitFail[%s]", ppcUartNames[eU]);
DRV_USART_ByteReceiveCallbackSet(sUart.psUarts[eU].uIndex, vCallback_usart_rx);
//unused(Causes Glitches in PIC32MZ HarmonyV202b): DRV_USART_ByteErrorCallbackSet(sUart.psUarts[eU].uIndex, vCallback_usart_err);
Jump to:
© 2019 APG vNext Commercial Version 4.5