ArduinoISP on serial rs232

I want to build my own programmer using a 328P running the arduinoISP sketch, and rs232 to hook it up to the computer
I want to use the arduino IDE to program the target (using the menu entry "upload with programmer")

I gave this idea a try on a breadboard and it doesnt seem to work - "avrdude: usbdev_open(): did not find any USB device "usb"

Did anyone try this idea, and get good results? Or does the arduinoISP sketch only work via usb?

Some more details for those that are still reading:
Mac Running IDE 103, arduinoISP sketch is the adafruit version (works on an Uno board)
selected the correct board, selected the correct serial port, selected arduinoISP
I verified the serial communication is working (9600 baud with another sketch)
Hardware is shown on avrprogrammers.com -

Why do I want to do this?
rs232 allows for longer cables than usb, and you can easely solder the connectors yourself. I need to bridge some distance between the computer and the arduino/328P modules i want to (re)program

Very strange. From the error message it appears that programmer selected is one with ".communication=usb" and not the "Arduino as ISP" which has "arduinoisp.communication=serial". I don't know how to explain that. Perhaps you should try turning on verbose uploading messages and posting the messages you get. That would show the full command line presented to avrdude.

What you could do is get a FTDI cable, plug that into your Mac, and then take the (TTL level) RS232 output, and run that down to your board's Tx/Rx pins (and reset, etc.). For a really long cable run, put some RS485 chips at each end to convert the signal to balanced (one each for Tx/Rx and probably Reset as well).

Like this, except with a longer cable run:

I think my setup is not too far off from this ...

On the mac side I use a usb to serial converter based on the prolific 2303 chipset - this is true rs232

On the arduino programmer side I use a max232 chip to convert to ttl level

So far I have not figured out the reset trick with rts - (My max232 chip doesnt have the connection for that) - but I don't think I need to in my case?

As the arduino/328p modules are low level battery powered, and I don't want to risk damaging components (nRF24l01 wireless module - to name one) that are not meant for 5v, I want to use a programmer to (re)program. I plan to make the programmer battery powered and switchable between 3,3v and 5v. This way I can have a long cable run. (tested 20m between this pl2303 and a siemens logo and that worked flawless)

There is more coming, but for now, I want to get the basics working.
I am going to go over everything again, double check connections, probably some minor detail.

But from what I read here, I'm pretty certain my idea is feasable
thank you for the feedback

If anyone is interested in my progress, I'm happy to share

FigZ:
So far I have not figured out the reset trick with rts - (My max232 chip doesnt have the connection for that) - but I don't think I need to in my case?

You have to reset it somehow because that is when the bootloader kicks in.

i don't think so ...
I am using a 328p with the arduinoISP sketch as a programmer - to program a module based on a 328p

When I use a arduino Uno as the programmer, I have to use a capacitor to prevent the uno to reset when the ide starts sending code
it is the programmer that resets the target, using pin 10 wired to the reset of the target

But please correct me if I'm wrong on this

I understand that programming an arduino directly with rs232 would need this functionality.
I do plan to try this approach too, but for now I need a programmer anyway as I reprogram the fuses too on the target. I have done this using a arduino Uno as a programmer so far, but now I want to make a dedicated programmer

I'm confused about your intentions here. You mention using the ISCP programmer, and also using RS232.

I've got a couple of links about programming bare-bones chips/boards:

mmm - yeah - I guess it gets confusing
first want to thank you for your info - I came across it in my search for breadboarding up a 328p, and reprogram the fuses, and it helped me a lot!

So let me try and explain what I want to do exactly:

the mac is running arduino ide - it has a prolific 2303 usb to rs232 converter

(long) rs232 cable

a max232 chip converts the signal to ttl and is part of the (battery fed) programmer - which is basically a 328p running the arduinoISP sketch

which programs the target, a 328p low voltage module which is in a difficult to reach place

