使用树莓派做AVR芯片的下载器

  1. 安装avrdude
  2. 更改配置文件,查找gpio将对应的linuxgpio中相关注释的内容删除
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface
    #
    #To enable it set the configuration below to match the GPIO lines connected to the
    #relevant ISP header pins and uncomment the entry definition. In case you don't
    #have the required permissions to edit this system wide config file put the
    #entry in a separate <your name>.conf file and use it with -C+<your name>.conf
    #on the command line.
    #
    #To check if your avrdude build has support for the linuxgpio programmer compiled in,
    #use -c?type on the command line and look for linuxgpio in the list. If it's not available
    #you need pass the --enable-linuxgpio=yes option to configure and recompile avrdude.
    #
    programmer
    id = "linuxgpio";
    desc = "Use the Linux sysfs interface to bitbang GPIO lines";
    type = "linuxgpio";
    reset = 16;
    sck = 24;
    mosi = 23;
    miso = 18;
    ;

note:avrdude配置文件中的IO编号对应的芯片上的管脚编号BCM#,而不是树莓派提供的排针接口的编号

  1. 使用avrdude下载程序时,选择下载器linuxgpio
  2. 在使用过程中,常会遇到Can't export GPIO 16, already exported/busy?: Device or resource busy的错误,原因尚未搞清楚,可以用如下指令恢复
    1
    sudo echo 16 > /sys/class/gpio/unexport