极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 21891|回复: 6

ADRUINO LEONARDO 上传问题!

[复制链接]
发表于 2013-3-24 18:40:29 | 显示全部楼层 |阅读模式
从TB购得LEONARDO板子一块,自己焊接好了,用编程器把LEONARDO的bootloader烧进去了,现在电脑能够认识这块板子了,开机先显示一个ADRUINO LEONARDO bootloader (COM5)的设备,然后切换到ADRUINO LEONARDO(COM4)设备。一切看似正常了,但是...

当我打开一个sketch编译上传,RX和TX LED狂闪,设备管理器里面的ADRUINO设备都消失了,等了很久ADRUINO上传报错,我在preference里面打开upload的verbose后,查看打出来的信息,如下:

  1. Binary sketch size: 4,758 bytes (of a 28,672 byte maximum)

  2. Estimated used SRAM memory: 157 bytes (of a 2560 byte maximum)
  3. [color=Red]Forcing reset using 1200bps open/close on port COM4[/color]
  4. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  5. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  6. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  7. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  8. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  9. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  10. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  11. PORTS {COM4, COM8, } / {COM4, COM8, } => {}
  12. PORTS {COM4, COM8, } / {COM8, } => {}
  13. PORTS {COM8, } / {COM8, } => {}
  14. PORTS {COM8, } / {COM8, } => {}
  15. PORTS {COM8, } / {COM8, } => {}
  16. PORTS {COM8, } / {COM8, } => {}
  17. PORTS {COM8, } / {COM8, } => {}
  18. PORTS {COM8, } / {COM8, } => {}
  19. PORTS {COM8, } / {COM8, } => {}
  20. PORTS {COM8, } / {COM8, } => {}
  21. PORTS {COM8, } / {COM8, } => {}
  22. PORTS {COM8, } / {COM8, } => {}
  23. PORTS {COM8, } / {COM8, } => {}
  24. PORTS {COM8, } / {COM8, } => {}
  25. PORTS {COM8, } / {COM8, } => {}
  26. PORTS {COM8, } / {COM8, } => {}
  27. PORTS {COM8, } / {COM8, } => {}
  28. PORTS {COM8, } / {COM8, } => {}
  29. PORTS {COM8, } / {COM8, } => {}
  30. PORTS {COM8, } / {COM8, } => {}
  31. PORTS {COM8, } / {COM8, } => {}
  32. PORTS {COM8, } / {COM8, } => {}
  33. PORTS {COM8, } / {COM8, } => {}
  34. PORTS {COM8, } / {COM8, } => {}
  35. PORTS {COM8, } / {COM8, } => {}
  36. PORTS {COM8, } / {COM8, } => {}
  37. PORTS {COM8, } / {COM8, } => {}
  38. PORTS {COM8, } / {COM8, } => {}
  39. PORTS {COM8, } / {COM8, } => {}
  40. PORTS {COM8, } / {COM8, } => {}
  41. PORTS {COM8, } / {COM8, } => {}
  42. PORTS {COM8, } / {COM8, } => {}
  43. PORTS {COM8, } / {COM8, } => {}
  44. 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.
  45.         at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:152)
  46.         at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
  47.         at processing.app.Sketch.upload(Sketch.java:1716)
  48.         at processing.app.Sketch.exportApplet(Sketch.java:1628)
  49.         at processing.app.Sketch.exportApplet(Sketch.java:1600)
  50.         at processing.app.Editor$DefaultExportHandler.run(Editor.java:2462)
  51.         at java.lang.Thread.run(Unknown Source)

复制代码