my motivations?
why rs232? is an easy way to bridge quite a long distance - and I have the parts on hand
why not program the target through a ftdi/bootloader? usb cables are limited in length - ftdi does ttl serial - also limited in cable length I'd think
why the more complex programmer approach? I need one anyway to reprogram the fuses - so i figured to make it multi functional - and I'm fed up with having to pull my uno from other projects any time I need to program a 328p. And I have a couple of 328p to spare :slight_smile:

alternatives I have considered?
rs232 cable and reset the 328p using the rts signal - using a standard optiboot bootloader - which is something I will try too. Main disadvantage: you can't program the fuses or bootloader
ethernet or internet programmable modules ... some people are working on a bootloader that allows programming the 328p over the internet - but it is far from ready yet

my goal? design a module that can be permanently integrated in my house. figure out what connections the target has to have so I can reprogram it later without having to redesign it. So far I figure, if I have a icsp connector - and maybe add the tx/rx combo, I can reprogram the fuses and the sketch without having to remove the module

OK, so at the end of the cable you have two processors. The Arduino as ISP (which won't be reprogrammed) permanently attached to the target chip, which will. That part wasn't clear. So if you need to do a field upgrade you send the data down to the ISP processor and it does its stuff. Well that all makes sense.

almost ...

the isp is not permanent (to save costs - I plan on having several 'targets')

the target is 'hidden', but I would have a connector that can be reached - and would allow to reprogram and debug
the isp would be hooked up to this connector to allow reprogramming fuses/sketch - maybe even serial communication to allow debugging
so basicaly - a icsp header with added tx/rx - would cover everything I think

so far not much joy on my breadboard experiment - but i'm pretty sure it can be done
I must be overlooking something obvious and simple - right now I'm having trouble using my Uno as isp too

Ah - it is very late and sleep deprivation doesnt help with this sort of thing :frowning:
Thanks for your insights, they really help a lot!

quick update:
using usb and the uno as isp - i can program a target on the breadboard
but using rs232 and a 328p i keep getting an error 'avrdude: stk500_recv(): programmer is not responding'

tomorrow I'm going to double check that serial communication is working, and I'm going to try serial communication with the uno as isp
Any other trouble shooting tips are welcome

btw - using the uno as isp is problematic, to say the least - i'm not even going into that as I don't think it is related, or relevant to this experiment

If you are going to wander around carrying the programming Arduino, why not use something like this? ...

Put the updated sketch on the SD card, connect it up to the ICSP header, and program it. My sketch on that page has a serial interface. You could carry a laptop around to "talk" to it, or revamp a bit and use a button to start the programming process and a couple of LEDs to indicate progress.

I made the whole thing up onto one fairly compact board like this:

Yes, a standalone programmer would be very nice for the 'hidden' modules, and I probably will end up building me one of those in the end
I did come across your site in an early search how to make a standalone 328p, and how to set the fuses correctly. Is it my idea or has your project actually evolved a lot in the last half year or so? I am definately going to have to reread all your information. Thanks for sharing and documenting your ideas! (btw - the arduinoISP adafruit version uses the exact 8Mhz pin 9 idea - one of the reasons I use that version)

but for now I want to try and get this experiment running, learning along the way how everything works, get a better understanding of the whole process. This evening I hope to continue and find out what is going wrong exactly

And as I'm also still learning to program, I do feel I need a direct link between the computer and the module, as I seem to need a lot of debugging and testing to get things working

Right now struggling with a test setup of a wireless module and pointers in C - which is actually the direct motivation of trying to build this programmer - I was fed up with the Uno's flaky behaviour as an isp, and swapping the 328p in and out of the module to test things

(the uno totally dislikes being unplugged from my usb and plugged back in - it flashes the pin13 led fast and is totally unresponsive - I have to reprogram the sketch to get it working again - I have not been able to find more info on this weird behaviour - but I figure it has to do with the usb connection in some way)

I've been playing with your sketch some using a adafruit datalogging shield for it's SD function ( Adafruit Assembled Data Logging shield for Arduino : ID 1141 : $13.95 : Adafruit Industries, Unique & fun DIY electronics and kits ). Got it to work using a bunch of jumper wires to the target ISP pins. No changes were required for your sketch.

I want to solder an 6 pin ISP male header pins to the shield and wire them up to the pins you defined (and gnd and +5vdc) to support the software SPI you are using to talk to the target. I also had to order another couple of 6 pin IDC ribbon cables as I never can seem to help running out of them. :wink:

Anyway you have created yet another great arduino application with this project that really expands ones ablity to support arduino boards independently of the IDE. Can't think (or wait) what your next brainstorm might be. :wink:

Lefty

retrolefty:
Anyway you have created yet another great arduino application with this project that really expands ones ablity to support arduino boards independently of the IDE.

Thanks! It would be nice with an LCD screen, actually. Then it could be truly portable as you could issue the commands via a few buttons and see the confirmation on the screen.

FigZ:
Is it my idea or has your project actually evolved a lot in the last half year or so?

I add incremental improvements, like the ability to reprogram fuses. And there was an issue recently that the Atmega8 did not support the "are you busy" programming query.

Thanks for the supportive comments, they are in effect the "payment" one gets when releasing open-source software. :slight_smile:

I was wondering if you have a spare pcb for that programmer you built?
Only thing that is missing for what I have in mind is a zif socket to program bare chips :slight_smile:
I also wonder - if there is no sd card - can you upload a sketch like you do with the arduino/avrdude ? Like if you want to test and find out you need to change things, do you have to compile and put the new hex file on the sd card first?

If you plan on adding an lcd - consider using a touch screen - that would make an awesome interface, but would probably force you to use a mega (for extra pins and memory)

update: still no joy - but I have to admit I got a bit distracted and didn't spend much time on it these last days
I am uncertain about a reset line on the programmer though - from what I learnt so far I don't need to reset the programmer when the serial communication starts
using the uno as a programmer I disable the reset signal using the cap, right?
and the arduinoISP sketch resets the target when it needs to, right?
Just double checking the obvious things - correct me if i'm wrong

so far I think the serial connection is not working right - but I'm still not sure. maybe the arduino/avrdude doesnt like the usb to serial pl2303? I'm going to try and verify that when I find some more time - use the uno but connect the max232 to the tx/rx pins and see if that works

Just order one from here, which is where I got mine:

I used the Micro SD card breakout:

I also wonder - if there is no sd card - can you upload a sketch like you do with the arduino/avrdude ? Like if you want to test and find out you need to change things, do you have to compile and put the new hex file on the sd card first?

No, it doesn't try to be an Arduino as ISP. It runs independently. However I find that it only takes seconds to copy the .hex file to the card and eject it. I have a console window up, and up-arrow to repeat the copy/eject command.

using the uno as a programmer I disable the reset signal using the cap, right?

Yes, you don't want the Uno to reset.

and the arduinoISP sketch resets the target when it needs to, right?

And it should reset the target by bringing reset low.

Update ...
I have tested my idea using the Uno R3 - and that works
And I realized - that if this works using rs232 - it could probably also work using a wireless serial protocol - with some adaptation to the sketch off course - but first i need to go back to the standalone 328p and figure out why that was not working as an isp
To be continued ...

Some more info for those that want to do the same sort of thing ... what works so far:

Arduino ide 1.0.3 on a mac
pl2303 usb to rs232 serial converter
max232 (rs232 to ttl) converter hooked up to tx/rx on a
arduino uno r3 clone, battery fed with 4xAA rechargable battery @ 5v, running the ArduinoISP sketch (adafruit fork)
connected to the target - a 328p

The sketch I am uploading is a customised blink sketch - the rate of the led is changed to show the sketch reached the destination :slight_smile:

hmmm - no inline youtube movies?

Just a follow up ...

I eventually did get it working - using a stand alone 328p
it seems there is a bad connection on the breadboard

I will have to solder it up on some protoboard to get a reliable result.

powered by 4xAA rechargeable
max rs232 to convert rs232 to ttl level
stand alone 328p running the ArduinoISP sketch

When I find some time I'll post some schematics