When burning a boot loader onto an Atmega328P on a breadboard with an UNO as the ISP, do you necessarily have to use the pins 10 thru 13 on the Arduino UNO. Could you use any pins, and just change the pins number in the ISP sketch loaded on the UNO, or does it HAVE to be the pins affiliated with MISO, MOSI, and SCK, on the UNO?
As far as I'm aware, they're hardware pins like 0/1 or scl/sda etc.
SouthernAtHeart:
When burning a boot loader onto an Atmega328P on a breadboard with an UNO as the ISP, do you necessarily have to use the pins 10 thru 13 on the Arduino UNO.
No, you do not.
Could you use any pins, and just change the pins number in the ISP sketch loaded on the UNO, or does it HAVE to be the pins affiliated with MISO, MOSI, and SCK, on the UNO?
You can use any pins you want but you will have to implement a bit-banged SPI. TinyISP actually has the majority of what you want. It's coded to use the symbols MISO, MOSI, SCK, and RESET to identify the SPI pins. Those would have to be changed to whatever pins you want to use. The relevant code starts here.
If you're not a junior avr hacker, i think you can only change the reset signal and LED pins.
there are 6 pins for ICSP:
- MISO: connect to target MOSI
- MOSI: connect to target MISO
- SCLK: connect to target SCLK
- reset signal: connect to target !RESET (you can change this pin)
- VCC: connect to target VCC
- GND: connect to target GND
there are 2 LEDs for Arduino ISP to indicate status, you can change them too.
If you want to change MISO, MOSI, SCLK, you have to implement your own bit-banging SPI (or take other people's implementation), that would take some effort I guess...
Thanks! I'll check this out and may be back for more help! I'll set up some code to use alternate pins and see how it works.
It will add extra strain on the cpu having to bit-bang rather than relying on hardware.
That's baloney cjdelphi. It just runs slower to bit bang versus using dedicated hardware.
That's like saying shiftOut() is more strain vs SPI.transfer(). Just slower is all.
If you require code to do something that already exists at a hardware level..
Eg send/recv serial pins 0/1, the alternative is generally a slower bit-banging alternative... are you saying there are no hardware pins/ports, and all pins behave identically as it's all software driven by firmware?
cjdelphi:
It will add extra strain on the cpu having to bit-bang rather than relying on hardware.
Strain? ... The poor iddle darling!
That's baloney cjdelphi. It just runs slower to bit bang versus using dedicated hardware.
That's like saying shiftOut() is more strain vs SPI.transfer(). Just slower is all.
"Strain" for a computer system is anything that reduces free-cpu cycles or reduces the shared memory pool; that is, anything that makes the CPU less efficient. I rarely use the word "strain" for a dedicated uC since it is more commonly used for systems, but I see no particular wrong usage.
I used to request "stress testing" on UNIX systems used for middleware; standardized software testing for new hardware or new hardware configurations.
Ray
What a shame... for several unusually good days good ol CJ seemed to make sense when he had a comment... I wonder what happened?
Doc
mrburnette:
That's baloney cjdelphi. It just runs slower to bit bang versus using dedicated hardware.
That's like saying shiftOut() is more strain vs SPI.transfer(). Just slower is all."Strain" for a computer system is anything that reduces free-cpu cycles or reduces the shared memory pool; that is, anything that makes the CPU less efficient. I rarely use the word "strain" for a dedicated uC since it is more commonly used for systems, but I see no particular wrong usage.
I used to request "stress testing" on UNIX systems used for middleware; standardized software testing for new hardware or new hardware configurations.
Ray
Looks like you're the only one here not jumping on the be a bully bandwagon. .. an indeed anything that places more work on a cpu when there's a less cpu consuming way.
Abusive members!
http://3g1l.com/blog-burn-bootloader-blank-atmega328atmega328p-arduino-uno
On the page we find this:
Update:
If your chip comes straight out of the factory it 'should' be fused to work without an external clock - meaning that you don't need the clock and the two capacitors.
But if you allready burnt a bootloader (even if it was aborted) or your supplier modifed the fuses for some reason - you need them.
To remove some of the variables from my question;
- the only purpose of my project is to burn boot loaders to different chips, so,
A) it's only a temporary setup for the second chip
B) the primary chip won't be doing anything else, so it won't matter if even all it's CPU is consumed in this task.
C). The secondary chip I'm burning, when installed in its permanent home, will have a 10k resistor on the reset pin, and crystal and caps for 16 MHz.
So then I was hoping I could burn a boatloader to them without the caps, & crystal, and maybe even the resistor. But this quote from another website says if the chip is already is fused for a crystal it won't work. I just wondered if this was true? If it not true, I've got a meat idea that I think others would enjoy, but it means burning a boot loader on an atmega328P-AU without the crystal. And it can't be that it must he fused right to start with. It has to work either way.
Hope this clears up my question a little.
Please refrain from the personal insults.
For my part, I can't see what everyone is getting worked-up about - it isn't like the processor is likely to be doing anything else, so the processor isn't really "strained" at all, is it?
I think someone - or more than one - is having (more than) a little fun here referring to "stress" on a MCU/ CPU.
Now what we - generically I believe - would like to know is why would you want to use other than the "standard" pin connections in this instance, especially when you say you will be doing it in a perfectly straightforward way anyway. That said,
SouthernAtHeart:
the primary chip won't be doing anything else, so it won't matter if even all it's CPU is consumed in this task.
Dead right. And that is precisely the point - in most cases, the processor spends the vast majority of the time "busy waiting" - looping around waiting for something to happen. This is almost certainly the case here, the speed of the SPI should hardly be the most critical factor in the programming time, if at all. (No doubt, someone will now explain why it is. :)) Only when timing is critical, do you need to worry about how much the processor is being "asked" to do.
SouthernAtHeart:
So then I was hoping I could burn a boatloader to them without the caps, & crystal, and maybe even the resistor. But this quote from another website says if the chip is already is fused for a crystal it won't work. I just wondered if this was true?
If the chip is set up for a crystal, then it does require a crystal to execute its programming code - since it is in fact code that it is executing - it is "hard-coded" but not hard-wired. And to do that, it requires its clock, in whatever form the clock has been defined in the hardware.
SouthernAtHeart:
If it not true, I've got a neat idea that I think others would enjoy, but it means burning a boot loader on an atmega328P-AU without the crystal. And it can't be that it must he fused right to start with. It has to work either way.
You have been beaten to it. At least one version of the "Arduino as ISP" code provides a clock on another pin. Have you studied Nick Gammon's tutorials under "Alternate clock source"?
For me, extra strain .... means anything that's less efficient than a hardware way, if all the pins are assigned by the bootloader and MISO, MOSI, clock, data, if all of it is simply firmware bit-banging at the core..
then fine, there's probably no extra strain at all, but even if it means using 1 byte more of memory or having to do 1 more clock cycle because it's less efficient due to work around or other problems you encounter..
it's extra strain, if you were made to count out 32 carrots a day and then it went up to 33... that's an extra 365 carrots a year.
if you're going to attack what i said, then at least explain how hardware pins work and why it's no extra strain instead of childish name calling.
The SPI hardware works by having a dedicated parallel to serial shift register.
You write a byte to it, and about 17 clocks later the data is all shifted out.
Versus s/w bit banging:
put an X on the pin (could be 1 or 0 - and does not include whatever steps is needed to mask off a byte to find the 1 or 0)
make the clock line high
make the clock line low
put the next bit on the pin
make the clock line high
make the clock line low
repeat 6 more times.
You want to achieve a nearly 1 Megabyte transfer rate (1 byte every uS), you need to use the SPI hardware.
I think this whole thing kicked off because of the unusual meaning you gave to "strain".
Paul__B:
SouthernAtHeart:
So then I was hoping I could burn a boatloader to them without the caps, & crystal, and maybe even the resistor. But this quote from another website says if the chip is already is fused for a crystal it won't work. I just wondered if this was true?If the chip is set up for a crystal, then it does require a crystal to execute its programming code - since it is in fact code that it is executing - it is "hard-coded" but not hard-wired. And to do that, it requires its clock, in whatever form the clock has been defined in the hardware.
Incorrect. Any reasonable clock signal present on the XTAL1 pin will work.
SouthernAtHeart:
So then I was hoping I could burn a boatloader to them without the caps, & crystal, and maybe even the resistor.
The resistor is there to make the reset more stable. The RESET pin has a weak (~50K ohm) internal pull-up resistor. In my experience that has always been sufficient for the purpose of programming a target. The target only has to be in a non-RESET state long enough to resynchronize with the programmer (a few milliseconds) so you are very unlikely to have problems if you exclude the external pull-up resistor.
But this quote from another website says if the chip is already is fused for a crystal it won't work. I just wondered if this was true?
No. That is absolutely not true. Any reasonable clock signal on the XTAL1 pin allows the target to be programmed. The folks at Ada Fruit have published a version of ArduinoISP that provides such a clock signal. The version of ArduinoISP I referenced earlier (TinyISP) can easily be configured to output a similar clock signal.