Forcing reset using 1200bps open/close on port COM4 这个执行后,TX RX LED开始狂闪,设备管理器里面的ADRUINO设备消失,这个时候,我如果按一下reset按钮,就会正常下载代码了,但是,ADRUINO LEONARDO不是说可以自己让板子重启的吗,

  1. private boolean uploadViaBootloader(String buildPath, String className)
  2.                   throws RunnerException, SerialException {
  3.     Map<String, String> boardPreferences = Base.getBoardPreferences();
  4.     List commandDownloader = new ArrayList();
  5.     String protocol = boardPreferences.get("upload.protocol");
  6.    
  7.     // avrdude wants "stk500v1" to distinguish it from stk500v2
  8.     if (protocol.equals("stk500"))
  9.       protocol = "stk500v1";      
  10.    
  11.     String uploadPort = Preferences.get("serial.port");

  12. [color=Red]    // need to do a little dance for Leonardo and derivatives:
  13.     // open then close the port at the magic baudrate (usually 1200 bps) first
  14.     // to signal to the sketch that it should reset into bootloader. after doing
  15.     // this wait a moment for the bootloader to enumerate. On Windows, also must
  16.     // deal with the fact that the COM port number changes from bootloader to
  17.     // sketch.[/color]
  18.     if (boardPreferences.get("bootloader.path") != null &&
  19.         (boardPreferences.get("bootloader.path").equals("caterina") ||
  20.          boardPreferences.get("bootloader.path").equals("caterina-LilyPadUSB"))) {
  21.       String caterinaUploadPort = null;
  22.       try {
  23.         // Toggle 1200 bps on selected serial port to force board reset.
  24.         List<String> before = Serial.list();
  25.         if (before.contains(uploadPort)) {
  26.           if (verbose || Preferences.getBoolean("upload.verbose"))
  27.             System.out
  28.               [color=Red]  .println(_("Forcing reset using 1200bps open/close on port ")
  29.                     + uploadPort);[/color]
  30.           Serial.touchPort(uploadPort, 1200);
  31.          
  32.           // Scanning for available ports seems to open the port or
  33.           // otherwise assert DTR, which would cancel the WDT reset if
  34.           // it happened within 250 ms.  So we wait until the reset should
  35.           // have already occured before we start scanning.
  36.           if (!Base.isMacOS()) Thread.sleep(300);
  37.         }
复制代码


从上面的ADRUINO源码看,LEONARDO是通过设置波特率为1200,就让板子重启,这个机制怎么实现的? 如果实现了,那为何我的板子不能自己重启呢?

难道是我的板子出问题了。我检查了板子的RESET电路,很简单的


会不会是熔丝位设置问题呢,我的芯片是直接从厂商拿的,是全新的,会不会是重启机制需要用到看门狗,而我的看门狗被禁用了啊,无从得知,怎么查呢?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复

使用道具 举报

发表于 2013-3-24 20:20:07 | 显示全部楼层
感觉是熔丝位设置的问题,你的熔丝位设置的是什么样的?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-3-25 09:57:39 | 显示全部楼层
我昨晚把熔丝按照手册的缺省值设置了,重启后,板子进不去了,缺省设置里的晶振是设置为内部的RC振荡器,有并行编程器,但没有适配器,查了半天网上的资料,外界一个12M的信号上去,把板子恢复了,现在熔丝是厂商设置了,除了晶振设置为了外部晶振,还是一样的效果
回复 支持 反对

使用道具 举报

发表于 2013-3-25 11:51:10 | 显示全部楼层
我以前碰到过类似的问题,不过没有从代码上找原因,我换了根usb延长线,或者将板子直接接到usb口上就好了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-3-25 14:09:01 | 显示全部楼层
好了,完全解决问题了,就是fuse设置的问题,主要是fuse里面的


参照这里,要把fuse和lock设置为如下的值,主要是
Boot Reset vector Enabled (default address=$0000); [BOOTRST=0]
  1. ##############################################################

  2. leonardo.name=Arduino Leonardo
  3. leonardo.upload.protocol=avr109
  4. leonardo.upload.maximum_size=28672
  5. leonardo.upload.speed=57600
  6. leonardo.upload.disable_flushing=true
  7. leonardo.bootloader.low_fuses=0xff
  8. leonardo.bootloader.high_fuses=0xd8
  9. leonardo.bootloader.extended_fuses=0xcb
  10. leonardo.bootloader.path=caterina
  11. leonardo.bootloader.file=Caterina-Leonardo.hex
  12. leonardo.bootloader.unlock_bits=0x3F
  13. leonardo.bootloader.lock_bits=0x2F
  14. leonardo.build.mcu=atmega32u4
  15. leonardo.build.f_cpu=16000000L
  16. leonardo.build.vid=0x2341
  17. leonardo.build.pid=0x8036
  18. leonardo.build.core=arduino
  19. leonardo.build.variant=leonardo
复制代码
回复 支持 反对

使用道具 举报

发表于 2013-5-22 20:27:34 | 显示全部楼层
本帖最后由 bigmango 于 2013-5-22 21:47 编辑
go2net 发表于 2013-3-25 14:09
好了,完全解决问题了,就是fuse设置的问题,主要是fuse里面的


请问你的熔丝设置到底是多少啊,我现在情况和你差不多,可以认到串口,一下载文件板子就启动,然后就连不上了.
刚刚测试了查一下,如果通过ISP传一个串口的测试程序,电脑可以收到发过来的数据.
当Uploading的时候,收发灯狂闪,如果按reset还是狂闪,不能启动电脑也找不到串口.
但是正常情况下,按reset是可以reset的,奇怪啊.
回复 支持 反对

使用道具 举报

发表于 2013-12-30 11:42:57 | 显示全部楼层
bootloader在哪里可以找到?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-13 20:38 , Processed in 0.039335 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表