Hi, I am new to Arduino coming from a PIC background and this is my first post:
I am working on a Leonardo compatible board design with some built in hardware interfaces and it works correctly when I burn the stock Leonardo bootloader using my AVRISP mkII and the burn bootloader option in the IDE. Since I need to use my own VID and PID as I will eventually release this as a product, I modified the stock makefile and Caterina bootloader to use those and recompiled. I also made a new board entry and added the board details to the INF file.
The board installed in Windows 7 correctly, the correct USB descriptors showed up and the board appears to run the bootloader correctly at first powerup. I was able to upload a simple test sketch from the IDE and it all went smoothly with the board running the sketch.
Now for the problem: I can't get the auto-reset feature to work when loading a second sketch. It just compiles and hangs on upload. If I use the reset button at just the right moment, I can sometimes get another sketch to load. Why is the behavior different from the stock bootloader? I am using Arduino version 1.04 and the bootloader code from the hardware directory under Caterina.
Thanks in advance,
Jamie
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.
Thank you for the detailed help. The fuses read out correctly.
Your clarification about the core USB being active vs. the booloader when a sketch is running was very helpful and triggered another thought. I may not be assigning the correct PID for the core USB. In the INF entry for the Leonardo below, I am assuming the second line is for the core.
If so, what is the rule for determining the correct PID to use? I am using PID_6070 for the first entry, so I can't just use PID_8070 for the second, can I?
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_0036 # bootloader?
%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_8036&MI_00 # core?
You can check the core USB code, \arduino-1.0.4\hardware\arduino\cores\arduino\USBCore.cpp for the VID/PID info.
Thank you both for your help, I was finally able to resolve the issue. I had made an error in the boards file and pointed to the bootloader PID istead of the sketch PID. I am now a happy camper!
Given this was my first post to the Arduino forum, I must say the speed and level of help here is excellent!
Jamie