Go Down

Topic: problems programming standalone 328 (Read 2301 times) previous topic - next topic

poriet

I have made a device which, at the moment, is essentially a 328 with an LED on pin15
( but is called Arduino pin 9 ). I burned a bootloader into it, using a commercial UNO as
the ISP, and then transferred it to its standalone board. Rx and TX are connected to a USB-UART
module ( uses the CP2102 ) I got on Ebay and which seems to be OK because it is recognised by the
pc. I also connected the GND and RST pins. I have tried to upload the basic 'Blink' sketch to the 328
using the Arduio IDE, but without success. In fact I've tried all sorts of things, including changing the name of the
board and the name of the programmer ) All I ever get is a message saying there is a
' sync error 0X00', IIRC.
I thought you could upload sketches to a standalone board using the Arduino IDE via the serial Rx and Tx pins
provided the chip had a bootloader. Does anyone know what the mistake is?

bruce

johnwasser

Did you burn a bootloader?  Which one?

Does your board have a 16 MHz crystal and load capacitors or a 16 MHz ceramic resonator?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

poriet

Thanks for a quick reply!
Yes I did burn a bootloader, using my commercial UNO with the new 328 on a breadboard.
Then I transferred the new 328 to it's new home. I have supplied it with a 16MHz Xtal and 2 caps as recommended.
Perhaps I should burn the BL again and check the new 328 is OK by swapping it for the one in the UNO.

However, if that all goes to plan, the question is still: am I right to assume I can upload sketches  to
this new 328 in its new board, using the CP2102 USB serial device using the Arduino IDE?

bruce





...Rx and TX are connected to a USB-UART
module ( uses the CP2102 ) I got on Ebay and which seems to be OK because it is recognised by the
pc. I also connected the GND and RST pins. I have tried to upload the basic 'Blink' sketch to the 328
using the Arduio IDE, but without success...


Also, all the CP2102 boards that I have seen do not have DTR/RTS to reset the chip.  You might have to manually reset your 328 by waiting till the "Binary Sketch Size 1024 bytes" comes up then press and hold reset till the Rx on the "USB-UART Module" blinks twice, then release.
http://www.spcomputing.com

CrossRoads

"am I right to assume I can upload sketches  to this new 328 in its new board, using the CP2102 USB serial device using the Arduino IDE?"
Yes.
Did you modify the CP2102 module so it can assert DTR thru a 0.1uF cap and reset the uC as part of the programming process?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

poriet

The USB to UART CP2101 module is from China and the make is ( as far as I can tell ) 'BAITE'.
Its a 6-pin job. GND, Rx,Tx,5v,3.3V and then a RST/DTR. I'm having trouble with that last pin.
My understanding was that the upload program had to hold the Reset pin LOW while the chip was being programmed.
I dont know the meaning of 'DTR'. Ergo, I connected the RST/DTR pin direct to pin 1 (RST) on the 328.
Later, I saw a schematic in which the RST/DTR pin of a FTDI module was connected to the '328 Reset pin
via a capacitor.
Was this an awful mistake and would it give the same error code I get ( avrdude....sync error...0X00 )

BTW, just to help confuse matters, I tried uploading the sketch after I'd removed the '328 board, in order to see if there were any little flashing lights on the CP2102 module. I didnt see any, and it gave the same error code,
which I thought was blooming queer, and made me suspect the modyule was iffy.

bruce

johnwasser

> My understanding was that the upload program had to hold the Reset pin LOW while the chip was
> being programmed.

ONLY when using an ISP.  If you hold the Reset low the processor is held in reset and the bootloader isn't running.

> I dont know the meaning of 'DTR'.

"Data Terminal Ready"

> I connected the RST/DTR pin direct to pin 1 (RST) on the 328.

You need a capacitor in that line so the Reset is PULSED, not held low.

> Was this an awful mistake and would it give the same error code I get ( avrdude....sync error...0X00 )

I think so.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

cyclegadget

Quote
Did you modify the CP2102 module so it can assert DTR thru a 0.1uF cap and reset the uC as part of the programming process?


What you need to do with the CP2102:  Cut the trace that goes to reset near the pin. Connect DTR thru a 0.1uF cap to the reset pin.

To connect the CP2102 to board: TX to TX,  RX to RX, reset to reset, V+ to V+, and GND to GND.

Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

CrossRoads

The RST (reset) pin is an input to the CP2102 chip. You cut the trace and connect the DTR signal, which is an output from the CP2102 chip, and goes to your ATMega chip to create a reset.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Also, since you are not getting Rx/Tx blinks, here is the link to the CP210x vcp drivers:

http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx
http://www.spcomputing.com

poriet

Thanks guys.
I think you need to walk before you run, so...
I'll reload the BL with my UNO and check it's OK by fitting the new '328 in the UNO board.
( Thank God for PDIPs ).
Then I do some homework on the CP2102 device.
I thought the DTR 'handshake' pin was obsolete on the serial link these days.
Before I start hacking at my FTDI module with a pen-knife, I need to find out what's going on here.
If it is necessary to separate DTR from RST, why are they on the same pin?
I'll try the 100nF capacitor first.
However, I still have a big puzzle here: 'Cyclegadget' recommends Rx to RX and Tx to Tx,
but the schematic for the 'Minimal Arduino' shows Rx to Tx and vice-versa. Who do I believe?

bruce



However, I still have a big puzzle here: 'Cyclegadget' recommends Rx to RX and Tx to Tx,
but the schematic for the 'Minimal Arduino' shows Rx to Tx and vice-versa. Who do I believe?

bruce


My Breadboard Arduino is FTDI Tx to Atmega PD0(Pin 2/RXD) and FTDI Rx to Atmega PD1 (Pin 3/TXD).
http://www.spcomputing.com

cyclegadget

Quote
However, I still have a big puzzle here: 'Cyclegadget' recommends Rx to RX and Tx to Tx,
but the schematic for the 'Minimal Arduino' shows Rx to Tx and vice-versa. Who do I believe?


I know it sounds incorrect but, I learned it with experience and using a google search. I can say that you can reverse the RX, and TX and not cause harm but, it will not program or output serial if you have them backwards.
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

I dunno cyclegadget, my boards and the schematic (Arduino Pro, virtually a breadboard Arduino) show on the FTDI header (JP5) the Tx<->Rx and Rx<->Tx crossover.
http://arduino.cc/en/uploads/Main/Arduino-Pro-schematic.pdf

Reversing them (Tx<->Tx, etc) give me sync errors.
http://www.spcomputing.com

Riva

I have a different FTDI board but it has...
Pin 1 = DTR
Pin 2 = RX1
Pin 3 = TX0
Pin 4 = VCC
Pin 5 = GND
Pin 6 = GND

DTR is connected through a 0.1uF capacitor to pin1 (RESET)
RX1 is connected to pin 3 (TXD)
TX0 is conncted to pin 2 (RXD)
Both RX1 & TX0 have 10K pulldown resistors connected to GND
VCC & GND are connected to relevant ATMega pins

Go Up