Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / Re: [SOLVED]Leonardo Clone 32u4 based board it is not recognized in USB port on: May 14, 2013, 04:38:34 am
Sorry for digging this out again, but I just wanted to point out for you, dear future reader, that level conversion from USB to the ATmega32U4 is not necessary. The controller is designed to handle the USB signal.
2  Using Arduino / Microcontrollers / Re: Leonardo Clone 32u4 based board it is not recognized in USB port on: April 11, 2013, 07:36:04 am
Can you post your layout and pictures of the board (bottom side)?
3  Using Arduino / Microcontrollers / Re: How to check whether internal oscillator is oscillating? on: April 08, 2013, 05:21:48 am
There is a fusebit called CKOUT. If you set it, the controller outputs the clock signal on PB0.
For fiddling around with fusebits, check out the awesome  Engbedded fusebit calculator
(No, I'm not related in any way to this website, just because I promoted it 2 times in 10 minutes smiley)
4  Using Arduino / Microcontrollers / Re: Leonardo Clone 32u4 based board it is not recognized in USB port on: April 08, 2013, 05:15:28 am
How often does it blink? In the video it looks like it's breathing a few times (soft fading blinking) and then it stays lit for a while and then continues with a regular blink of about .5 Hz. Is that correct? In my application, the bootloader breathes a few times and then the LED is constantly OFF. Did you upload a blink-skech or something like that?

What you can also do is try the LUFA bootloader by Adafruit:

(Quote from my Wiki)

Quote
Lufa Bootloader

Bootloader Installation

In order to use the Atmega32U4 with the Arduino SDK, the Atmel bootloader that is factory-default has to be replaced. In our setup, we use the Adafruit fork of the LUFA bootloader that can be downloaded here: http://github.com/adafruit/lufa-lib

Flash the bootloader to the chip using AVRDude:

Code:
avrdude -p m32U4 -P /dev/ttyS0 -U flash:w:BootloaderCDC.hex

After that, set the correct fusebits:

Code:
avrdude -p m32U4 -P /dev/ttyS0 -U lfuse:w:0xe0:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m

Try everything out:

Code:
avrdude -p m32U4 -P /dev/ttyS0 -nv

And you should get:

Code:
avrdude: safemode: lfuse reads as E0
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB

Modification in the Arduino IDE

The bootloader will not be recognized by a fresh installation of the Arduino IDE. You need to modify the file "arduino-1.0.n/hardware/arduino/programmers.txt".
Add the following:

Code:
avr109.name=Adafruit Bootloader
avr109.communication=usb
avr109.protocol=avr109

Now restart the Arduino IDE. The bootloader should be listed as Adafruit Bootloader. Select that one to flash the Atmega32U4.

Again please note that I run the controller on an external clock. I can really recommend the Engbedded fusebit calculator to look up fusebit issues.
5  Using Arduino / Microcontrollers / Re: Leonardo Clone 32u4 based board it is not recognized in USB port on: April 05, 2013, 04:57:00 am
Well except that I tied the AVCCs directly to VCC and that I'm using an oscillator and not a crystal, my (working) schematic is the same. However, I've seen similar dmesg outputs on some of my devices due to soldering problems at the USB connector. Also, are you sure the caterina bootloader is installed correctly? Fusebits set correctly?
Quote from my internal Wiki:


Quote
Bootloader Installation

In order to use the Atmega32U4 with the Arduino SDK, the Atmel bootloader that is factory-default has to be replaced. In our setup, we use the Arduino Leonardo bootloader. It is called 'Caterina' and can be found in the Arduino directory:

Code:
arduino-1.0.2/hardware/arduino/bootloaders/caterina

Flash the bootloader to the chip using AVRDude:

Code:
avrdude -p m32U4 -P /dev/ttyS0 -U flash:w:Caterina-Leonardo.hex

After that, set the correct fusebits:

Code:
avrdude -p m32U4 -P /dev/ttyS0 -U lfuse:w:0xe0:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m

Try everything out:

Code:
avrdude -p m32U4 -P /dev/ttyS0 -nv

And you should get:

Code:
avrdude: safemode: lfuse reads as E0
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB

Now start the Arduino IDE. Select 'Arduino Leonardo' as your board and the matching '/dev/ttyACMn' port as port.

You can also check if the bootloader is running by connecting an LED to PC7. It should "breathe" (fade in/out) after startup.

Good Luck!

6  Using Arduino / Microcontrollers / Re: using leonardo to upload sketches to atmega168/328 on: November 12, 2012, 06:27:47 pm
Oh, it's measured BEFORE the cap. Plus I can see the Arduino reset, because the high frequency blink-sketch stops and starts again after avrdude fails. So that works.
7  Using Arduino / Microcontrollers / Re: using leonardo to upload sketches to atmega168/328 on: November 12, 2012, 09:40:37 am
I still have issues with your sketch. The auto reset works fine, I can see that on the scope, see attached image. The reset line is green and is released once DTR is triggered, letting the slave Arduino run it's bootloader. (Which it does.). Shortly after that, the blue line (Leonardo TX) issues 3 requests to the bootloader of the slave Arduino, which does not respond. So the upload fails. Right now I have no idea why. If I use the regular USB connection of the slave Arduino, it works. I'd once been able to flash my Duemilanove with an external FTDI, but for some reason, that also fails now.


8  Using Arduino / Microcontrollers / Re: [Custom Duemilanove] Bootloader works only once on: November 12, 2012, 05:58:37 am
So the fuses are still broken, but I figured out why the fade-example did not work: Not a 'PWM-Pin'. That's exactly the problem with the Arduino 'abstraction layer': You're so detached from the actual hardware of the Atmega when you program. But still: my mistake smiley Anyway, I keep diggin into the fusebits.
9  Using Arduino / Microcontrollers / Re: [Custom Duemilanove] Bootloader works only once on: November 09, 2012, 11:23:51 am
I always use http://www.engbedded.com/fusecalc which tends to work fine. I don't think that it's the fuses, because why should it work the first time? Does uploading via bootloader touch the fuses? I don't think so.
10  Using Arduino / Microcontrollers / [Custom Duemilanove] Bootloader works only once on: November 09, 2012, 10:40:42 am
Hey!

I built a small board with an Atmega168, flashed the Duemilanove bootloader to it using an STK500 (custom entry in the programmers.txt) with the Arduino IDE and tried to use the bootloader with an external FDTI board. So the first time I flash the blink example, it works without problems. The second time I try to upload anything, I get avrdude: stk500_recv(): programmer is not responding. If I reflash the bootloader, it works again, but only once. Can it be because I use an oscillator (external clock, only on XTAL1) instead of the crystal oscillator on the standard arduino boards? I tried to burn the bootloader and after that set the fuses using avrdude -p m168 -P /dev/ttyS0 -U lfuse:w:0xE0:m -U hfuse:w:0xdd:m -U efuse:w:0x00:m matching to the external clock. Same effect.
What I also noticed is that the Fade example does not fade but just blinks slowly. o.O

I use Arduino 1.0.2 btw. I remember having similar issues with an Atmega8 a few years back. (Bootloader working only once)
11  Using Arduino / Microcontrollers / Re: using leonardo to upload sketches to atmega168/328 on: November 08, 2012, 10:42:51 am
I'm really sorry for hijacking this thread, but if I had to define a topic for my problem, this would be exactly it.

So I've got this setup with an Atmega32U4 and an Atmega168 on a custom board. The Atmega32U4 is equipped with the Leonardo Bootloader (caterina) and works like a charm. The Atmega168 is supposed to run one of the other Arduino bootloaders. For my test setup, I use an old Duemilanove with an Atmega328.
So what I'm trying to do right now is to use the /dev/ttyACMn interface of the Leonardo to program the Duemilanove which is connected to the secondary (serial1) UART.
Or simply:

[PC]===[Leonardo]===[Due]

The Code on the Leonardo looks like this:

Code:
int led = 7;         // incoming serial byte
int reset = PORTD4;
int stillReset = 0;
void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
  Serial1.begin(9600);
  pinMode(led, OUTPUT);
  pinMode(reset, OUTPUT);
  digitalWrite(reset, LOW);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

}

