MAX232ECN to Atmega 328P Microprocessor - Page 1
Forum section: electronics / general

author: Daniel Bingamon
author_rank: Regular Contributor
timestamp: May 06, 2023, 08:28:35 pm
content: I have been working on connecting an RS232 port to an Atmega 328P Microprocessor.In this I have an DE9 connector with pin 2, 3 & 5 in use.Pin 3 of the DE9 going to pin 13 of the MAX232 chip.Pin 2 of the DE9 going to pin 14 of the MAX232.All the capacitors in place.Pin 11 of MAX232 going to the pin 3 of the 328P.Pin 12 of MAX232 going to pin 2 of the 328P.I can't seem to get it to transmit data. The pin 11 of the MAX232 is putting out 3.28V and regardless of whether the 328P is in the socket or not.For some reason the 328P can't pull the line low.I'll try to post of schematic and board diagram in the next post.

author: Daniel Bingamon
author_rank: Regular Contributor
timestamp: May 06, 2023, 08:34:03 pm
content: PCB DiagramAlso note, the TVS diodes are not installed on the board.

author: Lindley
author_rank: Regular Contributor
timestamp: May 07, 2023, 07:41:07 pm
content: Would first ask if you have proven the 328 has been programmed / fused up correctly and is working ok with your crystal ?The simplest way to check your Max232 is working is to run a simple loop back test as shown below if you are able or are you stuck with some predefined code you cannot change ?If not, do you have an Arduino board you can run that looopback test straight to that boards Max232 ?Never used what I assume are leds on the Tx/Rx lines, might be better to remove them until the circuit proven.https://support.arduino.cc/hc/en-us/articles/360020366520-How-to-do-a-loopback-test

author: dobsonr741
author_rank: Frequent Contributor
timestamp: May 07, 2023, 07:56:43 pm
content: The schematics would be helpful. Hopefully with standard part libraries - so that we do not need to look up the data sheets for the proper PIN number - pin function matches.The most common issue in serial comm IMO is mixing up TX/RX, ending up connecting TX to TX, RX to RX. Have you checked for that?

author: Daniel Bingamon
author_rank: Regular Contributor
timestamp: May 08, 2023, 12:20:07 am
content: Thanks for the comments. The 328 was programmed on an Arduino board and the program was tested there.Also, I have removed the Atmega 328 and jumpered pins 2 and 3 and got echo back on the PC.I've used LED on TX and RX RS232 lines in the past with no problems.If I ground the TX pin with the Atmega removed the RS232 side goes positive and illuminates the LED. When TTL side of the MAX232 is grounded, the RS232 should go positive, when TTL is high, RS232 should go negative - and it does. I'm beginning to think that there processor is not starting on this board but is starting when plugged into the Arduino board.

author: Daniel Bingamon
author_rank: Regular Contributor
timestamp: May 08, 2023, 12:33:26 am
content: Do the two capacitors on either side of the crystal have to be 22pF, will 20pF suffice?

author: Daniel Bingamon
author_rank: Regular Contributor
timestamp: May 08, 2023, 01:32:44 am
content: Status update. I now have transmit working. One of the two capacitors for the crystal looked different, color wasn't the same - I replaced it and now it transmits.I think the other cap was bigger than 20pF, like 220 or something. Two 20pf's works fine.