在Cubieboard上通过USB烧写Arduino(Huluduino USB版)
今天给Huluduino加了个USB(不好意思,打个广告,60块出售),芯片是PL2303,正好cb有驱动,于是看看能不能烧写以下是Huluduino USB大图:
本次使用的是Cubietruck(cb3)
首先呢,先在我的Mac上把Huluduino烧成标准的Blink(1秒亮灭)
然后呢,再拔掉Huluduino,把程序改成这样:/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2000); // wait for 2 second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for 2 second
}2秒的,然后在Arduino IDE的偏好设置(菜单栏Arduino -> 偏好设置)里面把“输出时显示详细信息:编译”打勾,然后点确定,这样就会显示出hex文件的地址了,再点那个打勾的标志(校验,verify),或者点烧写也可以,不过记得要拔掉Arduino(Huluduino),否则会烧到Arduino里面去,而我们只想要hex文件在cb上烧写。
这是修改后的Blink,然后点击左上角的勾,蓝色的是hex文件的地址
接下来呢,就是复制文件到cb上然后烧写了TlldeMacBook-Pro:findcb tonylianlong$ sftp root@192.168.1.105
root@192.168.1.105's password:
Permission denied, please try again.
root@192.168.1.105's password:
Connected to 192.168.1.105.
sftp> put /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000gn/T/build6629735842786211009.tmp/Blink.cpp.hex /
Uploading /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000gn/T/build6629735842786211009.tmp/Blink.cpp.hex to /Blink.cpp.hex
/var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000g 100% 3078 3.0KB/s 00:00
sftp> exit
TlldeMacBook-Pro:findcb tonylianlong$ ssh 192.168.1.105 -l root
root@192.168.1.105's password:
llLinux cubieboard 3.4.61v1.2+ #15 SMP PREEMPT Sat Oct 19 23:41:01 CST 2013 armv7l
Welcome to CbOS 1.0 - a system for Cubieboard
* Documention: http://www.tonylianlong.com
s ==================================================
Now is:Sat Nov 2 17:57:27 CST 2013
Lastboot:Thu Jan 1 08:00:31 CST 1970
eth0 IP:192.168.1.105
disk used:1.4G free:431M %:76%
memory used:159M free:651M
==================================================
root@cubieboard:~# ls
CHANGELOGREADMEsource_codetoolsutilities
root@cubieboard:~# cd /
root@cubieboard:/# ls
bin bootetc lib mntprocrun sysusr
Blink.cpp.hexdev homelost+foundoptrootsbintmpvar
我用sftp上传了,他现在在/目录root@cubieboard:~/arduino_shao# apt-get install avrdude -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libelf1 libftdi1
Suggested packages:
avrdude-doc
The following NEW packages will be installed:
avrdude libelf1 libftdi1
0 upgraded, 3 newly installed, 0 to remove and 194 not upgraded.
Need to get 322 kB/561 kB of archives.
After this operation, 1,964 kB of additional disk space will be used.
Get:1 http://ftp.cn.debian.org/debian/ testing/main libelf1 armhf 0.153-2
Get:2 http://ftp.cn.debian.org/debian/ testing/main libftdi1 armhf 0.20-1+b1
Fetched 322 kB in 1s (321 kB/s)
Selecting previously unselected package libelf1:armhf.
(Reading database ... 17127 files and directories currently installed.)
Unpacking libelf1:armhf (from .../libelf1_0.153-2_armhf.deb) ...
Selecting previously unselected package libftdi1:armhf.
Unpacking libftdi1:armhf (from .../libftdi1_0.20-1+b1_armhf.deb) ...
Selecting previously unselected package avrdude.
Unpacking avrdude (from .../avrdude_6.0.1-1_armhf.deb) ...
Setting up libelf1:armhf (0.153-2) ...
Setting up libftdi1:armhf (0.20-1+b1) ...
Setting up avrdude (6.0.1-1) ...
root@cubieboard:~/arduino_shao# avrdude -p m328p -c arduino -b 115200 -P /dev/ttyUSB0 -C /etc/avrdude.conf -U flash:w:Blink.cpp.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Blink.cpp.hex"
avrdude: input file Blink.cpp.hex auto detected as Intel Hex
avrdude: writing flash (1084 bytes):
Writing | ################################################## | 100% 0.17s
avrdude: 1084 bytes of flash written
avrdude: verifying flash memory against Blink.cpp.hex:
avrdude: load data flash data from input file Blink.cpp.hex:
avrdude: input file Blink.cpp.hex auto detected as Intel Hex
avrdude: input file Blink.cpp.hex contains 1084 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.14s
avrdude: verifying ...
avrdude: 1084 bytes of flash verified
avrdude: safemode: Fuses OK (H:00, E:00, L:00)
avrdude done.Thank you.
root@cubieboard:~/arduino_shao#
移动后安装avrdude然后烧写:apt-get install avrdude -y
avrdude -p m328p -c arduino -b 115200 -P /dev/ttyUSB0 -C /etc/avrdude.conf -U flash:w:Blink.cpp.hexHuluduino的U是328p,和UNO完全兼容,所以可以直接使用上面代码,直接接uno的话在cb上貌似没有驱动,所以不行。
接下来呢,看看Huluduino,是不是2秒闪一下了?
同为arduino爱好者,顶你一下~ 最近在DIY digispark,attiny85挺好使的,做usbkey、红外遥控都方便。 soloforce 发表于 2013-11-4 18:25 static/image/common/back.gif
同为arduino爱好者,顶你一下~ 最近在DIY digispark,attiny85挺好使的,做usbkey、红外遥控都方便。 ...
digispark是?usbkey是avruab吗?attiny我看挺贵的,要不要外置晶震?你多少钱买的?能刷arduino的boorloader不? tll 发表于 2013-11-7 18:43 static/image/common/back.gif
digispark是?usbkey是avruab吗?attiny我看挺贵的,要不要外置晶震?你多少钱买的?能刷arduino的boorlo ...
digispark就是用attiny85做的,内置软usb支持。也能刷arduino的bootloader,但官方的bootloader更好用。可惜attiny85还是太贵,都快接近mega328了,好处就是体积小巧。 不需要外部晶振就可以工作 soloforce 发表于 2013-11-7 21:25 static/image/common/back.gif
不需要外部晶振就可以工作
多少M的? soloforce 发表于 2013-11-7 21:24 static/image/common/back.gif
digispark就是用attiny85做的,内置软usb支持。也能刷arduino的bootloader,但官方的bootloader更好用。 ...
328也有内置晶振,我的葫芦的328是10块钱一个。attiny以前想买,但是价格问题,貌似是8块,我的stc单片机1块一个,5m的,跟tiny一样8脚。 M328只有内置RC的。我觉得倒腾Arduino没啥意思。一个闪灯程序就1K简直就是要了AVR的命。 V-USB(AVRUSB)其实挺好玩的。上次我弄了个HID设备,随机给系统发键码,在电脑课上成功搞疯一同学。用的LGT8F08A, rgwan 发表于 2013-11-15 11:35 static/image/common/back.gif
M328只有内置RC的。我觉得倒腾Arduino没啥意思。一个闪灯程序就1K简直就是要了AVR的命。 ...
Arduino函数大小的问题,东西都弄进去了
页:
[1]
2