Show Posts
Pages: 1 [2] 3 4 ... 8
16  Using Arduino / Microcontrollers / Re: Auto-reset not working on modified Leonardo bootloader on: June 05, 2013, 03:42:08 pm
Once the sketch runs, the usb code from the core is in action, not that from the bootloader.
Does the board show up correctly in device manager once the sketch runs?

The autoreset code is in CDC.cpp. You might want to instrument it to see whether linestate changes whilst baud rate is 1200bps.

Auto reset uses the watchdog timer. I think this needs the WDTON fuse bit. Compare high fuse byte against what is in boards.txt: 0xd8.
17  Products / Arduino Due / Re: SPI.end() causes SPI.transfer() to hang even after a new SPI.begin() on: June 04, 2013, 05:11:57 pm
Almost, the initcb() (which is SPI_0_Init()) has to be called too.
Thanks!
18  Products / Arduino Due / Re: SPI.end() causes SPI.transfer() to hang even after a new SPI.begin() on: June 04, 2013, 03:00:20 pm
I am using the old AVR compatible api's.
I can confirm the above work around works for me too.

But after calling SPI.end(), I want to tristate SCK and MOSI. How do I do that? I tried adding
Code:
pinMode(MOSI, INPUT);
pinMode(SCK, INPUT);
But after that SPI.begin() does not work anymore.
I dare not configuring them as output before calling SPI.begin() because I noticed that SPIClass::begin() does not have code in it to do so, that is probably done for a reason.
19  Using Arduino / Microcontrollers / Re: Due as ISP Programmer for Leonardo/AtMega32u4 on: June 04, 2013, 02:40:08 pm
@coolf: I normally use linux, but for verification I tried the command line myself on windows 7 SP1 64bit.
As  explained we can use the avrdude (and later the leo bootloader) from the 1.0.3 ide:
Code:
arduino-1.0.3\hardware\tools\avr\bin>avrdude.exe -C ..\etc\avrdude.conf -c arduino -P COM10 -p m32u4  -U signature:r:test.hex:h

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude.exe: Device signature = 0x1e9587
avrdude.exe: reading signature memory:

Reading | ################################################## | 100% 0.04s

avrdude.exe: writing output file "test.hex"

avrdude.exe: safemode: Fuses OK

avrdude.exe done.  Thank you.
20  Using Arduino / Microcontrollers / Re: Due as ISP Programmer for Leonardo/AtMega32u4 on: June 04, 2013, 02:13:24 pm
@reinaldoaff: just specify 255 instead.
(actually I noticed it gets overwritten anyway by SPI::begin(), so we'll be spi!ing at 4MHz anyway, but this is ok, it works)
21  Using Arduino / Microcontrollers / Re: Due as ISP Programmer for Leonardo/AtMega32u4 on: June 04, 2013, 11:08:24 am
Don't give up.
I have the same Due and the same Leo, if it works for me it must work for you too.

Try to work incrementally. First make isp work from the command line.
Go to the arduino-1.5.2/hardware/tool directory and enter this command:
Code:
avrdude.exe -C avrdude.conf -c arduino -P YOURDUECOMPORT  -p m32u4 -vvvv -U signature:r:test.hex:h

I assume you use the native usb port.

Post the output here.
22  Using Arduino / Microcontrollers / Re: Due as ISP Programmer for Leonardo/AtMega32u4 on: May 30, 2013, 11:21:31 am
Quote
I would love to say: IT`s working Jipppii, but i can`t.
Don't worry we'll get there.

Let us first get the power aspect right. I want to avoid someone damages his or her Due because of reading this thread.

Quote
I changed the connection pin. power supply of the target (Vin = 3.3V) to the Vdd(5V) pin
Not sure how to interpret this, but I meant following:

Code:
Pin Due    |    Pin Leonardo
3.3V       |    5V

This is what I used. I found it an intuitive way to power the atmega32u4 at 3V3. From the schematcs of the Leonardo, I don't see a problem with this, but of coarse I might overlook something. (Any feedback about this is wellcome). Anyway I experienced no neagtive effect of it.

Very important: never plug in the Leo's usb port while this wiring is in place (Leo powered by the Due's 3V3) !

Now, about the call stack trace: I remember some issues being reported with the way 1.5.2 deals with sketchbook directories.

So there are two approaches:
1. Leave the "leofix" in place and burn the bootloader using ide 1.0.3 or higher. The ide does not care your programmer happens to run on a Due.
2. Remove the "leofix" (remove again the hardware directory from your sketchbook directory). Instead, directly modify arduino-1.5.2/hardware/arduino/avr/programmers.txt: change these items:
Code:
arduinoisp.protocol=stk500v1
arduinoisp.program.protocol=stk500v1
into
Code:
arduinoisp.protocol=arduino
arduinoisp.program.protocol=arduino
Also make sure the baud rate is correct (19200).
The arduinoisp.program.xxx entries are new to me, but the only goal is to use arduino as protocol because you are on windows.

23  Using Arduino / Microcontrollers / Re: Due as ISP Programmer for Leonardo/AtMega32u4 on: May 29, 2013, 02:36:30 pm
I connected the 3V3 of the Due (don't take the adjacent 5V by mistake)  to Vdd ("5V") of the Leonardo
About the programmer: on windows you should do the "Leofix trick" see:http://petervanhoyweghen.wordpress.com/2012/09/16/arduinoisp-on-the-leonardo/, step 7.
Also do this SPI fix: http://forum.arduino.cc/index.php?topic=165497.0

It is better to first try something simpler: download the booter from the device or read out the signature bytes, so you know isp works.


24  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:

Code:
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

http://arduino.cc/en/Hacking/Upgrading16U2Due
http://petervanhoyweghen.wordpress.com/2013/02/25/modifying-the-atmega16u2-firmware-on-the-due/
25  Using Arduino / Microcontrollers / Re: ArduinoISP on Arduino DUE on: May 23, 2013, 03:42:54 pm
Quote
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...
26  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.
27  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.



28  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.
Quote
I observed a problem when stopping and restarting SPI.
A fix is proposed here:
http://forum.arduino.cc/index.php?topic=165497.0
Quote
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...
29  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).

Quote
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.
30  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.
Pages: 1 [2] 3 4 ... 8