8 Replies Latest reply on Feb 11, 2016 7:15 AM by user_1377889

    PRoC BLE and MPU-9250 : I2C or SPI

    user_443083377

      Has anyone interfaced a PRoC BLE using with Invensense MPU-9250?  I am just starting a major project with limited I2C experience.  I perhaps prefer SPI but looking for any tips and code that may be available out there to help kick things along?

         

       

         

      I have the PRoC BLE working with UART for transferring data to Android APPS, just looking at incorporating motion and sensing data to the whole process. 

        • 1. Re: PRoC BLE and MPU-9250 : I2C or SPI
          user_1377889

          I2C is quite straight forward, Cypress datasheet is complete. Only hint I can give: Do not mix the high-level routines transferring arrays of data with the low-level routines that need SendStart() and SendStop() APIs. I (personally) prefer the latter.

             

           

             

          Bob

          • 2. Re: PRoC BLE and MPU-9250 : I2C or SPI
            user_443083377

            Thanks Bob.  I have the I2C working, basically at least so I confirm my hardware is all OK.  I noted the Project of 100 projects/100 days (I2C-BLE Peripheral Role) where the BLE is acting as a "slave" to a secondary "master".  I am attempting to communicate via BLE but using a PRoC as Master, to an MPU "slave".  The PRoC then communicates via BLE to a central device (Android).  Not sure what the Master/slave repercussions might be, but is it a simple matter of reversing the Master and slave roles from that project?  Or is it much more complicated than that???  I am using the EZ-BLE 022001.

            • 3. Re: PRoC BLE and MPU-9250 : I2C or SPI
              user_1377889

              There is no hardware dedication between master/slave and PRoC BLE / PSoC BLE. The internal hardware equipment on a PRoC is a lot smaller than the PSoC's, so check if your requirements fits.

                 

               

                 

              Bob

              • 4. Re: PRoC BLE and MPU-9250 : I2C or SPI
                keerthi.gowda

                Well, I searched through weband found libraries for MPU6050. It should mostly port to MPU9050 except MPU6050 does not have magnetometer.

                   

                http://samselectronicsprojects.blogspot.in/2014/07/getting-started-with-mpu-6050-imu.html

                   

                https://github.com/EmbeddedSam/MPU-6050/tree/master/Examples/3%20MPU-6050-PSoC-GetGs/MPU-6050-PSoC-GetGs.cydsn

                   

                 

                   

                -Keerthi

                • 5. Re: PRoC BLE and MPU-9250 : I2C or SPI
                  user_443083377

                  I have managed to successfully interface the I2C but have found that the EZ-BLE 022001 very quickly runs out of memory facility, so am now using the EZ-BLE 222005.  The system uses the UART-BLE bridge for other functions, as well as I2C.  If anyone needs any assistance, pleased to share some of the experience.

                  • 6. Re: PRoC BLE and MPU-9250 : I2C or SPI
                    dpndr16

                    Hi ART911

                       

                    I have a similar situation as yours i want to interface my TSL2591 light sensor with cypress PSoC 4 BLE pioneer kit using I2C protocol for my major project.

                       

                    The difficulty is that i dont understand the how to program the PSoC creator while refering the datasheet of my sensor to display the lux value to a hyperterminal.

                       

                    I understand their are some registers that i need to read data from (should i read it raw if not what are the changes i need to make so that i get the lux values on my hyperterminal)

                       

                    After reading the various posts on cypress community i understand that we can use I2C protocol using these set of commands: SendStart(),WriteByte(),SendRestart() and SendStop().

                       

                    I need help in understanding the datasheet of my sensor and how to <h1>use the data read from the TSL2591 sensor in PSoC Creator to show the final lux value on a hyperterminal</h1>

                       

                    I am attaching the datasheet of the sensor which i want to interface using I2C protocol.

                       

                    i will really appreciate any help related to this situation :-)

                    • 7. Re: PRoC BLE and MPU-9250 : I2C or SPI
                      user_1377889

                      Byte I2C interface is quite simple: After setting up the component and starting it you use

                         

                          I2C_MasterSendStart(DeviceAddress,I2C_WRITE_XFER_MODE);    // Initialize a transaction for writing
                          I2C_MasterWrite(Register);                // Indicate which register you want to write to
                          I2C_MasterWriteByte(Value);                // Write to register
                          I2C_MasterSendStop();                    // End of transaction

                         

                      When you want to read from a device you use (example for reading two bytes

                         

                          I2C_MasterSendStart(DeviceAddress,I2C_WRITE_XFER_MODE);    // Initialize a transaction for writing
                          I2C_MasterWrite(Register);                // Indicate which register you want to write to
                          I2C_MasterSendRestart(DeviceAddress,I2C_READ_XFER_MODE);
                          I2C_MasterReadByte(I2C_ACK_DATA);            // Read from register
                          I2C_MasterReadByte(I2C_NAK_DATA);            // Read from register, last byte is NAKed
                          I2C_MasterSendStop();                    // End of transaction

                         

                      Not too difficult. Keep in mind that most of the APIs (except those for reading a byte) return a status byte which, when non-zero indicate an error condition.

                         

                       

                         

                      Bob

                      • 8. Re: PRoC BLE and MPU-9250 : I2C or SPI
                        user_443083377

                        Do a google for Jeff Rowberg and his I2CDEV samples on GITHUB.  Your sensor is not within his list, and there is nothing specifically for PSoC but follow the Arduino example.  You can download his code examples and it is pretty straight-forward to get it going.  Nothing is "simple" but in this case, pick your two pins, connect up the power and GND and you will be surprised how quickly you can get numbers streaming out.

                           

                        Be careful in your designs because I found the IIC clobbers other clocks, at least in mine it did perhaps due to the chip choice I have made.

                        • 9. Re: PRoC BLE and MPU-9250 : I2C or SPI
                          akramfliti_2043906

                          HI i have the same problem . i have a project in which i should use MPU-9250 with cypress 4 BLE ,i don't know how to use theme ,PLZ if anyone has any information about that help me and thanks...