从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)
- [color=Red]Forcing reset using 1200bps open/close on port COM4[/color]
- 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");
- [color=Red] // 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.[/color]
- 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
- [color=Red] .println(_("Forcing reset using 1200bps open/close on port ")
- + uploadPort);[/color]
- 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电路,很简单的
会不会是熔丝位设置问题呢,我的芯片是直接从厂商拿的,是全新的,会不会是重启机制需要用到看门狗,而我的看门狗被禁用了啊,无从得知,怎么查呢? |