Show Posts
Pages: 1 2 [3] 4 5 ... 8
31  Products / Arduino Due / Re: Updating 16u2 USB firmware on: May 25, 2013, 03:41:46 pm
You could download the current firmware from the 16u2 and compare it to what is in the ide.
Use ArduinoISP on the UNO as programmer. The avrdude command would look like this:

arduino-1.5.2/hardware/tool> avrdude.exe -C avrdude.conf -c arduino -P COMyour_com_port -b 19200 -p m16u2 -vvv -U flash:r:old.hex:i
32  Using Arduino / Microcontrollers / Re: ArduinoISP on Arduino DUE on: May 23, 2013, 03:42:54 pm
Have you considered working with TinyISP instead of ArduinoISP?
I did not know about it. I heard about it but associated the name TinyISP to the attiny based programmer by adafruit. Seems to contain a lot of interesting ideas, I will certainly give it a try. Though it would not work for the Due because of the AVR SPI registers and the AVR assembler...

Thanks Coding Badly for the feedback about the attiny max ISP speed, thanks everybody for the new insights.

Using bitbang SPI, I could now successfully program an attiny85 from the Due (native port only, programming port still gives problems even with autoreset disabled...). Will polish this a bit up and write about it...
33  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.
34  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.

35  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...
36  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.
37  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.
38  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?
39  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.

40  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.
41  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).

42  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...
43  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)
44  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.
45  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.
Pages: 1 2 [3] 4 5 ... 8