LoginSignup
0
1

Arduino Unoのファームウェア修復

Last updated at Posted at 2023-09-26

はじめに

二度と使うことがなかろうと思い,
Arduinoのファームウェアを上書きして,Nintendo Switchにつなげて遊んでおりました.
急にArduinoとして使用する機会ができ,急いで調べたためまとめることにしました.
(またやることがありそうなので私用メモを兼ねます)

環境

環境
OS windows(wsl使用)
マイコン Maruduino UNO R31
firmware atmega16u2
wsl Ubuntu 22.04.2LTS

※wslにはすでにgitのダウンロードと設定がされています

方法

  1. wslでusbデバイスを使用する環境をインストール
    ここの一番上のmsiをクリックしてインストール

  2. wslにも環境をインストール

    sudo apt install linux-tools-generic hwdata
    sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/*-generic/usbip 20
    
  3. 管理者でpowershellを開く

  4. powershellでデバイスのbus idを調べる

    usbipd wsl list
    
  5. wslを立ち上げた後,powershellでデバイスを指定する

    usbipd wsl attach --busid <busid>
    
  6. wslから接続されたデバイスを確認

    lsusb
    
  7. dfu-programmerのダウンロード

    sudo apt-get install dfu-programmer
    
  8. githubリポジトリからファームウェアを取得

    git clone https://github.com/arduino/ArduinoCore-avr.git
    
  9. ファームウェアを指定して書き込む

    cd ArduinoCore-avr/firmwares/atmegaxxu2/
    sudo dfu-programmer atmega16u2 erase
    sudo dfu-programmer atmega16u2 flash Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex # ファイル名は変更されていることがあります
    sudo dfu-programmer atmega16u2 reset # 勝手にデバイスが切断される
    
  10. デバイスがwslから切断されていない場合は以下のコマンドを入力

    usbipd wsl detach --busid <busid>
    

参考にしたサイト

  1. Arduino UNOの互換製品です https://www.marutsu.co.jp/pc/i/605620/

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1