CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 14523|回复: 14

在Cubieboard上通过USB烧写Arduino(Huluduino USB版)

[复制链接]
发表于 2013-11-2 18:47:40 | 显示全部楼层 |阅读模式
今天给Huluduino加了个USB(不好意思,打个广告,60块出售),芯片是PL2303,正好cb有驱动,于是看看能不能烧写
以下是Huluduino USB大图:

本次使用的是Cubietruck(cb3)
首先呢,先在我的Mac上把Huluduino烧成标准的Blink(1秒亮灭)
然后呢,再拔掉Huluduino,把程序改成这样:
  1. /*
  2.   Blink
  3.   Turns on an LED on for one second, then off for one second, repeatedly.

  4.   This example code is in the public domain.
  5. */

  6. // Pin 13 has an LED connected on most Arduino boards.
  7. // give it a name:
  8. int led = 13;

  9. // the setup routine runs once when you press reset:
  10. void setup() {               
  11.   // initialize the digital pin as an output.
  12.   pinMode(led, OUTPUT);     
  13. }

  14. // the loop routine runs over and over again forever:
  15. void loop() {
  16.   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  17.   delay(2000);               // wait for 2 second
  18.   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  19.   delay(2000);               // wait for 2 second
  20. }
复制代码
2秒的,然后在Arduino IDE的偏好设置(菜单栏Arduino -> 偏好设置)里面把“输出时显示详细信息:编译”打勾,然后点确定,这样就会显示出hex文件的地址了,再点那个打勾的标志(校验,verify),或者点烧写也可以,不过记得要拔掉Arduino(Huluduino),否则会烧到Arduino里面去,而我们只想要hex文件在cb上烧写。

这是修改后的Blink,然后点击左上角的勾,蓝色的是hex文件的地址
接下来呢,就是复制文件到cb上然后烧写了
  1. TlldeMacBook-Pro:findcb tonylianlong$ sftp root@192.168.1.105
  2. root@192.168.1.105's password:
  3. Permission denied, please try again.
  4. root@192.168.1.105's password:
  5. Connected to 192.168.1.105.
  6. sftp> put /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000gn/T/build6629735842786211009.tmp/Blink.cpp.hex /
  7. Uploading /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000gn/T/build6629735842786211009.tmp/Blink.cpp.hex to /Blink.cpp.hex
  8. /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000g 100% 3078     3.0KB/s   00:00   
  9. sftp> exit
  10. TlldeMacBook-Pro:findcb tonylianlong$ ssh 192.168.1.105 -l root
  11. root@192.168.1.105's password:
  12. llLinux cubieboard 3.4.61v1.2+ #15 SMP PREEMPT Sat Oct 19 23:41:01 CST 2013 armv7l
  13. Welcome to CbOS 1.0 - a system for Cubieboard

  14. * Documention: http://www.tonylianlong.com

  15. s ==================================================  
  16.   Now is:Sat Nov 2 17:57:27 CST 2013
  17.   Lastboot:Thu Jan 1 08:00:31 CST 1970

  18.   eth0 IP:192.168.1.105
  19.   disk used:1.4G free:431M %:76%
  20.   memory used:159M free:651M
  21. ==================================================  
  22. root@cubieboard:~# ls
  23. CHANGELOG  README  source_code  tools  utilities
  24. root@cubieboard:~# cd /
  25. root@cubieboard:/# ls
  26. bin            boot  etc   lib         mnt  proc  run   sys  usr
  27. Blink.cpp.hex  dev   home  lost+found  opt  root  sbin  tmp  var
