# No data from XPORT (<- USART) to TELNET

hobbyist and students,

[TL:DR] - Can't send (uart) chars from my PIC through my xport to my telnet connection (and can't receive)?

[Software]

• MBLAB X IDE
• Lantronix DeviceInstaller
• XC8 compiler

[Hardware]

• MCU: PIC PIC18F66K22
• Lantronix: XPORT XP1001000-05R (Rev. A11)
• PICkit 3: Programmer
• PC (with Lantronix DeviceInstaller)
• Switch

[Succesfull steps]

• I can see the XPORT in the device installer and can connect with Telnet...
• When connecting with Telnet I will get a setup mode. But I can go to monitor mode by pressing 'M'
• I can send 'commands' to check it's version in Monitor mode (telnet)
• I've got a button (tested with led's) that executes xportSend('A'); (also tested Write2USART('A') on press.
• Both xportEnable() and xportSetup() are called in my main.
• XPORT communication lights will blink when sending through telnet

I'm using the second usart port of my PIC with default settings of xport

#include <usart.h>
#include "xport.h"
#include "defines.h"

/* XPORT DEFAULTS:
Baud:      9600
Databits:  8
Parity:    none
Stop bits: 1*/

void xportSetup(void){
BAUDCON2 = 1;
RCSTA2bits.SPEN = 1;
TRISGbits.TRISG2 = 1;
TRISGbits.TRISG1 = 0;
Open2USART(         USART_TX_INT_OFF  &         // Transmit Interrupt OFF
USART_RX_INT_OFF  &         // Receive Interrupt ON
USART_ASYNCH_MODE &         // Asynchronous Mode
USART_CONT_RX     &         // Continuous Reception
USART_BRGH_HIGH,            // High Baud Rate
(64E6 / 9600 / 16 - 1)      // Baud Rate 9600
);
//http://www.microchip.com/forums/FindPost/836738
}

void xportEnable(void){
LDO_SHDN = true;
XRESET = true;
}

void xportSend(char data){
Write2USART(data);
}
}

• [SOLVED, yes xport is compatible with PIC, see link below]Question one: Is the hardware directly compatible? I've heard that the XPORT uses 3,3V and the PIC RX/TX atleast needs 4V (schmitt trigger stuff) (based on 5V). http://ltxfaq.custhelp.com/app/answers/detail/a_id/995/~/5v-tolerant-xport

• Question two: Am I using the right setup to receive uart messages (Telnet in monitor mode (port 9999))? I've also tried TELNET with port 10001 but it also didn't show anything.

• Question three: Anything else might be wrong in this interfacing?

I think those questions are fairly easy/quick to answer, though I haven't found a reliable source on my google search. I'm not that interested in code, should be able to deal with that myself (if you only describe what to make) but I think there might be something wrong with my USART setup (aswell). (As a lot of things can/might be wrong also). I'd hope that some of you with more experience with the XPORT or electronics can enlighten me.

Kind regards,

FuaZe Student on the HAN university of applied sciences (The Netherlands)

Did you connect X-port RX (Data IN) to PIC TX? The XPORT cannot tolerate 5V signals. You need to connect to port 10001 (default UART bridge) and not the configuration port.

Edit: Some clarifications.

• Yes, the connections are: - PIC_TXD -> XPORT_RXD - PIC_RXD <- XPORT_TXD ltxfaq.custhelp.com/app/answers/detail/a_id/995/~/… <- This describest that my version of the xport is 5V tolerant? And thanks for the heads up on the port, tried it also, but wasn't sure. – Paul Mar 3 '15 at 12:41

BAUDCON2 = 1;

This nifty piece of code snuck in, in the early stage of setting up the code. It's supposed to be the auto-baudrate detection. Later on I realised it would be better to just set an baudrate. The USART wouldn't work before the auto-baudrate detection was completed.

Thanks for the port 10001 help, it seems 5v compatible though.

I though, get a really weird character on first try, but that would be my baud rate not being the right one.