---------- Forwarded message ----------
From: Gonenc Ulker (Alumni) <[email protected]>
Date: 2014-10-06 10:17 GMT+03:00
Subject: Beaglebone-fs.write spidev issue
To: [email protected]
Cc: "Gorkem Turk (Alumni)" <[email protected]>, Alican Kızılkaya <
[email protected]>


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

-- 
Gonenc Ulker
MSc Mechatronics Engineering Program
Sabanci University
Faculty of Engineering and Natural Sciences
Tuzla 34956, Istanbul, Turkey



-- 
Gonenc Ulker
MSc Mechatronics Engineering Program
Sabanci University
Faculty of Engineering and Natural Sciences
Tuzla 34956, Istanbul, Turkey

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to