Show Posts
Pages: 1 2 [3] 4 5 ... 8
31  Using Arduino / Microcontrollers / Re: ArduinoISP on Arduino DUE on: May 22, 2013, 04:51:27 pm
Great, I have ArduinoISP working with Nick Gammon's bit banging SPI (on AVR).

Will try with the Due tomorrow.

This looked like a silly idea, but doing so, I already bumped into what looks a long standing bug in ArduinoISP (it is listed in ArduinoISP's google code site) : when entering programming mode, RESET must be pulled low first, then SCK pulled low and then RESET should be pulsed briefly high because this is no poweron-reset situation. Instead ArduinoISP first pulls SCK low then RESET which causes a brief (well...) short circuit if the target drives SCK high... I have never seen a problem with this on my AVR's but with the Due I want to be careful.
32  Using Arduino / Microcontrollers / Re: ArduinoISP on Arduino DUE on: May 22, 2013, 03:06:17 pm
I did not get at flash related commands yet. I first wanted to see whether the spi part of the story worked, so I started with something simple: a read signature command. And that fails already.

Nevertheless it is an idea I want to read about, maybe it is an opportunity to improve ArduinoISP...

Right now I am giving bit banged SPI a try.

33  Using Arduino / Microcontrollers / Re: ArduinoISP on Arduino DUE on: May 21, 2013, 03:28:22 pm
I have picked up the ArduinoISP on Due experiment.
I observed a problem when stopping and restarting SPI.
A fix is proposed here:
I can't program nor run my attiny at 3V3, allthough according to the datasheet it should work
Not being able to run it at 3V3 was a silly wiring error on my side.

However I still can't program the attiny85 from my Due. I figured this could be because of the 3V3 or the SPI speed or a combination of both.

So for comparison, I hooked up the attiny to an atmega328p@16MHz that I powered at 3V3 and that runs ArduinoISP. This worked with the standard  SPI_CLOCK_DIV128. Then I tried higher SPI speeds. SPI_CLOCK_DIV64 still works, but SPI_CLOCK_DIV32 does not! So 4MHz/32 == 125kHZ seems too fast! On the Due I use clock divider 255 resulting in 84MHz/255 == 329kHz. So speed seems to be the problem: the Due is too fast.

To compare this experimental result to the spec: the tiny's lfuse is 0x62 which means 8Mhz internal with a clock divider of 8 => 1MHz cpu clock. The spec says the duration of an SPI SCK  must be 2 cpu cycles high and 2 cycles low => max SPI speed is 250 KHz. If I interpret the data sheet well, my experiment should have worked. My experimentation board setup could be responsible for this though this stuff works for an atmega328p@16MHz as target... anyway 250kHz is still slower than the Due's slowest SPI speed.

Has anybody similar experiences with the tiny's max ISP speed? (I could have mis interpreted the data sheet).

I see no way to configure the Due for a slower SPI.

It seems a bit over the top but I am going to try to use software spi for this...
34  Using Arduino / Microcontrollers / Re: Arduino Micro how to skip bootloader? on: April 28, 2013, 04:28:03 pm
Maybe burning the latest bootloader that comes with the ide is a solution: upon power-on reset it jumps immediately to your code. (pressing reset still takes the usual 8 seconds though).

The idea is to add a jumper to bypass the bootloader, I understand that the usb
port will not work,

Why not? If you would let the bootloader inspect an input and let it jump to your code if e.g. the jumper pulls the input low, you'll have usb once your app runs. That should work.
35  Using Arduino / Microcontrollers / Re: Programming Arduino 328 MINI with Leonardo on: April 14, 2013, 03:23:28 pm
Thanks, Kevlund. I'll place a link to this from my 'isp on leo' writeup.

Though actually I had hoped you used the 'leo as serial converter' approach. I planned to submit an enhancement request/pull request to integrate support for this this in the arduino core. This thread could help convince the developers... Well, when I find some time I'll submit my request...

Now you have something that works, you still might want to try the  'leo as serial converter' approach: right now you don't have a way to see Serial output from your sketches.
36  Using Arduino / Microcontrollers / Re: Programming Arduino 328 MINI with Leonardo on: April 12, 2013, 01:19:40 pm
Do you use the leo or did you buy an usb to serial converter?
If you use the leo, could you post a picture of your setup?
37  Using Arduino / Microcontrollers / Re: Programming Arduino 328 MINI with Leonardo on: April 11, 2013, 03:57:04 pm
EDIT : It looks like the Nick Gammon's programmer is only burning bootloader, isn't it ?
Yes, and that should work (or can be made to work) from the leonardo, but it is probably not needed since the mini comes with a bootloader preburned. So I would start checking the bootloader is still present and working by connecting a led and resistor to the mini's pin 13 and see whether it blinks at least briefly upon startup.

If it does, you can indeed use the leo as usb to serial converter. I see you already found my writeup

You can simplify things a bit.
Using both of following simplifications you don't need to do the hacks described after the sketch  in the write up:
1. Use the sketch for the leo from the link above, but change the baudrate line like this:
static long baud = 115200;
. This way the leo uses the same baud rate as the mini's boot loader from the beginning.
2. reset the mini manually (don't connect the mini's reset pin to the leo). Do you have the mini version with the reset button? If not wire one up.

38  Using Arduino / Microcontrollers / Re: Arduino Miro running ArduinoISP on: March 31, 2013, 04:57:54 pm
Are you running on windows? If yes, using -c arduino instead of -c avrisp should get you further.
See, most of that stuff is applicable to the Micro too.
39  Using Arduino / Microcontrollers / Re: ArduinoISP on Arduino DUE on: March 28, 2013, 04:16:59 pm
So I should replace every instance of Serial with SerialUSB and then use the programming port to upload the sketch ArduinoISP, after that connect the DUE board to the native port and flash the sketch on the external uC?
Do you think I can use the onboard SPI 6 pins?
Yes that is the one to use but be carefull that the target uc does not drive the SPI pins at 5V or the due is damaged. As said before I powered the target at 3V3 to ensure this. (In particular, I left the VCC pin on the Due's SPI headers un connected: it is 5V!)

As said I can't program nor run my attiny at 3V3, allthough according to the datasheet it should work (BOD is disabled). Maybe my attiny is broken, maybe I am missing something.  (If somebody has ideas, that would be great).

40  Using Arduino / Microcontrollers / Re: ArduinoISP on Arduino DUE on: March 27, 2013, 03:53:48 pm
It can be done, but if you have an alternative (uno, leo...) that is more practical.

First of all, the due is not 5V tolerant. I solved this the simplest way by powering the target AVR with 3V3. This worked for me for ISP'ing my Leonardo and a Duemilanove. It failed for an attiny85...

The sample ArduinoISP in the ide is rather old, it should be updated. So get ArduinoISP here: That version is updated to use the SPI library instead of implementing the spi stuff inside the sketch using the AVR specific registers.

I used an SPI clock divider of 255 (the slowest one), the constant in the ArduinoISP sketch is not defined for the Due.

Then there is the autoreset problem. The due's native port autoresets when you open it, this is a classical problem that will cause "burning a bootloader via the ide" to fail. A good alternative is to replace all occurences of Serial into SerialUSB and thus use the native usb port instead of the programming port. This port does not autoreset when opening it.

Finally, I observed a problem when stopping and restarting SPI. But as said, I managed to upload a bootloader into a Leonardo and a Duemilanove.

I am preparing writeups on how to disable autoreset for the programming port and on running ArduinoISP on the due but I am a bit behind with things...
41  Using Arduino / Microcontrollers / Re: Problem with custom Atmega2560 board, cannot use FT232 for Serial comms on: March 19, 2013, 05:49:22 pm
The chip/driver must auto-detect the baud rate coming from the processor, and they seem not to be doing as good a job as the 8U2 chip.
How do you mean? Neither the ftdi nor the 8u2's firmware do that, they just impose the baudrate sent over usb by the pc on their uart.

About the theory of overflowing the ftdi's 64 byte buffer. What if you send data only every say 30 msec? (the buffer is flushed over usb after a configurable timeout which is 16msec by default).

How is the ftdi connected? Is there an auto reset line (DTR or RTS) towards the atmega? Are the other flow ctrl signals connected (toggling cts,... flushes the buffer too)
42  Products / Arduino Due / Re: Arduino as ISP for ATtiny Hardware not recognized on: March 03, 2013, 11:08:14 am
Are you really trying to use the Due as ArduinoISP?

If not, use the ide 1.0.3 instead, it works.

If yes, it can be done but it does not work out of the box, and it is not very practical because the Due's SPI signals are 3V3... I managed to isp a leonardo and a duemilanove using the due as programmer. I powered theses targets with 3V3 to do this. I tried the same with an attiny but that did not work for some reason...
Also you need to get the latest ArduinoISP from rsbohn's github, because that one uses the SPI library instead of thge AVR's SPI register interface.
(I plan a write up about this...)

To use the tiny core, first load ArduinoISP in the due using ide 1.5.2 and then do the tiny stuff using ide 1.0.3.
43  Using Arduino / Microcontrollers / Re: Trying to flash ATMega16U2 of Arduino UNO R3, using Atmel AVRISP MKII on: March 03, 2013, 08:19:57 am
It could be that the atmega16u2 is ok, but the uno has no bootloader anymore:
After that, you can Shift+Upload (Upload using programmer) in the Arduino IDE.
This erases the bootloader. Could it be that uploading stopped working after you tried this for the first time?
If so, try to burn a bootloader to the uno using the avrisp mkII.
44  Products / Arduino Due / Re: arduino due serial is not working on: February 25, 2013, 03:44:47 pm
It is not the serial port that would force the upgrade, it is the composite device.

Downloading a "serial port only" sketch, will work for mac 10.6.8 too.
I just tried the approach I posted before, and can confirm it works on the Due.
(tested on linux, due native port enumerates as serial port only and ASCIITable sample works (when using SerialUSB instead of Serial, I missed that on your first post))
45  Products / Arduino Due / Re: arduino due serial is not working on: February 23, 2013, 06:05:08 pm
It was reported that this does only work since mac os lion.
See here:,137032.msg1031089.html#msg1031089

Previous versions of mac os lack support needed for composite devices (the native port exposes a  composite device: serial + hid). If you only need a serial port you might create and upload a sketch that is a serial port only. I had that running on the leonardo. It probably can be made working on the due too. See here:,137032.msg1033088.html#msg1033088
Pages: 1 2 [3] 4 5 ... 8