复制代码
我用sftp上传了,他现在在/目录
  1. root@cubieboard:~/arduino_shao# apt-get install avrdude -y
  2. Reading package lists... Done
  3. Building dependency tree      
  4. Reading state information... Done
  5. The following extra packages will be installed:
  6.   libelf1 libftdi1
  7. Suggested packages:
  8.   avrdude-doc
  9. The following NEW packages will be installed:
  10.   avrdude libelf1 libftdi1
  11. 0 upgraded, 3 newly installed, 0 to remove and 194 not upgraded.
  12. Need to get 322 kB/561 kB of archives.
  13. After this operation, 1,964 kB of additional disk space will be used.
  14. Get:1 http://ftp.cn.debian.org/debian/ testing/main libelf1 armhf 0.153-2 [303 kB]
  15. Get:2 http://ftp.cn.debian.org/debian/ testing/main libftdi1 armhf 0.20-1+b1 [18.4 kB]
  16. Fetched 322 kB in 1s (321 kB/s)
  17. Selecting previously unselected package libelf1:armhf.
  18. (Reading database ... 17127 files and directories currently installed.)
  19. Unpacking libelf1:armhf (from .../libelf1_0.153-2_armhf.deb) ...
  20. Selecting previously unselected package libftdi1:armhf.
  21. Unpacking libftdi1:armhf (from .../libftdi1_0.20-1+b1_armhf.deb) ...
  22. Selecting previously unselected package avrdude.
  23. Unpacking avrdude (from .../avrdude_6.0.1-1_armhf.deb) ...
  24. Setting up libelf1:armhf (0.153-2) ...
  25. Setting up libftdi1:armhf (0.20-1+b1) ...
  26. Setting up avrdude (6.0.1-1) ...
  27. root@cubieboard:~/arduino_shao# avrdude -p m328p -c arduino -b 115200 -P /dev/ttyUSB0 -C /etc/avrdude.conf -U flash:w:Blink.cpp.hex

  28. avrdude: AVR device initialized and ready to accept instructions

  29. Reading | ################################################## | 100% 0.00s

  30. avrdude: Device signature = 0x1e950f
  31. avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
  32.          To disable this feature, specify the -D option.
  33. avrdude: erasing chip
  34. avrdude: reading input file "Blink.cpp.hex"
  35. avrdude: input file Blink.cpp.hex auto detected as Intel Hex
  36. avrdude: writing flash (1084 bytes):

  37. Writing | ################################################## | 100% 0.17s

  38. avrdude: 1084 bytes of flash written
  39. avrdude: verifying flash memory against Blink.cpp.hex:
  40. avrdude: load data flash data from input file Blink.cpp.hex:
  41. avrdude: input file Blink.cpp.hex auto detected as Intel Hex
  42. avrdude: input file Blink.cpp.hex contains 1084 bytes
  43. avrdude: reading on-chip flash data:

  44. Reading | ################################################## | 100% 0.14s

  45. avrdude: verifying ...
  46. avrdude: 1084 bytes of flash verified

  47. avrdude: safemode: Fuses OK (H:00, E:00, L:00)

  48. avrdude done.  Thank you.

  49. root@cubieboard:~/arduino_shao#
复制代码
移动后安装avrdude然后烧写:
  1. apt-get install avrdude -y
  2. avrdude -p m328p -c arduino -b 115200 -P /dev/ttyUSB0 -C /etc/avrdude.conf -U flash:w:Blink.cpp.hex
复制代码
Huluduino的U是328p,和UNO完全兼容,所以可以直接使用上面代码,直接接uno的话在cb上貌似没有驱动,所以不行。
接下来呢,看看Huluduino,是不是2秒闪一下了?



本帖子中包含更多资源

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

x
回复

使用道具 举报

发表于 2013-11-4 18:25:51 | 显示全部楼层
同为arduino爱好者,顶你一下~ 最近在DIY digispark,attiny85挺好使的,做usbkey、红外遥控都方便。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-7 18:43:53 | 显示全部楼层
soloforce 发表于 2013-11-4 18:25
同为arduino爱好者,顶你一下~ 最近在DIY digispark,attiny85挺好使的,做usbkey、红外遥控都方便。 ...

digispark是?usbkey是avruab吗?attiny我看挺贵的,要不要外置晶震?你多少钱买的?能刷arduino的boorloader不?
回复 支持 反对

使用道具 举报

发表于 2013-11-7 21:24:52 | 显示全部楼层
tll 发表于 2013-11-7 18:43
digispark是?usbkey是avruab吗?attiny我看挺贵的,要不要外置晶震?你多少钱买的?能刷arduino的boorlo ...

digispark就是用attiny85做的,内置软usb支持。也能刷arduino的bootloader,但官方的bootloader更好用。可惜attiny85还是太贵,都快接近mega328了,好处就是体积小巧。
回复 支持 反对

使用道具 举报

发表于 2013-11-7 21:25:17 | 显示全部楼层
不需要外部晶振就可以工作
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-7 23:51:12 | 显示全部楼层
soloforce 发表于 2013-11-7 21:25
不需要外部晶振就可以工作

多少M的?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-7 23:52:24 | 显示全部楼层
soloforce 发表于 2013-11-7 21:24
digispark就是用attiny85做的,内置软usb支持。也能刷arduino的bootloader,但官方的bootloader更好用。 ...

328也有内置晶振,我的葫芦的328是10块钱一个。attiny以前想买,但是价格问题,貌似是8块,我的stc单片机1块一个,5m的,跟tiny一样8脚。
回复 支持 反对

使用道具 举报

发表于 2013-11-15 11:35:57 | 显示全部楼层
M328只有内置RC的。我觉得倒腾Arduino没啥意思。一个闪灯程序就1K简直就是要了AVR的命。
回复 支持 反对

使用道具 举报

发表于 2013-11-15 11:36:58 | 显示全部楼层
V-USB(AVRUSB)其实挺好玩的。上次我弄了个HID设备,随机给系统发键码,在电脑课上成功搞疯一同学。用的LGT8F08A,
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-11-15 17:54:46 | 显示全部楼层
rgwan 发表于 2013-11-15 11:35
M328只有内置RC的。我觉得倒腾Arduino没啥意思。一个闪灯程序就1K简直就是要了AVR的命。 ...

Arduino函数大小的问题,东西都弄进去了
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-4-26 18:44 , Processed in 0.028184 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部