7 Replies Latest reply on Mar 31, 2016 12:50 AM by eric_yuan

    spi issue from mraa lib



      do anyone tried the spi library in mraaa,

      I just find out some of the function cannot work if i change the parameter such as lsbmode() and frequency().

      I didnot find out any change in oscilloscope if i changed the value in lsbmode() and frequency()

      Is that means i missed something.



      var mraa = require('mraa');

      console.log('MRAA Version: ' + mraa.getVersion()); //write the mraa version to t

      var oled_spi = new mraa.Spi(0);


      function spi_init()


          console.log("Init the spi interface");

        //  oled_spi.lsbmode(false);






      function loop()


          console.log('Start to run the oled program');





        • 1. Re: spi issue from mraa lib
          Intel Corporation
          This message was posted on behalf of Intel Corporation


          First, what image are you using, what mraa version are you using, what base board are you using?

          How have you installed the SPI library? What do you mean some of the functions don’t work when you change lsbmode() and frequency(), does the code not compile when you use certain parameters on these functions or the program does not respond when you use certain parameters? Are you using any IDE or are you running the program straight from terminal?


          • 2. Re: spi issue from mraa lib







            I have tried to play with freq = 500, 600, 1000, 2000, 3000. The picture is the same.

            I have a difference between 5000 and 7000.




            • 3. Re: spi issue from mraa lib

              Hey Sergio and xbolshe

              I appreciate for your help on this problem.

              what image are you using

              -->I use yacto 159.devkit.

              what mraa version are you using

              -->The version of mraa is v0.9.0

              what base board are you using?

              -->I'm using the intel edison core with the arduino board.

              I'm using the Intel XDK IOT version.Intel XDK - IoT App Daemon v0.0.37


              The problem is if i change the oled_spi.lsbmode() from false to ture. the sequence of the transmit bit didn't change.

              For example if i use oled_spi.lsbmode(true), then the sequence should be 1010 1000, if i use oled_spi.lsbmode(false), then the sequence should be 1000 1010
              but the reality is the sequence didnot change after i modify the code and upload and run successfully.

              I'm not sure it's because i misunderstand this function or not, since i know the first transmit bit is a key parameter for SPI interface.


              For the problem of frequency, i think it's because there is a range of it. I need to do some more test on it before i can confirm where is the problem.


              BTW, I had updated the mraa lib from Manage your daemon/iot devices --> update libraries on board. But still get a mraa version of v0.9.0 instead of v0.10.0 just like @xbolshe. 

              So what command i should run in order to update it to v0.10.0.


              I'm pretty new to this, Thanks for your help.


              • 4. Re: spi issue from mraa lib

                I have checked Edison's SPI kernel driver and found that:

                1.  it does not support LSB setup

                2.  a speed has a minimum limit because of a frequency divider width. So, need to use a frequency more than 7000 Hz to see a difference


                So, this is not a MRAA problem.


                Regarding mraa update command, I do not use it, because I have own compiled image with preinstalled nodejs & mraa.

                But you may check this forum regarding "npm install mraa". Note that need to have some tools installed before.




                • 5. Re: spi issue from mraa lib

                  Hey  xbolshe

                  Thanks for clearing the confusion from my side.


                  Since I'm pretty new to the Yacto system, so can you tell me the location of the SPI driver in Yacto' Kernel. I tried to find out in some file folders, but failed to target it.

                  And i really want to dig into this, and it can helps me a lot when i debug other interfaces such as iic and usart.





                  • 6. Re: spi issue from mraa lib



                    here is a location:





                    • 7. Re: spi issue from mraa lib

                      Hey xbolshe


                      Thanks for your help.