SPI woes #4005
Replies: 1 comment
-
Posted at 2014-08-13 by @gfwilliams Could it be to do with the SPI clock speed? The SD card code sets it to 1000000, so you could try specifying that when initialising SPI2 and see if that helps? Posted at 2014-08-13 by DrAzzy Identical behavior when I changed my code to this:
Interestingly enough, once it has worked, reset() doesn't make it stop working. IE, if I do the above, then fs.readdir(), then press "send to espruino" again (resetting the espruino), it works immediately without having to do anything. It's something in the espruino - if I power cycle the part after making it with with fs, it continues to work. Posted at 2014-08-13 by @gfwilliams
Not sure I understand what you're saying? I think I know what the issue is. Try changing It doesn't error because it's perfectly valid to not want sck to be brought out on a pin. If you don't mention it, it won't be set up. Strange that Posted at 2014-08-13 by DrAzzy Wow... Just wow. If that's what it is, I hang my head in shame! That's the code I was sending, copy/pasted out and all... And I checked that I had the right several times, but somehow I think I got the abbreviations backwards, and was explicitly checking that I had it saying scl, because I was convinced that was what it was. Very expensive error - over 5 hours of time spent debugging this. I was going crazy, doing things like ohming out the wires, checking every combination of pins for shorts, etc. Had it not been for this, I'd have two more modules tested and submitted, plus more sleep. Posted at 2014-08-14 by @gfwilliams :( I've done the exact same thing before too. I suppose it would make a lot of sense to actually test for unexpected things in the object and warn about it... I'll file an issue. In this case it makes it worse that I2C uses scl and SPI uses sck :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-13 by DrAzzy
I've been going through hell using SPI to communicate with a digital potentiometer.
Check this out:
I send this to Espruino:
so digipot.getVal(0) should return 319 (actual value is 63, but it's adding 256 to it due to a bug in my module code - not accounting for differences between parts). Look what happens!
I have had it in failing state for hours, then one file system access, and bam, it's fixed.
Module code is here:
https://github.com/SpenceKonde/EspruinoDocs/blob/master/devices/MCP4xxxSPI.js
Beta Was this translation helpful? Give feedback.
All reactions