ADRUINO LEONARDO 上传问题!
从TB购得LEONARDO板子一块,自己焊接好了,用编程器把LEONARDO的bootloader烧进去了,现在电脑能够认识这块板子了,开机先显示一个ADRUINO LEONARDO bootloader (COM5)的设备,然后切换到ADRUINO LEONARDO(COM4)设备。一切看似正常了,但是...当我打开一个sketch编译上传,RX和TX LED狂闪,设备管理器里面的ADRUINO设备都消失了,等了很久ADRUINO上传报错,我在preference里面打开upload的verbose后,查看打出来的信息,如下:
Binary sketch size: 4,758 bytes (of a 28,672 byte maximum)
Estimated used SRAM memory: 157 bytes (of a 2560 byte maximum)
Forcing reset using 1200bps open/close on port COM4
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM4, COM8, } => {}
PORTS {COM4, COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
PORTS {COM8, } / {COM8, } => {}
processing.app.debug.RunnerException: Couldn’t find a Leonardo on the selected port. Check that you have the correct port selected.If it is correct, try pressing the board's reset button after initiating the upload.
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:152)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1716)
at processing.app.Sketch.exportApplet(Sketch.java:1628)
at processing.app.Sketch.exportApplet(Sketch.java:1600)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2462)
at java.lang.Thread.run(Unknown Source)
Forcing reset using 1200bps open/close on port COM4 这个执行后,TX RX LED开始狂闪,设备管理器里面的ADRUINO设备消失,这个时候,我如果按一下reset按钮,就会正常下载代码了,但是,ADRUINO LEONARDO不是说可以自己让板子重启的吗,
private boolean uploadViaBootloader(String buildPath, String className)
throws RunnerException, SerialException {
Map<String, String> boardPreferences = Base.getBoardPreferences();
List commandDownloader = new ArrayList();
String protocol = boardPreferences.get("upload.protocol");
// avrdude wants "stk500v1" to distinguish it from stk500v2
if (protocol.equals("stk500"))
protocol = "stk500v1";
String uploadPort = Preferences.get("serial.port");
// need to do a little dance for Leonardo and derivatives:
// open then close the port at the magic baudrate (usually 1200 bps) first
// to signal to the sketch that it should reset into bootloader. after doing
// this wait a moment for the bootloader to enumerate. On Windows, also must
// deal with the fact that the COM port number changes from bootloader to
// sketch.
if (boardPreferences.get("bootloader.path") != null &&
(boardPreferences.get("bootloader.path").equals("caterina") ||
boardPreferences.get("bootloader.path").equals("caterina-LilyPadUSB"))) {
String caterinaUploadPort = null;
try {
// Toggle 1200 bps on selected serial port to force board reset.
List<String> before = Serial.list();
if (before.contains(uploadPort)) {
if (verbose || Preferences.getBoolean("upload.verbose"))
System.out
.println(_("Forcing reset using 1200bps open/close on port ")
+ uploadPort);
Serial.touchPort(uploadPort, 1200);
// Scanning for available ports seems to open the port or
// otherwise assert DTR, which would cancel the WDT reset if
// it happened within 250 ms.So we wait until the reset should
// have already occured before we start scanning.
if (!Base.isMacOS()) Thread.sleep(300);
}
从上面的ADRUINO源码看,LEONARDO是通过设置波特率为1200,就让板子重启,这个机制怎么实现的? 如果实现了,那为何我的板子不能自己重启呢?
难道是我的板子出问题了。我检查了板子的RESET电路,很简单的
会不会是熔丝位设置问题呢,我的芯片是直接从厂商拿的,是全新的,会不会是重启机制需要用到看门狗,而我的看门狗被禁用了啊,无从得知,怎么查呢? 感觉是熔丝位设置的问题,你的熔丝位设置的是什么样的? 我昨晚把熔丝按照手册的缺省值设置了,重启后,板子进不去了,缺省设置里的晶振是设置为内部的RC振荡器,有并行编程器,但没有适配器,查了半天网上的资料,外界一个12M的信号上去,把板子恢复了,现在熔丝是厂商设置了,除了晶振设置为了外部晶振,还是一样的效果 我以前碰到过类似的问题,不过没有从代码上找原因,我换了根usb延长线,或者将板子直接接到usb口上就好了 好了,完全解决问题了,就是fuse设置的问题,主要是fuse里面的
参照这里,要把fuse和lock设置为如下的值,主要是
Boot Reset vector Enabled (default address=$0000); ##############################################################
leonardo.name=Arduino Leonardo
leonardo.upload.protocol=avr109
leonardo.upload.maximum_size=28672
leonardo.upload.speed=57600
leonardo.upload.disable_flushing=true
leonardo.bootloader.low_fuses=0xff
leonardo.bootloader.high_fuses=0xd8
leonardo.bootloader.extended_fuses=0xcb
leonardo.bootloader.path=caterina
leonardo.bootloader.file=Caterina-Leonardo.hex
leonardo.bootloader.unlock_bits=0x3F
leonardo.bootloader.lock_bits=0x2F
leonardo.build.mcu=atmega32u4
leonardo.build.f_cpu=16000000L
leonardo.build.vid=0x2341
leonardo.build.pid=0x8036
leonardo.build.core=arduino
leonardo.build.variant=leonardo 本帖最后由 bigmango 于 2013-5-22 21:47 编辑
go2net 发表于 2013-3-25 14:09 static/image/common/back.gif
好了,完全解决问题了,就是fuse设置的问题,主要是fuse里面的
请问你的熔丝设置到底是多少啊,我现在情况和你差不多,可以认到串口,一下载文件板子就启动,然后就连不上了.
刚刚测试了查一下,如果通过ISP传一个串口的测试程序,电脑可以收到发过来的数据.
当Uploading的时候,收发灯狂闪,如果按reset还是狂闪,不能启动电脑也找不到串口.
但是正常情况下,按reset是可以reset的,奇怪啊. bootloader在哪里可以找到?
页:
[1]