Note to moderators. This forum seemed the most obvious place to post. if it is the wrong forum please move to the correct location.
Hi
I'm looking at connecting my arduino to a linksys WRT54GL modem via a hack using the serial ports.
As i plan to use a mega I can use any of the 3 serial ports available on the mega. The standad advice is not to use pin 0 and pin 1 as those are used for the USB comunication. In my case that is what I want as I see the linksys as the PC. I also found that I can run avr dude on my router (will need more disk space though) So that got me thinking. Can I upoad a sketch -using avr dude- via pin 0 and 1? In other words can I bypass the USB?
From what I understand that should be perfectly feasable but I have been wrong before.
What is bothering me most is this DTR that resets the board. I fail to get what that is doing and how that translate in communication and resetting the board.
You are free to use pins 0 and 1 even for TTL level serial communications as long as you don't plug in the USB cable to the board as there could be electrical conflict between the effectively two different digital output being wired together to the arduino's rec pin. The USB serial on board converter chip uses two 10k ohm resistors to isolate it's effect on those pins and they default to high when not receiving data from the PC usb link.
Your correct to be concerned about the DTR usage. The arduino bootloader code in the AVR chip only runs when the chip is first powered up or if a hardware reset is issued. The bootloader once activated listens for a new upload request on the serial pins and if there is no such request after a certain time out period the bootloader then jumps to any users sketch code that might have been loaded prior. So unless you have a way to issue a hardware reset command from your router system you will have no way to start a upload process.
retrolefty:
You are free to use pins 0 and 1 even for TTL level serial communications as long as you don't plug in the USB cable to the board as there could be electrical conflict between the effectively two different digital output being wired together to the arduino's rec pin. The USB serial on board converter chip uses two 10k ohm resistors to isolate it's effect on those pins and they default to high when not receiving data from the PC usb link.
More concerns here now
I'm using a USB cable (cut and the power connected to an external 5V regulated power source) to power the arduino. I prefer this way of powering to the jack or the +5V pin. Does in this case the USB serial on board converter chip power the pins?
retrolefty:
Your correct to be concerned about the DTR usage. The arduino bootloader code in the AVR chip only runs when the chip is first powered up or if a hardware reset is issued. The bootloader once activated listens for a new upload request on the serial pins and if there is no such request after a certain time out period the bootloader then jumps to any users sketch code that might have been loaded prior. So unless you have a way to issue a hardware reset command from your router system you will have no way to start a upload process.
Am I correct in thinking the DTR needs a 3th cable (next to RX and TX?)?
Am I correct in thinking that if I find a way to reset the Arduino before upload it should work?
For instance I could send a serial command to my arduino sketch making it to reset and the upload using AVR dude?
Jantje:
Lefty
Thanks for the swift and clear response.
retrolefty:
You are free to use pins 0 and 1 even for TTL level serial communications as long as you don't plug in the USB cable to the board as there could be electrical conflict between the effectively two different digital output being wired together to the arduino's rec pin. The USB serial on board converter chip uses two 10k ohm resistors to isolate it's effect on those pins and they default to high when not receiving data from the PC usb link.
More concerns here now
I'm using a USB cable (cut and the power connected to an external 5V regulated power source) to power the arduino. I prefer this way of powering to the jack or the +5V pin. Does in this case the USB serial on board converter chip power the pins?
That is fine. As long as there is no active serial communications going on from the PC to the arduino board the two serial lines from the USB serial converter chip to the AVR chip will just act like they are being pull-up with two 10K ohm resistors. Powering your board that way is fine.
retrolefty:
Your correct to be concerned about the DTR usage. The arduino bootloader code in the AVR chip only runs when the chip is first powered up or if a hardware reset is issued. The bootloader once activated listens for a new upload request on the serial pins and if there is no such request after a certain time out period the bootloader then jumps to any users sketch code that might have been loaded prior. So unless you have a way to issue a hardware reset command from your router system you will have no way to start a upload process.
Am I correct in thinking the DTR needs a 3th cable (next to RX and TX?)?
Yes. On an arduino board the DTR signal from the USB serial converter chip is wired through a series .1ufd cap to the AVR reset pin. That is how the arduino IDE running on a PC can activate a board reset which starts up the bootloader code.
Am I correct in thinking that if I find a way to reset the Arduino before upload it should work?
Yes, but the timing of the reset command has to be in sync with the Arduino IDE as if too soon the bootloader my time-out waiting on the bootloader and if too late may also fail. Not sure how you would approch that as I have little knowlege on what and how your router is going to be trying to work with AVRDUDE. You are kind of on your own with this project.
For instance I could send a serial command to my arduino sketch making it to reset and the upload using AVR dude?
An arduino board cannot activate a true reset on it's own via an output pin wired to the reset pin. About the only way to force a chip reset via board software is using a WDT method, and that can be tricky based on what arduino board type you have as not all bootloaders handle WDT resets correctly.
retrolefty
Thank you very much for your help.
Last night I succeeded in my first wireless serial monitor connection to the arduino.
With the info you provided I feel confident I'll get it to work
retrolefty:
For instance I could send a serial command to my arduino sketch making it to reset and the upload using AVR dude?
An arduino board cannot activate a true reset on it's own via an output pin wired to the reset pin. About the only way to force a chip reset via board software is using a WDT method, and that can be tricky based on what arduino board type you have as not all bootloaders handle WDT resets correctly.
I'm thinking about using WDT (which I know as watchdog) but if that fails; toggling the power based on a pin state should do the trick
I have implemented watchdog for the teensy2 and that went smooth. Guess that is the advantage of having a software background