Hi..
I was having trouble to upload sketches to ATmega328 chips on breadboard (tried three chips). Tried few different USB adapters and Arduino board itself. Chips themselves do work, if to place them into Arduino board then upload happens normally.
If to upload a 'blink' sketch on to a chip inserted into Arduino board and then transfer it on a breadboard then it runs fine.
So I want to make a dedicated PCB to exclude the breadboard (and also just as an experiment).
Please take a quick glance over my schematic and PCB, just in case if I missed something obvious.
Thanks.
I have tried several different USB to Serial adapters and also tried to use Arduino board as an adaptor as described in 'Arduino on breadboard article'.
Now I want to make a board to reliably test a USB to Serial adaptor that seems to be working - connected it's TX and RX and sent a message via serial terminal. Message returned (appeared in terminal window).
Adaptor and driver seems to be in working order. ATmega328 chips are fine too. So it seems like a poor connection.
So want to make a dedicated PCB to test that USB to Serial adaptor and looking for somebody to look over the design, just in case if I missed something silly.
(Wanted to add here a photo of my USB to Serial adaptors, but dont see the line to add photos.. Will add it to my first message)
What are the silkscreen markings labeling the pins on the red USB to serial adapter board you're using?
I always put a separate 0.1 uF capacitor on AVcc/GND line, as close to the chip as possible. It's quite likely that you can get by sharing a single one, but that's just what I do and I haven't had any problems.
Well spotted! Red adaptor got 6 pins because there are two power pins: 5 and 3.3v. Hence on my board's header pin 5 is not connected.
For decoupling I placed two capacitors 0.1 and 10uF (C11 and C12) right next to pins 7 and 8 of ATmega238 chip.
have a look Nick Gammon's excellent tutorial on standalone Arduinos;
it recommends a 0.1uF cap on the reset line to the DTR pin of the programmer, and i've seen this recommendation quite a few times.
i've gone through "this phase" but on a breadboard which probably you bypassed many issues by having a custom PCB - i wasn't at that level of soldering yet (not even through-hole !)
it was good for the learning experience, but i have since accepted that a ready made ProMini turns out to be less hassle (and cheaper even!) for whatever project you might need a "standalone Arduino" for.
BabyGeezer essentially already said the same thing while I was writing this, but I'll post anyway, since it contains slightly different information:
The reason I'm asking about the USB to Serial adapter is to determine what is going on with this connection between pin 1 and reset. Typically, you would connect the DTR pin to the reset pin via a 0.1 uF capacitor. This creates a reset pulse at just the right time during the upload process so that you don't need to manually reset the ATmega328P to upload. Not all USB to Serial adapters break out the DTR pin and even if pin 1 is DTR, your circuit won't work because you forgot the capacitor.
Sure, totally agree with you that it's far less hassle to just use an Arduino mini and that's how this saga began couple of years ago. Tried a mini for another project, was unable to upload. Then ordered another mini off eBay and while was waiting for it to be delivered done the project in another way.. Then wanted to explore ESP8266, but again was unable to upload. Had to use ESP32 module with USB port instead.
Now I want to make a network of NRF24L01 modules.. While it is plausible to program each ATmega328 chip by inserting it them in to an UNO board one by one.. It's also possible to make an adaptor to connect a ZIF socket to UNO's DIL socket..
But something tells me that it's time to sort this upload problem once and for all
And that's why I'm resorting to making a custom PCB for testing adapters. Would make sense to add several headers to accommodate several different adapters.
Capacitor on reset pin is not likely to be an issue as when I tried to use Arduino board as a USB to Serial adapter upload did not went through. Still, no harm adding 0.1uF capacitor, can just make it's pads longer (to reduce the gap between them) and put a blob of solder as to bypass it if necessary. Thank you for a suggestion!
MorganS
I completely agree with you, it is not wise to stick poky 'male' pins in to holes on PCB. For this purpose there are complementary 'female' receptacles available - on eBay they are sold as "female PCB header 2.54mm".
6v6gt
Good point, tying aref to power indeed seems controversial.
Datasheet for ATmega328 does not specify max voltage for aref pin! (But they do suggest powering AVCC pin via an LC network (p313) - will definitely skip this part )
In UNO board schematic aref is bypassed to ground with a 0.1uF capacitor (and they did connected AVCC to power via an LC network!! ).
In the official 'Arduino on breadboard' article (www.arduino.cc/en/main/standalone) they connected aref to voltage rail.
Just to be safe will add a capacitor to ground and a solder jumper to power. This will allow to try both configurations.
Ok. But you have understood that RX and TX must, in this case, be crossed over.
ATmega328p rx to ftdi tx
ATmega328p tx to ftdi rx
?
This is different to the case when you are using a Uno to program an external chip because the RX and TX markings on the Uno board refer to its ATmega328p, however the serial connection on those pins relevant for programming another chip is to the Uno's USB interface chip, the ATmega16U2
(and assuming of course that the ATmega328p has a bootloader on it)
AlfaOmega:
Capacitor on reset pin is not likely to be an issue as when I tried to use Arduino board as a USB to Serial adapter upload did not went through. Still, no harm adding 0.1uF capacitor, can just make it's pads longer (to reduce the gap between them) and put a blob of solder as to bypass it if necessary. Thank you for a suggestion!
I don't understand why you think your failure to upload using an Uno has any relevance to whether you need a capacitor on the auto-reset circuit.
My advice is to use the standard "FTDI header" (that's just what it's commonly called, it could be used with any chip type) pinout on your board and only buy USB to serial adapters that follow this standard:
DTR
RX
TX
VCC
CTS
GND
The Adafruit boards are goofy in that they have RTS instead of DTR, but they are interchangeable.
Any USB to serial adapter that uses a different pinout is garbage as far as I'm concerned.
pert:
...
My advice is to use the standard "FTDI header" (that's just what it's commonly called, it could be used with any chip type) pinout on your board and only buy USB to serial adapters that follow this standard:
DTR
RX
TX
VCC
CTS
GND
...
Any USB to serial adapter that uses a different pinout is garbage as far as I'm concerned.
while on this subject, the CTS aligns with an 'extra' GND on the ProMini board - should this be avoided or can it be 'left connected' - i've "fixed" this by bending the CTS pin and putting heat-shrink on it so it doesn't touch the ProMini holes.
You can plug right in to the Pro Mini. The Pro Mini was specifically designed with the standard "FTDI header" so that you can easily use them with the common USB to TTL serial adapter boards. I've been using them this way for years with no problems.
BabyGeezer:
While on this subject, the CTS aligns with an 'extra' GND on the ProMini board - should this be avoided or can it be 'left connected' - i've "fixed" this by bending the CTS pin and putting heat-shrink on it so it doesn't touch the ProMini holes.
This is an entirely deliberate arrangement; as previously explained, the Pro Mini is specifically designed for this adapter. The CTS is an input to the USB interface.
pert:
You can plug right in to the Pro Mini. The Pro Mini was specifically designed with the standard "FTDI header" so that you can easily use them with the common USB to TTL serial adapter boards. I've been using them this way for years with no problems.
ahh, good to know that finally - Thanks !
Paul__B:
This is an entirely deliberate arrangement; as previously explained, the Pro Mini is specifically designed for this adapter. The CTS is an input to the USB interface.
no wonder i couldn't find much on whether that pin is active during 'uploading' - i guess Clear To Send is meant to signal when communication the other way is expected.
Pert
I live in Glasgow, Scotland - that's kind of the fringe of civilised world. We got a trade counter of RS Components here and is a good sourse of electronic parts. Their selection of modules however is not that impressive, have to buy them from ebay, quality can be hit and miss. Hence have to design my own.
6v6gt
Yes, you right, pin0 connects to D0 and pin1 connects to D1 - kind of make sense and they explained this part well in 'Arduino on breadboard' guide. Thank you.
BabyGeezer
Haha, that's neat)) Heatshrink insulation is very versatile! Best wishes to you on your projects
As for the board - will add a series capacitor to Reset line and solder jumper with space for capacitor to ground on aRef.
Thank you very much for all your suggestions.
Ha! You think that's the fringe? I'd have to drive 6 hours at least to get to anything like your RS trade counter. Luckily, we're living in the age of the Internet. These are the USB to TTL serial adapters I use exclusively:
Extremely common on eBay and Aliexpress. Not the absolute cheapest, but the extra cost really isn't significant. The FT232 chips are counterfeit but they still work fine. The counterfeits caused some problems back when FTDI released a driver that "bricked" the counterfeits, but that's all blown over years ago.
Thank you for sharing the link.. That adaptor looked oddly familiar so I took a dive to the bottom of my box with all those random modules and found just the thing
(updated photo in first post)
And started testing... And it did not worked, again..
So I tested some more..
Blink sketch was getting interrupted during upload, meaning chip did went in to reset mode.
Checked adaptor module - connected TX and RX and messages went through. Programmed the chip with Arduino UNO board to send serial messages and then tried it with adapter - messages came through.
So it's resetting and serial messages get through, but sketches do not upload... WTF?!?!?
Pulled out logic analyser (for those wondering - yes, this is the PROPER spelling, with 's')..
So the chip was resetting, just too late!!!
BAD CAPACITOR!!!!!! Yes, same used same through-hole capacitor all this time over the course of several years - joy of SMD prototyping.
Sourced a new capacitor and now it works. Hurrah!
I'm one step closer to taking over the world