Skip to content

A simple AVR driver for controller I2C communication with the ATtiny85.

License

Notifications You must be signed in to change notification settings

jmatth11/i2c-avr-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AVR I2C Driver Example

This project is to have a simple example of a controller I2C communication on an ATtiny85 with documentation.

Supports writing and reading from target devices.

Project Structure

  • src The main source code folder
  • src/main.c The main file for using the I2C driver.
  • src/driver/i2c.[h|c] The I2C driver implementation files.
  • install_deps.sh Run this to install all the tools needed to build and flash AVR projects.
  • Makefile Contains commands to build and burn the AVR project.
  • compile_flags.txt Contains setup flags to work with the C LSP (clangd)

Demo

The demo has an ATtiny85 loaded with the code in this project hooked up to an arduino uno using the Wire library to act as a target device to talk to.

Actions performed:

  • The controller (ATtiny85) sends "Hello, World!" to the target (Arduino Uno) device.
  • The controller requests a read from the target to toggle the LED.
i2c-avr-coms.mp4

USBTiny

If using USBTiny programmer on linux you may have to run the upload command with sudo because of permission issues.

Another gotcha with the USBTiny is if it has an LED on the SDA pin it will mess with your data line. So don't use the USBTiny programmer to test your ATtiny85.

Setup in WSL

If you are trying to develop in WSL you need to forward the USB device onto the WSL environment.

  1. Start by downloading this utility program winget install --interactive --exact dorssel.usbipd-win

  2. Look for the USB port the arduino is using.

$ usbipd list
  1. Bind the USB port
$ usbipd bind --busid <port> # example would be 1-2
  1. Attach to WSL environment
$ usbipd attach --wsl --busid <port>
  1. Verify the USB port on WSL.

If you do not have lsusb find whatever your system uses.

This will list the USB ports you have access to and the arduino port should be in the list.

$ lsusb

Once done you can just detach the USB port.

About

A simple AVR driver for controller I2C communication with the ATtiny85.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published