Go Down

Topic: Driver for Arduino Uno as an USB to serial adapter with auto-reset? (Read 4523 times) previous topic - next topic

subway

Driver for Arduino Uno as an USB to serial adapter (programmer) with automatic reset?

I am looking for a driver that turns an Arduino Uno R3 into an USB to serial adapter, like the one in the picture, which I want to use as a serial programmer for uCs Atmega328p that already have bootloaders on them.


See: http://www.tinyosshop.com/index.php?route=product/product&filter_name=ftdi&filter_description=true&filter_sub_category=true&product_id=600

Remark: I know that I can connect to the ground the reset pin of the Atmega328p on Arduino Uno to disable the chip and connect the RX and TX of the other AVR on Arduino Uno to the TX and RX of the IC on the breadboard but I have to manually reset the Atmega328p on the breadboard each time I load it with a new code which is a bit impractical. I also do not want to remove the Atmega328p that belongs to Arduino Uno.

Paul__B

There is a jumper pad on the UNO labelled "RESET-EN".  You can (with a little skill) cut the bridge in it and solder a pair of header pins to it which you can either jumper for normal operation of the UNO, or use the one which connects to the reset capacitor, for your reset function on the external chip.  You still have to jumper pins 5 and 6 on the ICSP header to hold the on-board 328 in reset so that it releases Arduino "pin 1", but this will not affect your external circuit with the RESET-EN jumper open.

subway

Quote
You can (with a little skill) cut the bridge in it and solder a pair of header pins
So there is no driver that transforms Arduino Uno into an USB to serial adapter (programmer) with automatic reset.
I am also using Arduino Uno as an ISP programmer and for other purposes. I simply do not want to make hardware modifications on the board because it works well as it is.

Paul__B

"Drivers" are the software that the host PC uses to talk to the USB interface.  Clearly in this case, the driver and the USB interface on the UNO are functioning absolutely perfectly, generating the required CTS signal.  Your question has nothing to do with driver software.

What you have asked is how to alter the hardware in order to allow this signal to be available externally.  I have explained exactly how to do that, and in a manner that permits it then to be easily swapped between the alternate function you requested and absolutely normal function on its own.  It is do-able and in no way damages the Arduino, albeit it does require proper soldering equipment and of course, skill.

That is how you do it.  Either you want to do it, or you do not.  Your choice.

subway

1) I do not like to make any hardware modifications to my Arduino Uno R3. I was suggested in the past to do all kind of changes for various projects. If I had followed such advises I would have destroyed my Arduino Uno by now. I do not know why the moderators of this forum have this mania of teaching you how to do hardware tricks on Arduino when much elegant solutions, like a driver, are possible.

2) Yes the piece of software I was asking for is a driver by all possible definitions. I need something like ArduinoISP (which is a driver) that once loaded into Arduino Uno is able to take a hex file from the PC and burn it into a target AVR on the breadboard using four wires.

Arduino Uno as ISP:
Arduino Uno---Target AVR
SS------------RESET
MOSI----------MOSI
MISO----------MISO
SCK-----------SCK


What I need is a similar code, a kind of relay that forwards serial data between the PC and the AVR on the breadboard preloaded with a boot-loader, which uses just three of the Arduino Uno pins, like this:
Arduino Uno------------Target AVR
Pin defined as TX------RX
Pin defined as RX------TX
Pin defined as Reset---RESET



DrAzzy

ArduinoISP is not a driver.

You cannot do what you want to do in software. The auto-reset is implemented in hardware, not software, and the only place where that signal reaches the microcontroller is through the reset pin.

