Hi, Jason
this is Gonenc from Mechatronics Department of Sabanci University
hope you are fine
We have been using Beaglebone White for remotely controlling-tracking our
solar inverter system over internet
We are planning to connect afew devices over SPI, so decided to use the
already enabled /dev/spidev2.0 (Angstrom 3.2.34)
We are working with CloudIDE and bonescript
We can write the SPI module using
spi_write = exports.spi_write = function(spi_message)
{
var muxfile=fs.openSync("/dev/spidev2.0",“w”);
fs.writeSync(muxfile,spi_message);
fs.closeSync(muxfile);
}
BUT THE PROBLEM IS:
when
spi_message=0x01 ==> it gives 0x31 as SPI HW output
spi_message=0x02 ==> it gives 0x32 as SPI HW output
…
Looks like taking it as char and not as integer
This is most probably due to fs.write used with strings
So instead tried this from shell for various hex numbers
for i in {1…20000}
do
echo -ne “\x87” > /dev/spidev2.0
done
And it works correctly for valueas of “\x00” to “\xFF” as expected
So we decided to apply the same to fs.write
fs.write("\x00") to fs.wrte("\x7F") // we are OK from 0 to 127
but than starts extended ascii part and from 128-255 we can’t get correct values
-Can we call echo command from bonescript directly
-Can we pass integer arguements to spidev using fs.write or any command else
-Or any other alternative method you can offer for more “flexible” opeartion of SPI from Cloud9
and that can provide spi_module access / easy setting of spi_clock_speed… without dealing with Kernel stuff
thanks in advance