1. lingyueqing's Avatar
    I am trying to flash a program onto an attiny167:ATTINY167-A15MZ - Atmel - Embedded - Microcontrollers - Kynix Semiconductor(already bootloaded with the micronucleus bootloader) with a Raspberry Pi via avrdude and USB.

    Background
    I have 50 Raspberry Pi 3B's connected to an amazon server collecting data.

    I have 50 custom attiny167 based USB sensor PCBs which I will connect to the Pis via USB
    It is a struggle to access and connect each device (especially 50 of them), and I thus need to be able to reflash a program to them via the commandline of an RPi.

    I have bootloaded them all from my windows 10 machine and can flash any program via USB.

    RPis
    I have flashed programs from the RPi with an Arduino Uno, both with the IDE and avrdude. Arduino and avrdude are installed and working (installed both with apt-get).

    The RPi can run an already flashed program, with reading and writing possible from the USB device. When plugged in the device is viewed by the lsusb command for 5 seconds. The pre-flashed program then runs and lsusb shows no device:

    lsusb immediately after device is plugged into port

    pi@raspberrypi:/usr/bin $ lsusb
    Bus 001 Device 005: ID 046d:c077 Logitech, Inc.
    Bus 001 Device 006: ID 413c:2011 Dell Computer Corp. Multimedia Pro Keyboard
    Bus 001 Device 004: ID 413c:1005 Dell Computer Corp. Multimedia Pro Keyboard Hub
    Bus 001 Device 007: ID 16d0:0753 MCS Digistump DigiSpark
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
    Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    lsusb ~5 seconds after device is plugged into port

    pi@raspberrypi:/usr/bin $ lsusb
    Bus 001 Device 005: ID 046d:c077 Logitech, Inc.
    Bus 001 Device 006: ID 413c:2011 Dell Computer Corp. Multimedia Pro Keyboard
    Bus 001 Device 004: ID 413c:1005 Dell Computer Corp. Multimedia Pro Keyboard Hub
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
    Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    udev rules
    I have followed the tutorial for udev rules by digistump and placed the file at /etc/udev/rules.d/49-micronucleus.rules

    UDEV of tinseey (similar to bootloaded micronucleus for attiny167)

    AVR Device
    this post hints it may not be possible, however this issue may have been resolved, as I am using an attiny167 (rather than an 85), and the Pi does not reboot on the USB being plugged in.

    On using dmesg you can see it is unable to enumerate. dmesg

    [ 9820.701327] usb 1-1.2: new low-speed USB device number 7 using dwc_otg
    [ 9820.803813] usb 1-1.2: New USB device found, idVendor=16d0, idProduct=0753
    [ 9820.803838] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [ 9825.208851] usb 1-1.2: USB disconnect, device number 7
    [ 9828.001334] usb 1-1.2: new low-speed USB device number 8 using dwc_otg
    [ 9833.081359] usb 1-1.2: device descriptor read/64, error -110
    [ 9833.271389] usb 1-1.2: device descriptor read/64, error -71
    [ 9833.461352] usb 1-1.2: new low-speed USB device number 9 using dwc_otg
    [ 9833.541349] usb 1-1.2: device descriptor read/64, error -71
    [ 9833.731352] usb 1-1.2: device descriptor read/64, error -71
    [ 9833.921349] usb 1-1.2: new low-speed USB device number 10 using dwc_otg
    [ 9834.341388] usb 1-1.2: device not accepting address 10, error -71
    [ 9834.421361] usb 1-1.2: new low-speed USB device number 11 using dwc_otg
    [ 9834.841371] usb 1-1.2: device not accepting address 11, error -71
    [ 9834.841480] usb 1-1-port2: unable to enumerate USB device

    avrdude
    I'm using the command, with different serial ports

    usr/bin/avrdude -p attiny167 -c arduino -C /etc/avrdude.conf -b 19200 -P [COM PORT] -U flash:w:[MyHexFile.ino.hex]:i
    this gives the error

    avrdude: ser_open(): can't open device "[COM PORT]": No such file or directory

    avrdude done. Thank you.
    The same method works with the Uno on the Pi, and the AVR device on my windows 10 machines.

    I have updated the configuration file avrdude.conf to include the attiny167, as I did with my windows 10 machine.

    Serial port
    serial and ttyACMO appears with Uno in /dev, not for the AVR device.

    Arduino IDE
    I've attempted to do this through the IDE but get the error:

    <code>/home/pi/Downloads/arduino-1.8.1/arduino-builder -dump-prefs -logger=machine -hardware /home/pi/Downloads/arduino-1.8.1/hardware -hardware /home/pi/.arduino15/packages -tools /home/pi/Downloads/arduino-1.8.1/tools-builder -tools /home/pi/Downloads/arduino-1.8.1/hardware/tools/avr -tools /home/pi/.arduino15/packages -built-in-libraries /home/pi/Downloads/arduino-1.8.1/libraries -libraries /home/pi/Arduino/libraries -fqbn=digistump:avr:digispark-tiny -ide-version=10801 -build-path /tmp/arduino_build_279218 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.micronucleus.path=/home/pi/.arduino15/packages/digistump/tools/micronucleus/2.0a4 -prefs=runtime.tools.avr-gcc.path=/home/pi/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5 -verbose /home/pi/sensicorn/sensicorn/indoorSoftware/Arduino Code/neopixel_simple/neopixel_simple.ino
    /home/pi/Downloads/arduino-1.8.1/arduino-builder -compile -logger=machine -hardware /home/pi/Downloads/arduino-1.8.1/hardware -hardware /home/pi/.arduino15/packages -tools /home/pi/Downloads/arduino-1.8.1/tools-builder -tools /home/pi/Downloads/arduino-1.8.1/hardware/tools/avr -tools /home/pi/.arduino15/packages -built-in-libraries /home/pi/Downloads/arduino-1.8.1/libraries -libraries /home/pi/Arduino/libraries -fqbn=digistump:avr:digispark-tiny -ide-version=10801 -build-path /tmp/arduino_build_279218 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.micronucleus.path=/home/pi/.arduino15/packages/digistump/tools/micronucleus/2.0a4 -prefs=runtime.tools.avr-gcc.path=/home/pi/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5 -verbose /home/pi/sensicorn/sensicorn/indoorSoftware/Arduino Code/neopixel_simple/neopixel_simple.ino
    Using board 'digispark-tiny' from platform in folder: /home/pi/.arduino15/packages/digistump/hardware/avr/1.6.7
    Using core 'tiny' from platform in folder: /home/pi/.arduino15/packages/digistump/hardware/avr/1.6.7
    Detecting libraries used...
    "/home/pi/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10801 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-I/home/pi/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny" "-I/home/pi/.arduino15/packages/digistump/hardware/avr/1.6.7/variants/digispark" "/tmp/arduino_build_279218/sketch/neopixel_simple.ino.cpp" -o "/dev/null"
    Generating function prototypes...
    "/home/pi/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10801 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-I/home/pi/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny" "-I/home/pi/.arduino15/packages/digistump/hardware/avr/1.6.7/variants/digispark" "/tmp/arduino_build_279218/sketch/neopixel_simple.ino.cpp" -o "/tmp/arduino_build_279218/preproc/ctags_target_for_gcc_minus_e.cpp"

    fork/exec /home/pi/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++: no such file or directory
    Error compiling for board Digispark (Default - 16.5mhz).</code>
    when I type which avr-g++: /usr/bin/avr-g++, this is just a copy from my windows machine. I found this github issue and it seems to be irrelevant for now, just a path issue.

    I've had to use a custom json file for the board manager to find micronucleus and Digispark Pro.

    When I plug in the AVR device no new serial port is shown in Tools->Port (unlike Arduino UNO, ttyACM0 appears).

    I'd much prefer to do flash via avrdude or similar on the commandline, so I have not focused on this.

    My question
    Is it possible to flash the AVR device with a Raspberry Pi over USB? If so, what am I doing wrong?
    03-26-2018 12:48 AM

Similar Threads

  1. How to turn off an alarm I did not set
    By JeanJD in forum Ask a Question
    Replies: 1
    Last Post: 03-27-2018, 10:40 AM
  2. Chime in: Should Microsoft be allowed to force Windows 10 users to use Edge?
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 03-25-2018, 08:10 AM
  3. EA may be working on an online, open-world Star Wars game
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 03-24-2018, 12:30 PM
  4. Improve your setup's sound with the $90 Logitech 2.1 Speaker System
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 03-24-2018, 11:40 AM
  5. Ditch your cable company for the $30 Amazon Fire TV Stick with Alexa Voice Remote
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 03-24-2018, 11:10 AM
LINK TO POST COPIED TO CLIPBOARD