void loop()
{
  if (Serial.available() > 0) {
    if (stillReset > 0){
      digitalWrite(reset,HIGH);
    }
    if (stillReset == 0){
      digitalWrite(reset,LOW);
      stillReset ++;
    }

    digitalWrite(led, HIGH);
    Serial1.write(Serial.read());               
  }
    if (Serial1.available() > 0) {
      digitalWrite(led, LOW);
    Serial.write(Serial1.read());               
  }
}

As you can see, the Due is reset when the first byte is received from the PC. My analysis seemed to show that the PC is sending the character '0' three times and waiting for the Arduino to reply. But even without the automatic reset, if I try it manually, it only shows me a bunch of sdk-failed errors.
Any idea why this is not working? Is the /dev/ttyACMn really equal to the /dev/ttyUSBn or /dev/ttySn?

Thx for your help!
12  Using Arduino / Installation & Troubleshooting / Re: Custom Leonardo Clone: Upload fails on: October 10, 2012, 04:42:12 am
Which of my two problems are you refering to?
13  Using Arduino / Installation & Troubleshooting / Re: Custom Leonardo Clone: Upload fails on: October 08, 2012, 09:27:21 am
I tried the same board on another laptop (Ubuntu 10.10) and that one does not even create a /dev/ttyACMn. The board is detected as a full speed USB device and a HID device, but not as a USB ACM device and is thereby not selectable in the IDE. Is that a problem with cdc_acm?
14  Using Arduino / Installation & Troubleshooting / Custom Leonardo Clone: Upload fails on: October 08, 2012, 07:42:24 am
Hey!

I've build a custom Leonardo clone and flashed the Arduino Leonardo bootloader to the m32u4. If I connect the device, dmesg shows:

Code:
[945775.729405] usb 8-2: new full speed USB device using uhci_hcd and address 100
[945775.910627] cdc_acm 8-2:1.0: This device cannot do calls on its own. It is not a modem.
[945775.910643] cdc_acm 8-2:1.0: ttyACM11: USB ACM device
[945775.918801] generic-usb 0003:2341:0034.0033: hidraw2: USB HID v1.01 Device [Arduino LLC Arduino Leonardo bootloader] on usb-0000:00:1d.2-2/input2

In the Arduino IDE, I select the corresponding ttyACMn port and hit Upload. It compiles and than shows "Uploading" for all eternity. If I dmesg after clicking "Upload", I see that the port is re-allocated.
For example, I select ttyACM0 for the board, hit Upload, dmesg shows that the port is now ttyACM1.

However, because the Leonardo's serial port is virtual, it disappears when the boards resets, the Arduino software uses a different strategy for timing the upload than with the Uno and other boards. In particular, after initiating the auto-reset of the Leonardo (using the serial port selected in the Tools > Serial Port menu), the Arduino software waits for a new virtual (CDC) serial / COM port to appear - one that it assumes represents the Leonardo bootloader. It then performs the upload on this newly-appeared port.

Furthermore, it is suggested that

These differences affect the way you use the physical reset button to perform an upload if the auto-reset isn't working. Press and hold the reset button on the Leonardo, then hit the upload button in the Arduino software. Only release the reset button after you see the message "Uploading..." appear in the software's status bar. When you do so, the bootloader will start, creating a new virtual (CDC) serial port on the computer. The software will see that port appear and perform the upload using it.

That does not work for me, but in fact what I realized that if I plug the Leonardo clone and select the port in the Arduino IDE, dmesg shows

Code:
[946468.972529] tty_port_close_start: count = -1
[946468.972611] tty_port_close_start: count = -1
[946468.972691] tty_port_close_start: count = -1
[946468.972774] tty_port_close_start: count = -1
[946468.972854] tty_port_close_start: count = -1
[946468.972932] tty_port_close_start: count = -1
[946468.973010] tty_port_close_start: count = -1
[946468.973090] tty_port_close_start: count = -1
[946468.973168] tty_port_close_start: count = -1
[946468.973246] tty_port_close_start: count = -1
[946468.973324] tty_port_close_start: count = -1
[946468.973401] tty_port_close_start: count = -1
[946468.973478] tty_port_close_start: count = -1
[946468.973556] tty_port_close_start: count = -1

So the autoreset is failing? Or what does that mean?

Thx for your help!




Pages: [1]