怎么用avrdude直接把HEX烧到arduino生成hex

君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
Arduino中Hex文件的生成及保存
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口tiny85 使用arduino IDE - 简书
tiny85 使用arduino IDE
硬件接线图
首先向插件作者致敬
记得看最下面一段话,要烧录引导程序。。。
pinout在这里
另外ws2812有几个参数
任意两点传传输距离在不超过5米时无需增加任何电路。当刷新速率30帧/秒时,低速模式级联数不小于512点,高速模式不小于1024点。
因为这次的项目里需要用编码器,觉得还是用中断的方式实现比较好,但是现在问题来了。隐约记得arduino对引脚中断的封装不是特别好,尤其我现在竟然是在Arduino IDE里面写tiny85的外部中断。。。tiny85其实是支持的。pinout显示每一个引脚都支持PCINT。
tiny85 pinout
然后我就直接搜到了一个youtube的视频。但是他的代码我看不懂。。。。继续寻找中。
卧槽我不知道为什么看到了各种东西完全停不下来,首先是打开了一个网页:
,虽然翻墙了但是css和js还是完全加载不了,但是完全影响我看了所有的内容。首先这里面介绍了如何在arduino IDE里面使能外部引脚中断
#include "avr/interrupt.h"
volatile int value=0;
void setup()
GIMSK = 0b;
// turns on pin change interrupts
PCMSK = 0b;
// turn on interrupts on pins PB0, PB1, & PB4
// enables interrupts
void loop()
ISR(PCINT0_vect)
value = 1;
// Increment volatile variable
但是我特别奇怪为什么这里完全没有GIMSK和PCMSK的定义,然后在页面里搜索def,就看到下面有人问了同样的问题。
I’m fairly new to arduine, but I like and understand the way you code in binary:void setup(){GIMSK = 0b; // turns on pin change interruptsPCMSK = 0b; // turn on interrupts on pins PB0, PB1, & PB4sei();so here is my lamo question …where are GIMSK, PCMSK defined. I couldn’t find in which library … would you know ?It would help to know the list of predefined system register variables. I can see that the hardware documentation gives the same names, I could blindly use that… but I’d much prefer to see the software definition !Your interrupts instructables are very good, and allowed me to make a huge step in understanding attiny85 interrupts. By the way I’m only using the atmel ISP mkII, it is still available here in Canada for a mere 40$ from .Thank’sjrb.
然后下面博主还回复了。。。
Ok I found GIMSK, PCMSK… software definitions:In avr-libc/user-manual/io_8h_source.html (io.h) we find:“379 #elif defined (AVR_ATtiny85)”“380 # include ”going to “avr/iotn85.h” , there we find an “# includes avr/iotnx5.h”and again, going to “avr/iotnx5.h”, we finally find the definitions of GIMSK, PCMSK, etc…You probably knew all of that, still, I’m writing this in case someone like me might be wondering too :-) !!!Thank’s for this forum !
卧槽简直幸福感爆棚。。
翻到了下一页发现有用tiny85连接编码器的代码。。。。 而且是用中断的方式实现的。。接的引脚都一样。。。
日 UPDATE:如何用AVR MK2给tiny85烧写bootloader
突然间所有的Arduino都不能用了。。。。更换了arduino/数据线/杜邦线/面包板都没有用。。。然后我借了一个MK2,但是折腾了一晚上也不能世界,现在的情况是这样的:
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Target not detected
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
我已经安装了AVRDUDE和libusb但是还是不行。。。貌似是不能识别这个设备额。。。
日 UPDATE:
我晕,很多帖子里都写说是接线接错了,然后各种试终于发现。。。。第一次被instructables坑。。。
下面做一个调查。。
图片来源instructables
你看到一个这样的图片,你会觉得这个引脚是怎么排布的?
图片来源ATMEL
这是官网的图片,和instructables是一样的。
图片来源//programming-an-attiny85-with-the-avrmkii/
这张图更NB了,他TM写的是错的。。。。。我真是给他跪了。。。
然后前两张其实是对的,不过要取决于你怎么看他。。。。事实上你必须这样拿着JTAG来看这张图。。。
图片发自简书App
或者你直接拿着你的Arduino UNO,让USB口冲左来看JTAG,也就是说JTAG插UNO是要这样插的。
图片发自简书App
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
另外记得给给Tiny85额外供电,不然会显示我上面的那个错误
简直是WTFFFFFFFFFFFFFFFFFFFFFFF。。。
然后就行了,速度貌似会比用Arduino快不少。
日 UPDATE:
下面是arduino官方对于这个的一个介绍,原来这样有一些好处比如可以使用更多的空间,上电后不需要等待等等。I am using
for Android (). I can compile the
code. I can run
$ avr-gcc -Os -DF_CPU=UL -mmcu=atmega328p -c -o led.o led.c
$ avr-gcc -mmcu=atmega328p led.o -o led
$ avr-objcopy -O ihex -R .eeprom led led.hex
all without issues. Then I try to run:
avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/002
-b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex
The result is:
avrdude: ser_open(): can't open device "/dev/bus/usb/002/002"; Permission denied
loctl("TIOCMGET"): Invalid argument
avrdude done. Thank you.
The situation is similar when I run:
avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/001
-b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex
I can confirm that /dev/bus/usb/002/002 is the Arduino device connected with the
cable. Before connecting, I run
ls -l /dev/bus/usb/002/
and I get:
After I connect the Arduino via USB to my tablet I run the command:
ls -l /dev/bus/usb/002
crw-rw----
8 Mar 24 07:53 001
crw-rw----
9 Mar 24 07:53 002
This clearly shows me that the Arduino is connected. I would love to know if anyone can see what I am doing wrong.
PS: I am trying to create an Android application that allows Arduino programming directly from an Android tablet.
解决方案 It says 'permission denied' and you do not seem to be using a root shell.
Try 'su' and then the command that failed. If your phone is not rooted, I don't think it could work.
I'm not even sure if it will work right when you are root, so please post the result! My guess is that it won't if your phone does not act as usb host (only some can)
本文地址: &
我使用为Android(的)。我可以编译 code。我可以运行
$ AVR-GCC -Os -DF_CPU = UL -mmcu = ATMEGA328P -c -o led.o LED.c中
$ AVR-GCC -mmcu = ATMEGA328P led.o -o导致
$ AVR-objcopy把-O ihex -R .eeprom导致led.hex
都没有问题。然后我尝试运行:
AVRDUDE -F -V -c的Arduino -p ATMEGA328P -P的/ dev /巴士/ USB / 002/002 -b 115200 -C /data/data/jackpal.androidterm/local /etc/avrdude.conf -U闪光:W:led.hex
AVRDUDE:ser_open():不能打开设备“的/ dev /巴士/ USB / 002/002”;没有权限
loctl(“TIOCMGET”):无效的参数
AVRDUDE完成。谢谢。
的情况是类似的,当我运行:
AVRDUDE -F -V -c的Arduino -p ATMEGA328P -P的/ dev /巴士/ USB / 002/001 -b 115200 -C /data/data/jackpal.androidterm/local /etc/avrdude.conf -U闪光:W:led.hex
我可以证实,的/ dev /巴士/ USB / 002/002 与电缆。在连接之前,我跑
ls -l命令的/ dev /巴士/ USB / 002 /
和我得到的:
在我通过USB我的平板电脑连接的Arduino我运行命令:
ls -l命令的/ dev /巴士/ USB / 002
CRW-RW ---- 1 0
03月24日07:53 001
CRW-RW ---- 1 0
03月24日07:53 002
这清楚地表明我的Arduino的连接。我很想知道,如果任何人都可以看到我在做什么错。
PS:我想创建一个Android应用程序,可直接从Android平板电脑的Arduino编程。
解决方案 报告说,“权限被拒绝',你似乎没有使用一个root shell。
尝试“素”,然后该命令失败。如果您的手机是不是扎根,我不认为它可以工作。
我甚至不知道这是否会工作的时候,当你的根,所以请后的结果!我的猜测是,它不会,如果你的手机不作为USB主机(只有一些可以)
本文地址: &
扫一扫关注官方微信望见那地上的一棵草,那是大的无限.
来自森亮号航海见识 {SLboat I}
在Arduino Nano里这里接了一个0.1u的电容到RESET。
看起来这个0.1UF的是瓷片内容之类的玩意:0.1UF是直标法,而104是数码法。
的确有0.1秒的小玩意呢
在avrdude中它并不做这个,在arduino ide里是通过ide自己发送一个指令得到的,所以在avrdude里它什么也不做,需要一个额外的触发脚本。
手动复位非常艰难,得0.1秒甚至更少。
因为D1,D2 也就是TX、RX,正常情况下它们肯定被别的占用了,可能被用户使用了,所以复位它,进入bootloader,事情就开始变得简单了
这个DTR难道就是利用了TTL里的一个控制位?
而复位的作用就是重启进入bootloader的程序中的时候开始写入?
见识2中看起来Arduino中将一个引脚封装起来作为复位,然后平常作为输出,有时候作为复位,或者跟着没关系。
推翻上面,那是完全无关的一个脚,只是引发复位。
bootloader 涉及的一个写入协议是stk500v1啥的。
有一种称为SoftReset的技术,可以让串口来控制看门狗重启arduino然后完成烧写。很有趣,在最后的见识里提到了一些。
'd like to hear some explanations as to how the Arduino Duemilanove resets the ATMega328P over USB through the FTDI FT232R transceiver.
I know it involves the IDE playing some games with the DTR serial handshaking signal. After looking at the schematics, what I'm really interested in getting a better handle on is how the circuit works:
DTR -----||------+------^v^v^----- VCC
The 10k resistor is the usual pull-up on the reset line. So what does the capacitor accomplish in this circuit?
As a sidenote, I used this as an excuse to try and learn/use LTSPICE, so I'm no pro at this tool. I modeled it in LTSPICE as follows, but it looks to me like the /RESET signal just matches the DTR signal exactly, which doesn't really make sense to me. I modeled the DTR signal as a Pulse Voltage source, maybe that's the wrong model. Is it the nature of the FTDI's DTR driver (e.g. perhaps it's open collector) or the internals of the /RESET pin on the MCU that are not present in the circuit I've drawn that make this all hang together electrically?
’m sure you’re thinking to yourself — well fine, let’s use a little transistor and have a digital pin toggle GND to the RESET pin when we want. Yes, this definitely works, and is absolutely a better solution than my hack. However, this board is already crowded as it is, and I wanted to use minimal wiring. So i found a way to do it with a single wire connected to the RESET pin.
Check it out.
By connecting any digital pin directly to the RESET pin on the Arduino will not work because upon start up, the Arduino automatically pulls those pins low when they are declared OUTPUT in the setup() loop. The hack here is extremely simple: Pull that digitalPin HIGH before ANYTHING ELSE.
//digitalPin 7 is connected to the RESET pin on Arduino
//NOTE: you CANNOT program the board while they are connected
//by default digitalPin 13 will blink upon reset, so stick an LED in there
int interval = 5000;
long int time = 0;
void setup(){
  digitalWrite(7, HIGH); //We need to set it HIGH immediately on boot
  pinMode(7,OUTPUT);
//We can declare it an output ONLY AFTER it's HIGH
                         // (( HACKHACKHACKHACK ))
  Serial.begin(9600);
//So you can watch the time printed
void loop(){
  time = millis();
  Serial.println(time);
  if(time & interval){
    Serial.println("RESET!");
    digitalWrite(7, LOW); //Pulling the RESET pin LOW triggers the reset.
  }
And that’s it. Tested on ArduinoMega2560 and Uno. Hopefully this is useful for someone out there.
There is a caveat, however. When programming your board, you must remove this connection, because upon programming digitalPins are pulled low. Your board will just try to reset itself while programming and you’ll taste failure. hmm delicious.
~/devel/source/linslot/avr& /data/devel/arduino-0010/hardware/tools/avrdude -C/data/devel/arduino-0010/hardware/tools/avrdude.conf
-pm168 -cstk500v1 -P/dev/ttyUSB0 -b19200 -D -Uflash:w:/net/gate/home/wendel/sketchbook/linslot/applet/linslot.hex
If you want to pulse the DTR right before using avrdude on linux it is pretty simple.
On ubuntu first get the perl serial module
$ sudo apt-get install libdevice-serialport-perl
And then make a small script to pulse the dtr and run it prior to avrdude, this allows me to reliably flash every time.
!/usr/bin/perl -w
use Device::SerialP
Device::SerialPort-&new("/dev/ttyUSB0")-&pulse_dtr_on(100);
Actually, here’s another piece to “The Right Way”: Edit the avrdude.conf file ($(INSTALL_DIR)/hardware/tools/avrdude.conf), find the programmer line for the stk500v1, and add this line to the block:
reset = 4;
That plus the perl script mentioned above actually seems to reset my arduino and allow avrdude to work its magic. Either one on its own would not.
If anyone is curious, I got that line by typing in an incorrect programmer on the avrdude command line. It described the available programmers, including a few that had reset
"No-Wait" bootloader
Here's a bootloader hack that will automatically start the sketch after it has been uploaded and will also only start the bootloader when the reset button is pressed (so when you plug in power it will go straight to the sketch)
But what if there’s no way to control the DTR line?
As mentioned if the DTR line can’t be controlled from software then there’s no way to reset the board and no way of auto-uploading new sketches without manual intervention i.e. resetting the board manually.
And why would you care? Because there are some Bluetooth modules out there where the DTR line can’t be driven directly either by limitations in the BT module’s firmware or limitations in the breakout board. It would be very convenient to be able to wirelessly update the sketch (a post is coming about this).
Introducing the Watchdog timer
Fortunately the ATMega family of microcontrollers (and maybe any decent microcontroller out there) has a Watchdog timer that can be programmed to reset the microcontroller after it expires. Details about it can be found in Section 11.8 of the spec
Below is a simple sketch that will reset the Arduino 1s after you send the character ‘R’ through the serial port.
以下是[Arduino DTR]所有用到的引用信息,向这些伟大的家伙致敬:
这种ASCII表示电容的方法真神奇,

我要回帖

更多关于 arduino生成hex 的文章

 

随机推荐