Pages: [1] 2   Go Down
Author Topic: problems programming standalone 328  (Read 1918 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8719
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you burn a bootloader?  Which one?

Does your board have a 16 MHz crystal and load capacitors or a 16 MHz ceramic resonator?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

...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.
Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 525
Posts: 26550
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8719
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

> 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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

 
Logged


Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 525
Posts: 26550
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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


Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2482
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Pages: [1] 2   Go Up
Jump to: