Copying from UNO R3 to my own empty board?

Thread Starter

Terrypin

Joined Feb 5, 2016
113
I'm returning to one of the specific 'side topics' discussed in the long thread resulting from my first post a couple of weeks ago
https://forum.allaboutcircuits.com/threads/starting-arduino-but-no-micro-controller-programming-skills.159472/page-3

In that thread I said:
Looking ahead, assuming I can learn enough to design my own circuits, what is the recommended practical approach? After getting something working on the kit breadboard, I assume I can then make a permanent, cased version by buying the appropriate chip and socket, and soldering up on veroboard, my usual approach?

The project that I was about to attempt with traditional stuff would have needed 10 successive 555 monostables (each one driving either a solenoid or some sort of motor, to press a Polaroid CUBE camera button). Hopefully the Arduino will make that task easier - eventually!

I've now completed the sketch for my first project. So I now want to take the MEGA 328 chip away from the UNO R3 board onto veroboard for further work.That will let me continue learning from a variety of sources on what is currently my only UNO. (I gave up trying to repair the original one. You may recall that it worked apart from the upload, implicating a h/w issue with the USB chip. I also posted in the Arduino Forum but never found a solution.)

So I'm now re-reading the advice I received, pasted below for convenience:

djsfantasi
The Arduino also includes power regulation on board. You have already implied that you’re aware of such niceties. It would be required on your custom board.

One area that may foil your efforts is the Arduino family includes an onboard FTDI USB interface. On your roll-your-own boards, you’d have to add this functionality. Or otherwise provide hardware serial communications. This is necessary because it’s the only way to program a bare chip. First, to install a boot loader and second to upload the microprocessor with your sketch (program).

Secondly (because I’ve yet to attempt what your suggestion) the PIN numbers in the Arduino IDE may not match the pins on a raw ATMega328. YMMV

So no, it not as simple as getting something to work on an Arduino and then plugging a bare chip into your custom board.

How are you going to reset the chip if necessary? Do you want some indication of power or serial communications? Do you need a built-in status indicator (in unison now, PIN 13)!

But don’t worry about that now! I’ve embedded Arduino UNOs in several projects and that was it.

Your first challenge is to learn how to use the Arduino. Connecting inputs and outputs. Programming in the Arduino variant of C++. Have fun with it for a while. Besides the kit projects, try all the example code provided with the IDE, read it until you understand exactly what it does. Browse the Arduino, AdaFruit and SparkFun web sites. Learn what a shield is and look at the many shields available from those three resources.

But above all... have fun!


Wolframore
Hey @Terrypin congrats! I love these uC's they certainly make things easier in terms of hardware... I've lost count of how many UNO's and nano's I have... I also have DIP chips and exploring other options for permanent projects. The chips are easy to use. You can basically power them and go. DIP chips can be exchanged on the DIP version of UNO which makes them easy to program... otherwise it's just a little more complicated... JTAG, other arduino.... so on.

djsfantasi
Fine. But you have to know to order chips with the boot loader pre-installed. The TS is an acknowledged µP noob. We have to be specific

Wolframore
You don't need the bootloader pre-installed if you already have an Arduino... you can use it to burn a bootloader on any Arduino IC.

SamR
Actually you don't. The IDE is supposed to be able to do that for you. Havn't tried it yet, but it is there to use.

Wolframore
Plus if you don't mind running at 8Mhz there's an internal clock so basically you just decouple VCC put power to it and go.

I've done it... $1.20-$150 per chip... burn bootloader... solder to board and go. Or better yet put in a DIP socket for options.

--------------------

I've bought these 'ATmega328P-PU Atmel AVR Microcontroller' chips:
https://www.amazon.co.uk/gp/product/B019ILOE5I/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1

From the customer review I read "As expected these are (it seems) genuine ATMEL chips without the Arduino bootloader programmed. I've tried 2 of them and programmed them with the optiboot bootloader with no issues. For those that may care they report 0x1e950f as the signature and avrdude doesn't complain."

Q1: What are the exact steps I should take to burn the bootloader to one of these please? Do I start by carefully removing my UNO 328 and inserting the fresh one then using the IDE as I did before when attempting to repair the original chip?

Q2: Assuming I then have a new bootloaded 328, with my CUBE sketch uploaded to it, can I then place it on my veroboard (in a socket - I'd never dream of soldering it!) and simply add a regulated 5V supply? No need for a crystal or anything else other than my MOSFET components?

Q3: @Wolframore: Can you expand a bit on those 8 MHz chips please? Are they like these?
https://www.ebay.co.uk/i/173226212681?chn=ps

Terry, East Grinstead, UK
 

dendad

Joined Feb 20, 2016
4,451
I would recommend you use an Arduino Mini Pro.
https://www.ebay.com.au/itm/Pro-Min...m41fc8ed93a:g:nj8AAOSwqhtcgzrU&frcectupt=true
I use these as a "component" on some of my boards as I cannot buy the parts themselves for anywhere near this price.
($2.14 AU). That is $1.49 US. And has a crystal, voltage regulator, reset switch, LED and misc Rs and Cs.
A USB to TTL programming lead is needed to program them, but you only need one lead.

These boards fit on a breadboard and once you get the code running on a Uno, just recompile for the Mini Pro. or develop it straight to the Mini Pro, skip the Uno.
 

Thread Starter

Terrypin

Joined Feb 5, 2016
113
Thanks @dendad. I've ordered a couple.

https://www.ebay.co.uk/i/292609589905?chn=ps

At that price I can hopefully get at least one of them working with further practical advice. I'm sure it's a piece of cake when you;ve done it once, but sounds complicated at my novice stage!

But delivery is 2 weeks so ideally I want to get a raw chip working much sooner. Patience not a strong point ;-)
 

Raymond Genovese

Joined Mar 5, 2016
1,653
I think I mentioned this link in one of your previous posts -

Bootloading an AT328P-PU and Approximating the Functionality of an Arduino Uno…on the Cheap!

It is an article right here on AAC which is a step-by-step guide on using the UNO to burn a bootloader and end up with a minimal parts AT328 that you can program with the Arduino IDE, which you already know how to use. The minimal parts are clearly listed and a USB to serial board is needed to program the finished part.

Charles also has an article about the AT328 fuse bits which is worth reading as it causes people some problems if they do not understand them.
 
Last edited:

Raymond Genovese

Joined Mar 5, 2016
1,653
OK, I wired the board and ran Arduino ISB and that was good and then I burned the the bootloader...avr dude dutifully thanked me (the verbose log looks good). Stand by and I will see if did what I thought that I did.

Arduino Bootloader 1.jpg
 

Raymond Genovese

Joined Mar 5, 2016
1,653
OK, I removed the Arduino UNO and those connections. Dug up a USB to serial board and connected that, just as the article says. Added a resistor an LED and proceeded to load and run blink.ino without problem (well I gad TX and RX reversed at first, a mistake that I have made several thousand times) and it's blink away...eazy peezy.
arduino bootloader 2.jpg

what was that..about an hour?
 
...and one last test. I just removed the ATMEGA chip from a run of the mill UNO clone and replaced it with the one that I just programmed. Then I loaded and ran a "fast" version of blink and it all works well. @Terrypin that means that you could replace the ATMEGA in your bricked clone and, possibly, maybe, it could work again.

Arduino Bootloader 3.jpg
 

Thread Starter

Terrypin

Joined Feb 5, 2016
113
Raymond,

I've done the bootloading part but am unable to proceed. Is your 'USB to serial board' another name for 'Converter, USB-to-TTL, with DTR Pin', which is what the article says is needed? Either way I don't have one, so, once I know exactly what it is I'll order one. Unless I can work around that somehow? I'd like to parallel your exercise closely if possible for learning purposes. And also because I'd like to keep my 'bootloading breadboard' for repetitive use.

Meanwhile, I'll now replace the UNO from the UNO R3 board with the freshly burnt chip to test it. Hope it comes out of its socket easily...

--------------------
EDITED a few minutes later. Happily that's now working. :) Thanks a bunch!

Would still appreciate advice about the 'converter'.

I bought five 328s so I may as well prepare the other four now.

--------------------
I will now program this new chip (I'm calling it 328 #2) with my project sketch and breadboard it for further work. What additional circuitry is needed apart from my own and a regulated 5V supply? Is it identical to that used for the bootloading?

Terry
 
Last edited:

Thread Starter

Terrypin

Joined Feb 5, 2016
113
There is only one problem you set the fuse wrong you cant change it and it happens.
only way to fix a bad fuse it to us a hv programmer not cheap and not easy.
.

@be80be: I'm worried by that comment "you set the fuse wrong you cant change it and it happens." etc.

In what situation am I at risk of 'setting the fuse wrong'?
 

be80be

Joined Jul 5, 2008
2,072
You can I burned a atmeg328 bootloader using a uno as isp I some how got distracted.
came back and I had missed the uno bootloader and loaded the wrong one it bricked the chip.

I'd stick with nano's till you learn the in and out's of burning a chip.
AVR not like a pic chip it happily burns what ever you send it.
You can change chip id about what ever you want.

It's easy to burn fuses or bootloader which set's fuses too then it tells you that your atmeg 328
Id 1E 95 0F is a 1E 95 14
 

Thread Starter

Terrypin

Joined Feb 5, 2016
113
Those not surprisingly both display "Doesn't post to United Kingdom" so I'm looking for a cheap UK source. But I'm hesitating because I'm confused by reading in several places, inlcuding this wiki page
https://en.wikipedia.org/wiki/FTDI
that there are issues over validity. Mnay users of USB to serial adaptors report that they don't work, with messages like ""NON GENUINE DEVICE FOUND!"
 

dendad

Joined Feb 20, 2016
4,451
Those not surprisingly both display "Doesn't post to United Kingdom" so I'm looking for a cheap UK source. But I'm hesitating because I'm confused by reading in several places, inlcuding this wiki page
https://en.wikipedia.org/wiki/FTDI
that there are issues over validity. Mnay users of USB to serial adaptors report that they don't work, with messages like ""NON GENUINE DEVICE FOUND!"
Some time ago, FTDI updated their USB driver so that it killed the clone devices. Very poor I think as most folk purchased them in good faith. Go after the cloners, not the users.
Still, the leads I have are ok, but that may be because I run on Macs. That said, there are problems with the other brand's CH340 USB serial chips on MacOS, so you can't win all the time it seems.

I think FTDI got such bad press, like a lot of manufacturers saying they would never trust them again and would use other brands, that FTDI may have rolled back the "update".

There are some USB to serial boards that work well but you will need to add the cable.
 

Thread Starter

Terrypin

Joined Feb 5, 2016
113
Thanks dendad. Having now successfully tested my freshly bootloaded 328 with my first proper sketch on its own breadboard with an independent 5V supply, I no longer really see why I might need a USB serial board?
 

dendad

Joined Feb 20, 2016
4,451
Thanks dendad. Having now successfully tested my freshly bootloaded 328 with my first proper sketch on its own breadboard with an independent 5V supply, I no longer really see why I might need a USB serial board?
You can use one Arduino to program another as you have done. But it is a bit easier to use the lead, or board, like the little red board seen in posts #9 and #11, when programming the mini pro.
Still, well done! Arduinos are quite a versatile device.
I just wish, now that Microchip have Atmel, they would make 80 or 100Mhz fully compatible Atmel chips so Arduinos and the like could get a decent upgrade without new boards or code needed.
 

Thread Starter

Terrypin

Joined Feb 5, 2016
113
You can use one Arduino to program another as you have done. But it is a bit easier to use the lead, or board, like the little red board seen in posts #9 and #11, when programming the mini pro.
Still, well done! Arduinos are quite a versatile device.
I just wish, now that Microchip have Atmel, they would make 80 or 100Mhz fully compatible Atmel chips so Arduinos and the like could get a decent upgrade without new boards or code needed.
Understood, thanks.

I was about to order this one for £4.46

https://www.banggood.com/FT232RL-FT...gn=educ8stv&utm_content=3216&cur_warehouse=UK

But at the bottom of that page I then saw the 'USB TO TTL / COM Converter Module' (complete with a cable) for £2.30. The former looks like the one in Raymond's screenshot, but the latter looks exceptional value. Is its cable the one I need anyway?

As you'll gather, I'm floundering a bit here!

And what is the 'micro pro' you mentioned please?
 
Top