Cannot upload sketch using RS232 serial

Hi all,

I first ask that you forgive my newbieness and please direct me if I have posted this in the wrong place...

I have built a board using the ATmega328 processor, essentially an Arduino but much smaller ( parts count). I am attempting to use RS232 to communicate with it. I have built a level shifter using a MAX232 ic using DTR as autoreset and pins 2 and 3 ( of the 328) as RX and TX.

I am running a sketch (called DG5 emulator... amateur radio stuff ) I have uploaded the sketch on my (actual) Arduino and moved the 328 ic to my board and all works well. I can send a command via serial monitor (Arduino IDE) to the board through rs232 and the program responds by sending a stream of data back to serial monitor ( or any other terminal program).

My problem is that I cannot upload a sketch via rs232. I keep getting an out of sync error when I try.

I can plug my FTDI module onto the board and all uploads well.

I have put the MAX232 board onto my Arduino and get the same problem ( out of sync error when uploading)

I have handshaking loopback wired into the circuit (rs232 pin 4->6 pin 7 ->8 )

I have tried to manually reset when uploading ... no joy

I have tried this on multiple computers with different cables and have swapped out the MAX232 chip and db9 connector

I feel as if I am missing something but do not know what.

these are my conclusions:

  1. serial communications are working properly , because i can send a debug command to the board and start and stop data flow out of the board.. I can also loopback from the TTL side of the MAX232 board.

  2. My auto reset is working properly, because the FTDI module uses the same reset circuit.

  3. My wiring is correct because, I can send and receive (just cannot UPLOAD)

  4. My solder joints are good, because I have triple checked them ... and that is what I do for a living.

  5. either it is a timing issue or there is something ( in the bootloader maybe) that is holding me up

I am at a loss and was hoping that greater minds than mine might have a resolution

Thanks

  1. Where's the schematic?

  2. Are you sure? Remember the original Arduino has some special handling of RESET when the USB connection opens at 1200 baud.

  3. Yes, but it's the RESET which is important, isn't it?

  4. OK, I believe you.

  5. Yes, probably.

MorganS:
0. Where's the schematic?

  1. Are you sure? Remember the original Arduino has some special handling of RESET when the USB connection opens at 1200 baud.

  2. Yes, but it's the RESET which is important, isn't it?

  3. OK, I believe you.

  4. Yes, probably.

thanks for your response

  1. I will post schematics as soon as I get them down on paper ( all schematics ATmega328 and Max232 are basically straight from datasheets)

  2. No, I am not sure however my conclusion is based on the fact that the FTDI works and is using the same reset circuit..... Could there be a difference on how FTDI handles reset (DTR pulse) as opposed to rs232 serial. also I have tried manually reseting at upload. maybe i'm doing this wrong? as per a website somewhere i hit the reset button as soon as the sketch compiles. this failing, I have hit reset at many different times throughout the upload process.

My conclusions are just that "My conclusions". I expect that there is error within them, otherwise this thing would be working.

somethings that I forgot to include in my OP. I have tried multiple ATmega328... I have tried multiple sketches (including blink and others (proven) copied and pasted into the IDE

OK, attached are the schematics of my boards.

I fiddled around a little with the cap value in the reset ckt. ( went to .22) thought it might get me a better reset pulse. it didn't. ?

As you might be able to tell I am running out of ideas.

Thanks to all who read and contemplate this.

atm328_max232.pdf (30.1 KB)

OK, that looks readable (just) and useful to the discussion.

So what is driving DTR on the RS232 side of things? I'd try using the FTDI with another TTL-to-RS232 just to be sure that you have the right signals to begin with and the RS232 is just a cable extender. It's probably not necessary to loop back DTR to DSR.

What's the purpose of the led between pins 19 and 21? I would bet that's hosing the SCK line which would prevent downloading.

The resistor and jumper make no sense as well.

My apologies if this is a repost. I thought that I had posted it but when I went back it wasn't there so here i go again...

SOLVED IT!!

Replaced the MAX232 chip with a MAX202 chip, no other changes made to the circuit as the chip was in a socket and.... BOOM... it works every time now. I am not sure what the difference is and will have to go over the datasheets ( at a later date) for now I am just happy that it works....

I hope that this helps someone else out there..

THANKS to all who have responded.

Jimmy

The MAX232 is a very popular part for counterfeiters. If you don't know the provenance of the original part, it might well be counterfeit and the source of your problem.

I've also had problems with MAX chips (I forget which one) that turned out to be very sensitive to the capacitors chosen. Doubling the size of the capacitors got it working. I was running a 5V-only part at 3.3V.