Now, if you remove the processor from the Uno (if it's the socketed one), then you can use it as a serial adapter easily - just use the rx/tx/reset pins and connect to appropriate pins on the other microcontroller.

Seeing as usb serial adapters are under $5 each and readily available, I suggest you buy one, or more. Always good to have extras.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Paul__B

Now, if you remove the processor from the UNO (if it's the socketed one), then you can use it as a serial adapter easily - just use the rx/tx/reset pins and connect to appropriate pins on the other microcontroller.
You completely missed his comments. :smiley-eek:

He has explained more than once, that he has no intention of making any modification to his virgin Arduino UNO since he is avowedly not competent to do so.

He believes that the software can do anything.

Actually, it is true - a sketch with similar function to "Arduino as ISP" could with a properly written software serial implementation, provide serial data and a reset signal to a target breadboarded Arduino.  Whether anyone has gone to all the trouble of doing this including modifying the IDE to suit given how much easier it is to do by the methods I have outlined, well that is another question.


dmjlambert

#7
May 24, 2015, 01:17 am Last Edit: May 25, 2015, 06:29 am by dmjlambert Reason: clarification about RX and TX pin connections
You can use the USB to serial adapter which is built into your Arduino without modifying the hardware, cutting traces, adding parts, nor removing chips.  Just make a sketch which:
  • does nothing at all with the serial port
  • pulses a pin low for a few microseconds in the setup function


Like this:
Code: [Select]

void setup()
{
  pinMode(13, OUTPUT);
  pinMode(2, OUTPUT);
  digitalWrite(2, HIGH);  // pulse to send reset
  delay(1);
  digitalWrite(2, LOW);
  delayMicroseconds(8);
  digitalWrite(2, HIGH);
}

void loop()
{
  digitalWrite(13, LOW);
  delay(500);
  digitalWrite(13, HIGH);
  delay(500);
}


This is a modified blink sketch.  It does almost nothing, just shows you a blinking LED so you can tell the Arduino works.   It does nothing with the serial port.  Whenever it is restarted, it pulses pin 2 low for a few microseconds.

Upload this sketch to your Arduino via the menu File, Upload Using Programmer.  This will remove the bootloader when it uploads the sketch.  You can always put the bootloader back at some point later if you want it.   There are numerous good articles on the web regarding using another Arduino as an ISP programmer, or if you have a dedicated ISP programmer, use it.  You want to remove the bootloader in order to keep the Arduino from trying to bootload or otherwise do anything with the serial pins when it is reset.  

Once the sketch is loaded on your Arduino, it becomes a USB to serial adapter or serial programmer with automatic reset, ready for you to enjoy.   Connect the serial programmer to the target Arduino or chip:
  • TX on serial programmer to TX on target Arduino or chip
  • RX on serial programmer to RX on target Arduino or chip
  • 5V on serial programmer to 5V on target Arduino or chip
  • GND on serial programmer to GND on target Arduino or chip
  • Pin 2 on serial programmer to RST on target Arduino or chip


Select the target Arduino or chip in the menu Tools, Board.

Select the serial programmer's USB port in the menu Tools, Port.

Write and upload a sketch.  The RX and TX LEDs will flicker on your serial programmer, but what is actually being programmed is the target Arduino or chip.  

Notes:
  • The target Arduino or chip must have a serial bootloader on it in order to accept sketches using a serial programmer.  If you don't have a bootloader on it, you will need to burn a bootloader on it with an ISP programmer first.
  • In the procedure above I am telling you to connect TX to TX and connect RX to RX.  This may seem contrary to what you know about serial, but don't worry.   Think about it and look at the UNO or other Arduino board schematics.  The TX pin of the USB to serial adapter chip (CH340G, ATmega8U2, FT232RL, or whatever),  is the RX pin on the Arduino, and the RX pin of the USB chip is the TX pin of the Arduino.
  • I just used this method to turn an Arduino Nano into a serial programmer and then I programmed an Arduino Pro Mini.
  • A Leonardo or Pro Micro or other ATmega32U4-based Arduino can't be used as a serial programmer using this method because it doesn't have a separate USB-to-serial adapter on-board.  To use one of those boards, see:  https://petervanhoyweghen.wordpress.com/2012/11/08/using-the-leonardo-as-usb-to-serial-converter/

Go Up