Also, using D11 for CS is a bit scary, because that's shared with the button on the Thingy?
Yes it is. I just unsoldered the button to avoid conflicts.
are you sure you haven't just wired it to the wrong pin on the SD card?
I am. In addition, I tried to remove the SD card just to be 100% sure there isn't any electrical conflict.
driving the SPI directly from prompt (ThingySpi.write(0xAA)) gives the exact waveform on the MOSI pin. Calling E.connectSDCard(ThingySpi, CS), E.unmountSD();, fs.appendFile(File,data) or even E.openFile(File) has no action on MOSI pin.
MOSI=D4;//P0.04
MISO=D3;//P0.03
SCK=D2;//P0.02
CS=D11;//P0.11
var ThingySpi = new SPI();
var csvLogFile="logFile.csv";
function Init()
{
// Wire up up MOSI, MISO, SCK and CS pins (along with 3.3v and GND)
ThingySpi.setup({mosi:MOSI, miso:MISO, sck:SCK});
E.connectSDCard(ThingySpi, CS);
}
function csvLogSD(s)
{
try{
if(fs.appendFile(csvLogFile,s)==true)
console.log("log saved");
}catch(err){
console.log("error writing to SD.. trying unmount+remount");
E.unmountSD();
E.connectSDCard(ThingySpi, CS);
}
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes it is. I just unsoldered the button to avoid conflicts.
I am. In addition, I tried to remove the SD card just to be 100% sure there isn't any electrical conflict.
driving the SPI directly from prompt (
ThingySpi.write(0xAA)
) gives the exact waveform on the MOSI pin. CallingE.connectSDCard(ThingySpi, CS)
,E.unmountSD();
,fs.appendFile(File,data)
or evenE.openFile(File)
has no action on MOSI pin.