Coder Social home page Coder Social logo

attiny-common's Introduction

Attiny-common

This library is designed to encapsulate all of the shared behavior of Tessel's attiny-attx4 and ir-attx4 libraries. They share much of the same hardware design so most of the non-domain specific logic can be abstracted out. These features include:

  • Initilization
  • Firmware Updating
  • CRC Checking
  • SPI Transmissions
  • IRQ Handling

Install

npm install attiny-common

Usage

var Attiny = require('attiny-common');

// Create a new tiny agent
var attiny = new Attiny(hardware);

// Store our firmware checking and updating options
var firmwareOptions = {
  firmwareFile : FIRMWARE_FILE,
  firmwareVersion : FIRMWARE_VERSION,
  moduleID : MODULE_ID,
  signature : TINY84_SIGNATURE,
  crc : (CRC_HIGH << 8) | CRC_LOW,
}

// Initialize (check firmware version, update as necessary)
attiny.initialize(firmwareOptions, function(err) {
  console.log('done initializing module!');

  attiny.setIRQCallback(irqHit);
});

function irqHit() {
  console.log("IRQ is active");
}

attiny-common's People

Contributors

hipsterbrown avatar jiahuang avatar johnnyman727 avatar kevinmehall avatar rwaldron avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

attiny-common's Issues

T2 Bug: Firmware Update results in invalid CRC

T2 firmware updates often end with "Error: Invalid response from CRC check" but the firmware appears to have been flashed correctly.

You'll have to workaround this issue to test it.

From the ambient module, run t2 run debug/update.js to repro.

Not urgent because it seems to be working anyway.

T1 Bug: Updating doesn't work consistently anymore

I wasn't able to find the exact commit that caused this (potentially because it works occasionally, giving you false positives), but attempting to update the firmware on the ambient module (untested on IR but there's no reason why it would work differently) often returns with one of a handful of different errors. The easiest way to test this is by running the update script from the ambient module.

Some of the errors I get:

  ambient-attx4 git:(jon-t2-compat) ✗ tessel run debug/update.js
TESSEL! Connected to TM-00-04-f0009a30-0056434b-54396208.
INFO Bundling directory /Users/Jon/Work/technical/modules/ambient-attx4
INFO Deploying bundle (2.45 MB)...
INFO Running script...
Error: Unable to update firmware: Programming confirmation not received.
    at _new ([string "colony-init.lua"]:1)
    at callback (/app/node_modules/attiny-common/lib/index.js:191)
    at callback (/app/node_modules/attiny-common/lib/attiny-isp.js:150)
    at next (/app/node_modules/attiny-common/lib/attiny-isp.js:15)
    at next (...node_modules/attiny-common/node_modules/avr-isp/index.js:74)
    at callback (...node_modules/attiny-common/node_modules/avr-isp/index.js:373)
    at func ([string "tessel.js"]:1110)
    at apply ([string "colony-js.lua"]:1)
    at func ([string "events.js"]:180)
    at call ([string "colony-js.lua"]:1)
➜  ambient-attx4 git:(jon-t2-compat) ✗ tessel run debug/update.js
TESSEL! Connected to TM-00-04-f0009a30-0056434b-54396208.
INFO Bundling directory /Users/Jon/Work/technical/modules/ambient-attx4
INFO Deploying bundle (2.45 MB)...
INFO Running script...
Error: Unable to update firmware: Invalid Module signature. Are you sure you plugged in the right module?
    at _new ([string "colony-init.lua"]:1)
    at callback (/app/node_modules/attiny-common/lib/index.js:191)
    at callback (/app/node_modules/attiny-common/lib/attiny-isp.js:150)
    at next (/app/node_modules/attiny-common/lib/attiny-isp.js:24)
    at next (...node_modules/attiny-common/node_modules/avr-isp/index.js:69)
    at callback (...node_modules/attiny-common/node_modules/avr-isp/index.js:539)
    at func ([string "tessel.js"]:1110)
    at apply ([string "colony-js.lua"]:1)
    at func ([string "events.js"]:180)
    at call ([string "colony-js.lua"]:1)
➜  ambient-attx4 git:(jon-t2-compat) ✗ tessel run debug/update.js
TESSEL! Connected to TM-00-04-f0009a30-0056434b-54396208.
INFO Bundling directory /Users/Jon/Work/technical/modules/ambient-attx4
INFO Deploying bundle (2.45 MB)...
INFO Running script...
Uploading new firmware...
Update finished!
Error: Invalid response from CRC check.
    at _new ([string "colony-init.lua"]:504)
    at callback (/app/node_modules/attiny-common/lib/index.js:277)
    at func ([string "tessel.js"]:1110)
    at apply ([string "colony-js.lua"]:380)
    at func ([string "events.js"]:180)
    at call ([string "colony-js.lua"]:354)
    at emit ([string "events.js"]:89)
    at <anonymous> ([string "colony-node.lua"]:52)

I've tried testing with attiny-common on master and the jon-t2-compat branch. I also tested avr-isp from jon-t2-compat back to e1bf12c (I think that's about 6 commits back from master at this point in time).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.