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

Tessel sdcard module does not work with ambient module #22

Open
brutaldev opened this issue Oct 17, 2015 · 11 comments
Open

Tessel sdcard module does not work with ambient module #22

brutaldev opened this issue Oct 17, 2015 · 11 comments

Comments

@brutaldev
Copy link

I've posted a StackOverflow question with all the details: http://stackoverflow.com/q/33184440/564726

@natevw
Copy link
Owner

natevw commented Oct 24, 2015

For referenc here, the problem is:

Simply introducing the ambient-attx4 module prevents the SDCard from writing successfully.

var tessel = require('tessel');
var sdcardlib = require('sdcard');
var ambientlib = require('ambient-attx4');

var sdcard = sdcardlib.use(tessel.port['A'], { getFilesystems: true }, function (err, fss) {
  if (err) throw err;      
  console.log('SD card is ready...');

  var fs = fss[0];

  fs.writeFile('someFile.txt', 'Hey Tessel SDCard!', function (err) {
    if (err) throw err;
    console.log('Write successful.');
  });

  ambientlib.use(tessel.port['B'], function (err, ambient) {
    if (err) throw err;        
    console.log('Ambient is ready...');
  });
});

Result:

Error: Error flag(s) set: ERASE_RESET,ILLEGAL_CMD,ADDR_ERROR,IDLE_STATE,ERASE_SEQ,CRC_ERROR
    at _new ([string "colony-init.lua"]:504)
    at finish (/app/node_modules/sdcard/index.js:430)
    at callback (/app/node_modules/sdcard/index.js:422)
    at func ([string "tessel.js"]:963)
    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)

Unfortunately, I do not have an ambient module (or any ATTiny modules) and so it could be difficult to diagnose whether this is a hardware, firmware or library issue. Any chance you have a logic analyzer, even a cheap 20Msps USB one? A sample of the SPI bus (clock/miso/mosi) from either port plus the select lines from both ports simultaneously could be enlightening.

@brutaldev
Copy link
Author

Hey @natevw, I do not have a logic analyzer (I don't even know what that is 😕). Is there any other way I can get the info you're looking for?

@natevw
Copy link
Owner

natevw commented Oct 27, 2015

You might try the Tessel forums to see if others have similar problems or a workaround. There's some logging that can be turned on in the sdcard library, but I don't know how much it would help if it is a problem with multiple devices on the SPI bus. If there's not some sort of solution through the forums, perhaps the TM team could look into it with their expertise or send me one of the incompatible modules to do more troubleshooting myself. Sorry I don't have better ideas, just hard to know what's going on without being able to see it myself.

@brutaldev
Copy link
Author

Thanks for the feedback. I've trawled the forums already and this was my last resort when I couldn't find anyone experiencing the same problem. Will certainly be easier to figure this out if you had the modules to reproduce it.

@Frijol
Copy link
Contributor

Frijol commented Oct 28, 2015

@brutaldev can you please cross-post to the forums? You might be the first, but not the last to see this problem, so we typically debug there so any future people with the same problem can see the process.

Thanks!

@brutaldev
Copy link
Author

@Frijol No problem, will copy the StackOverflow post to the forums when my account is activated :)

@Frijol
Copy link
Contributor

Frijol commented Oct 28, 2015

whoops! Sorry, approved

@brutaldev
Copy link
Author

Thanks @Frijol. I have posted the same question on the forum as requested: https://forums.tessel.io/t/tessel-sdcard-module-does-not-work-with-ambient-module/2100

@Frijol
Copy link
Contributor

Frijol commented Oct 29, 2015

Thanks! We'll take a look.

@brutaldev
Copy link
Author

Using v0.2.5 of the ambient-attx4 module and v0.8.7 of the sdcard module.

This is the output of npm ls:

├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ └── [email protected]
└─┬ [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
  ├── [email protected]
  └── [email protected]

Checked for updates and these are the latest published versions. Perhaps a dependant project has been updated that broke things?

@johnnyman727
Copy link
Contributor

@brutaldev it looks like the SPI bus isn't being locked properly properly when each module is using it. Unfortunately, I don't have time to investigate Tessel 1 regressions at the moment.

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

4 participants