/helloblink

ihex blink for attiny13

Primary LanguageAssemblyMIT LicenseMIT

I2C ADXL345 accelerometer blink.

EDIT: Abandoned, servo interupt method breaks deterministic i2c loops. Also most compilation is automated in the src/cmp.sh file instead of a Makefile Michael 20170729

This is just a test rig to check I can actually read ADXL registers before doing more indepth code.

This gets the value of DATAx0 and uses this to turn on and off PORTB 0-2.

  • Atmel ATTiny13A used.

  • fuse bits low 0x7A

  • fuse bits high 0xFF

  • ADXL345 referenced as A

  • ATTiny13A referenced as T

  • VccA, VccT(8), CS, SDO to 3.3volts.

  • GNDA, GNDT(4) to ground.

  • SDA to T(2) (PORTB3)

  • SCL to T(3) (PORTB4)

  • SCA, SCL through 5k resistors to Vcc (no pullups on PCB)

  • LED's PORTB 0-2 T(5-7) to GND

Gotcha's (May be different for your ADXL345 PCB) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  • SDO high or low changes read and write addresses.
  • CS high or low changes SPI or I2C mode.
  • make sure I2c delay and attiny clock cycles agree (set L0x6A when I had calculated for L0x7A).
  • Device ID is not read or write i2c bus slave address.
  • SDA and SCL need to be pulled high and driven low. May require off PCB resistors.
  • ADXL345 needs a stop/start between write address and read value, most libraries don't do this.

AVI link

Based on code from

Referenced code from

Michael 20120603