UART Communication issues between ESP32 and ARM7

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
bgustafson
Posts: 1
Joined: Mon May 10, 2021 12:55 pm

UART Communication issues between ESP32 and ARM7

Post by bgustafson » Mon May 10, 2021 3:18 pm

Currently I have access to a in-house board that uses an ARM7 LPC2103 chip. I currently sometimes need to debug this board over serial by using a terminal app such as hyper terminal.

In anticipation of a future project, I wanted to see if I could intercept serial communication from this board with the UART of an ESP32. For testing, I chose to just output the series of characters: 'HIH'. When I do this, I can properly see these characters displayed in the HyperTerminal while using 19200 baud. I then extended this TX wire to the RX pin of the ESP32 for port 2(Pin17) to see if i could get the correct output, but instead I get this:

Code: Select all

>>> uart.read()
b'omo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbf
omo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfom
o\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\
xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xbfomo\xb
fomo\xbf'
>>> uart
UART(2, baudrate=19200, bits=8, parity=None, stop=1, tx=17, rx=16, rts=-1, cts=-1, txbuf=256, rxbuf=256, timeout=0, timeout_char=1)
At first I thought I was having a baudrate issue, but when I examined the LPC2103 code, it appears to be setup for 19200:

Code: Select all

/* initialize the serial interface   */
	PCONP 	= 0x00081098;  //0x1040100C;
	PINSEL0 = 0x00F00055;  // 0x0A008005;
	PINSEL1 = 0x003F0014;  // 0x02800280;
	
	U0FCR = 0x1;					 // Enable FIFO's
	U0LCR = 0x83;                   /* 8 bits, no Parity, 1 Stop bit      */
	U0DLL = 0xC3;                   /* 19200 Baud Rate @ 60MHz VPB Clock  */
	U0LCR = 0x03;                   /* DLAB = 0                           */
And I can view this fine in the Hyperterminal.

Any ideas on what I am doing wrong here? If i removed the Tx pin and just jumper P16 and P17 on the ESP32, I can properly do a uart.write and see the uart.read echoed, but I can't seem to get this read to work properly.

(apologies if this double posts, my last post seemed to get lost in the ether)

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: UART Communication issues between ESP32 and ARM7

Post by Roberthh » Mon May 10, 2021 3:52 pm

I assume you also connected the GND lines of both devices. Besides to to that, are both operating at 3.3V level in normal mode, which means that the quiet state is 3.3V?

bgustafson
Posts: 1
Joined: Mon May 10, 2021 12:55 pm

Re: UART Communication issues between ESP32 and ARM7

Post by bgustafson » Mon May 10, 2021 6:41 pm

Code: Select all

>>> uart.read()
b' HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH H
IH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH H
IH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH HIH'
I had completely forgotten that these devices were designed to use actual RS-232 levels and used a MAX232 to shift to and from TTL/CMOS levels. I am actually surprised I didn't fry my little ESP32. Moved my jumper cable to bypass the MAX232 and it worked like a charm. Thanks!

Post Reply