Files

readme.md

View this project on CADLAB.io.

Firmware

Compiler

sudo apt install make gcc-avr avr-libc avrdude

Programmer

WSL USB

Overview of ]]>WSL USB access]]>.

  1. Install the WSL drivers for your kernel.

    1. Open a WSL terminal and run usbipd list. This will display packages that need to be installed for your WSL kernel.
    2. Install those packages.
  2. Install the ]]>programmer Windows driver]]> & plug in the programmer.

    • Windows device manager should now show libusb-win32 devices -> USBtiny
  3. Make the USB device available to WSL

    1. Open a WSL shell.
    2. List available USB devices: usbipd.exe list. Find the USBtiny device and note the bus ID.
      • Note: This is calling a Windows executable from WSL.
    3. Attach the USB device to WSL: usbipd.exe wsl attach --busid <bus ID>. The device should now be available in WSL.
      • When you're done with the device, detach with the command above, substituting detach for attach.
    4. Verify the device is available in an WSL terminal: lsusb. The device should be listed.
  4. Create a udev rules file to make the device accessible to avrdude.

    1. After attaching the device to WSL per above, run lsusb to get the idVendor and idProduct values needed next. The output should look something like this:

      Bus 001 Device 002: ID 1781:0c9f Multiple Vendors USBtiny

      In this example (default for the usbtiny programmer), the idVendor is 1781 and the idProduct is 0c9f.

    2. Create a file /etc/udev/rules.d/99-usb.rules with the following contents:

      SUBSYSTEM=="usb", ATTR{idVendor}=="1781", ATTR{idProduct}=="0c9f", MODE="0660", GROUP="plugdev"
      • The idVendor and idProduct values are from the output of usbipd list above.
    3. Add your user to the group. This will require logging out and back in. sudo usermod -a -G plugdev $USER
    4. Reload the udev rules: sudo udevadm control --reload-rules && sudo udevadm trigger

    NOTE: If you're unable to access, try with sudo permissions.

]]>https://devblogs.microsoft.com/commandline/connecting-usb-devices-to-wsl/]]>

]]>https://www.krekr.nl/content/using-usbtinyisp-with-ubuntu/]]> ]]>https://www.tonymitchell.ca/posts/programming-avr-in-wsl-tips-and-tricks/]]>

Simulator

]]>SimAVR]]>

sudo apt install simavr

also installs gdb-avr as a dependency.

To run a simulation, you need a special build that brings in simulator symbols. See main-sim.c

make sim

If you run the simulator with the -g flag, it will open up a gdb server port. You can then attach a GDB session to that port.

Debugger

  • VSCode launch target defined in .vscode/launch.json
  • make sim-debug to build the debug target and lanch the gdb-avr server process.
    • Needs to be redone every code change.
    • Make sure to kill the debugger if you relaunch.
  • Select the VSCode debug and run with the AVR Debug configuration.

Electronics

AtTiny85

]]>Amazon]]> * \$13.29 for 5 pieces = $2.66/piece, though had free deliverey. * Digikey has for \$1.66/piece in quantity 1, $1.52 in quantity 25.

Servo Motor

]]>Amazon]]>

Poteniometer

]]>Amazon]]>

You may need to install the following packages for this specific kernel: linux-tools-5.15.90.1-microsoft-standard-WSL2 linux-cloud-tools-5.15.90.1-microsoft-standard-WSL2

You may also want to install one of the following packages to keep up to date: linux-tools-standard-WSL2 linux-cloud-tools-standard-WSL2

Report a bug