0

I'm fairly new to Arduino programming but have a good deal of experience with low-level programming early processors, having originally cut my teeth on Z80, 8088, etc. I'm looking at developing a sizeable project using a Mega 2560. The project includes quite a lot of off-board logic, leds, and an RPi. Thus I don't want to overload the 2560 voltage regulator and really want to use common rail 5v power with a switch-mode supply. However, I also need debugging / console access, so this gives me the immediate problem of direct 5v driving whilst the board is being driven with 5v from the USB port, which is a no - no. The solution appeared to be fairly simple - use a CH340 - based USB to serial converter and connect it to RX0, TX0 and Reset (DTR output connected via a blocking capacitor) but with its 5v output disconnected. With this setup, the Arduino communicates quite happily with the IDE-based serial monitor (the sketch was downloaded via the on-board usb port), but on trying to download a new sketch via this route, AVRDude fails with a timeout. At the commencement of the download the processor is being reset, but the bootloader doesn't appear to hansdshake with AVRDude (properly). Is this a known feature or have I missed something?

  • the bootloader listens on RX0/TX0. the on-board USB chip is connected to this pins – Juraj Jan 17 at 8:44
1

Problem solved. The standalone CH340-based converter for whatever reason isn't man-enough to reliably pull down the RX0 line when connected to the Mega 2560 (also with a CH340 converter on board). I've seen suggestions posted in various places that this can be a problem with respect to DTR (though I don't have a problem with it). My solution is to insert a 7417 open-collector non-inverting buffer between the output of the stand-alone converter and the RX0 input on the 2560 board. I've not been able to find a schematic for the Mega 2560 board to determine its pull-up resistor size but imagine it must be relatively small. Thanks to those who made suggestions.

0

It sounds like you have not connected the grounds together. Try connecting the ground from the USB to serial converter to the Arduino.

  • Since communication with the serial monitor works, this is probably not the error. – the busybee Jan 16 at 7:08
  • Wish it was that simple. The grounds are connected, and as @busybee suggests, communication with the serial monitor woudn't work if if they weren't – Davidas Jan 16 at 9:34
  • @Davidas - I didn't see a ground connection mentioned in your question, so that's where I got the idea from. Is there a reset button on the Mega? If so, you could try to reset the Arduino at the right moment while uploading the sketch. Another suggestion is to try a different type of USB to Serial converter (one that does not use the CH340 chip). – VE7JRO Jan 16 at 14:49
  • @VE7JRO Sorry about not mentioning GND - I did mention everything else. Yes, there is a a reset button on the board and I've tried it too, but to no avail (ie it resets the processor but the bootloader doesn't communicate with the IDE). I may indeed have to try an FTDI based converter - I supose the questions to be asked before I do are "should this configuration work?" and "Does the handshake involve manipulation of CTS (which isn't exposed on the 2560 board and is permamently pulled high on the converter)? " – Davidas Jan 16 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.