Go Down

Topic: ArduinoISP on serial rs232 (Read 2296 times) previous topic - next topic

FigZ

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 http://avrprogrammers.com/bld-avr-arduino-isp-232.php

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

johnwasser

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.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Nick Gammon

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).
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Like this, except with a longer cable run:

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

FigZ

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

Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

FigZ

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

Nick Gammon

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:

http://www.gammon.com.au/forum/?id=11637

http://www.gammon.com.au/forum/?id=11109
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

FigZ

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 :)

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

Nick Gammon

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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

FigZ

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 :(
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



Nick Gammon

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

http://www.gammon.com.au/forum/?id=11638

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:


Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

FigZ

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)

retrolefty


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

http://www.gammon.com.au/forum/?id=11638

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:





I've been playing with your sketch some using a adafruit datalogging shield for it's SD function ( https://www.adafruit.com/product/1141 ). 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.  ;)

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.  ;)

Lefty

Nick Gammon


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.



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. :)
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up