Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI transfers stop working during heavy usage #128

Open
sidwarkd opened this issue Nov 26, 2015 · 1 comment
Open

SPI transfers stop working during heavy usage #128

sidwarkd opened this issue Nov 26, 2015 · 1 comment

Comments

@sidwarkd
Copy link

In trying to test my Nokia screen module I found that large numbers of spi.send() calls will randomly cause the T2 to lock up and stop executing the current program. I boiled the code down to the following example that reproduces the issue.

var tessel = require('tessel');
var packetsSent = 0;

var port = tessel.port.A;
var spi = new port.SPI({
  clockSpeed: 4*1000*1000,
  dataMode: 0
});

var sendIt = function(){
  tessel.led[2].on();
  var data = new Buffer(504);
  data.fill('t');
  spi.send(data, function(err){
    if(err)
      console.log("ERR: ",err);
    else
      console.log("sent ",packetsSent);
    packetsSent += 1;
    tessel.led[2].off();
    setTimeout(sendIt, 200);
  });
};

setImmediate(sendIt);

After an arbitrary number of sends (sometimes 8, sometimes 108) the LED will stop toggling and the console output will stop because it is waiting for the send() callback. I've tried increasing the timeout to slow down the transmissions and that seems to help but doesn't alleviate the problem. There is no significance to the buffer being 504 bytes. That's just how long it is in my module code. .transfer() only supports 255 bytes but .send() was modified to chunk sends so it should work.

Running on firmware version 0.0.6 although I've been seeing this for some time so I don't think it is a new issue.

@johnnyman727
Copy link
Contributor

Thanks for reporting this, @sidwarkd!

For a pointer for whomever takes this bug on: the three places I'd check for an issue are the tessel-export.js driver (ensure it's still `writing to the domain socket), the SPI daemon (ensure it's not getting backed up or something), and finally the microcontroller firmware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants