6 Replies Latest reply on Jun 18, 2015 3:45 PM by user_14586677

    PSOC 4 ble and LIS2DH12 SPI interfacing

    nchas

       Currently I am trying to interface PSOC 4 ble with LIS2DH12 accelerometer. This is the first time I am using SPI interfacing.

         

      So if you have any sample codes or any application notes would be good.

         

       

         

      Thanks.

        • 1. Re: PSOC 4 ble and LIS2DH12 SPI interfacing
          user_1377889

          There are example projects for PSoC4 and SPI. Just use the "Find Example Project" from Creator's start page. From the component's view there is not much difference between a PSoC4 and the BLE-version.

             

           

             

          Bob

          • 2. Re: PSOC 4 ble and LIS2DH12 SPI interfacing
            user_14586677

            There are some accelerometer projects over here -

               

             

               

                

               

                      

               

            PSOC 4 element14.com

                                                       
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

            S No

            Date

            Project Title

            1

            01-May-2013

            Simple Blinking LED

            2

            02-May-2013

            CapSense Slider Example

            3

            03-May-2013

            PSoC 4 Pioneer Kit Annotation Library

            4

            06-May-2013

            USB-UART utility

            5

            07-May-2013

            USB-I2C Utility

            6

            08-May-2013

            Danger Shield with Light Sensor Control

            7

            09-May-2013

            Danger Shield with 7-segment display

            8

            10-May-2013

            Danger Shield Buzzer of Doom

            9

            13-May-2013

            Graphics LCD Display

            10

            14-May-2013

            LCD - Rotating Cube Demo

            11

            15-May-2013

            GLCD Paddle Game

            12

            16-May-2013

            Pioneer Board Oscilloscope

            13

            17-May-2013

            CapSense Button & LED Control with Bridge Control Panel

            14

            20-May-2013

            What was the value? - LED Memory Example

            15

            21-May-2013

            CapSense Proximity Detection

            16

            22-May-2013

            Proximity Theremin

            17

            23-May-2013

            2-Channel OScope with GraphicsLCD

            18

            24-May-2013

            'Catch the Shells' Game with ColorLCD Shield

            19

            28-May-2013

            LED Memory! Part Deux. Just Deux it!

            20

            29-May-2013

            Starter Designs

            21

            30-May-2013

            Fractional Frequency Synthesizer

            22

            31-May-2013

            “Kill The Ghost” Game

            23

            03-Jun-2013

            tinyprintf Example

            24

            04-Jun-2013

            XBee Router Loopback Example

            25

            05-Jun-2013

            XBee Direct IO

            26

            06-Jun-2013

            XBee API RxTx Example

            27

            07-Jun-2013

            XBee RGB CapSense Control

            28

            10-Jun-2013

            “WiFi? Why Not!” Arduino WiFi Shield Example

            29

            11-Jun-2013

            Bluetooth Home Automation System

            30

            12-Jun-2013

            Bluetooth with GLCD

            31

            13-Jun-2013

            Ethernet Shield

            32

            14-Jun-2013

            More Relay!

            33

            17-Jun-2013

            Sweet Music Everywhere! MIDI Shield

            34

            18-Jun-2013

            Resistive Touch Example

            35

            19-Jun-2013

            UART, I2C, and SPI Joystick Example

            36

            20-Jun-2013

            What? I can use the PSoC 5LP too?

            37

            21-Jun-2013

            PSoC With Friends! Word Scramble Game

            38

            24-Jun-2013

            Ultrasonic Distance Measurement

            39

            25-Jun-2013

            Two PWMs for the price of one

            40

            26-Jun-2013

            Pioneer PnP Sensors

            41

            27-Jun-2013

            Thermistor Example

            42

            28-Jun-2013

            Hangman Game

            43

            01-Jul-2013

            Rise of the Machines (Rolling Robot)

            44

            02-Jul-2013

            Run Away Run Away! (Proximity Robot)

            45

            03-Jul-2013

            Stepper Motor Example

            46

            05-Jul-2013

            “Paint The Night” Accelerometer Example

            47

            08-Jul-2013

            Obstacle Avoider Robot

            48

            09-Jul-2013

            Walk The Line! Robot Example

            49

            11-Jul-2013

            Android Device Controlled Robot

            50

            12-Jul-2013

            SD Card Example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

            S No

            Date

            Project Title

            51

            15-Jul-2013

            Music Player

            52

            16-Jul-2013

            Strike A Pose! Digital Camera

            53

            17-Jul-2013

            PSoC Eye

            54

            18-Jul-2013

            Custom Component 4x4 Keypad

            55

            19-Jul-2013

            Parallel to Serial UDB Component

            56

            22-Jul-2013

            Accelerometer Level

            57

            23-Jul-2013

            Digital Audio From A Single Pin

            58

            24-Jul-2013

            An Introduction to Processing

            59

            25-Jul-2013

            But Wait There’s More! Single PWM with 3 Outputs

            60

            26-Jul-2013

            PSoC 4 Mini-Billboard

            61

            29-Jul-2013

            Nokia 5110 LCD Interface

            62

            30-Jul-2013

            Ready…Set…GO! PSoC Stopwatch

            63

            31-Jul-2013

            Some Like it Hot! PSoC Thermostat

            64

            01-Aug-2013

            Workspace Organization using PSoC Theromostat

            65

            02-Aug-2013

            New to PSoC or the Pioneer Kit? START HERE!

            66

            05-Aug-2013

            LED Blinky Revisited

            67

            06-Aug-2013

            PSoC 4 Getting Started Lab 1 (LED Blinky)

            68

            07-Aug-2013

            PSoC 4 Getting Started Lab 2 (PWM LED)

            69

            08-Aug-2013

            PSoC 4 Getting Started Lab 3 (CapSense UART)

            70

            09-Aug-2013

            PSoC 4 Getting Started Lab 4 (ADC)

            71

            12-Aug-2013

            Get Your Motor Runnin’!

            72

            13-Aug-2013

            TFT Touchscreen Shield

            73

            14-Aug-2013

            TFT Touchscreen Tic-Tac-Toe Game

            74

            15-Aug-2013

            PSoC Creator Training 110

            75

            16-Aug-2013

            PSoC Creator Training 111                                          

            76

            19-Aug-2013

            PSoC Creator Training 112

            77

            20-Aug-2013

            PSoC Creator Training 113

            78

            21-Aug-2013

            PSoC Creator Training 210

            79

            22-Aug-2013

            PSoC Creator Training 211

            80

            23-Aug-2013

            PSoC Creator Training 212/213/214

            81

            26-Aug-2013

            NFC/RFID Shield

            82

            27-Aug-2013

            RFID Reader and Writer Project #2

            83

            28-Aug-2013

            Raspberry Pi Integration

            84

            29-Aug-2013

            State Machines in PSoC 4

            85

            30-Aug-2013

            UART Bootloader in PSoC 4

            86

            03-Sep-2013

            GPS Algorithm

            87

            04-Sep-2013

            Gas Sensor Example

            88

            05-Sep-2013

            Simulation of Gas Sensor Example

            89

            06-Sep-2013

            GPS Example

            90

            09-Sep-2013

            Comparator Example

            91

            10-Sep-2013

            Infrared Remote Control

            92

            11-Sep-2013

            Serial Communications Examples

            93

            12-Sep-2013

            4 Channel Multiplexed Comparator

            94

            13-Sep-2013

            Opamp Dynamic Gain

            95

            16-Sep-2013

            Hibernate and Stop Power Modes

            96

            17-Sep-2013

            P4 Light Sensor Project Design

            97

            18-Sep-2013

            Rice Cooker

            98

            19-Sep-2013

            Thermal Printer

            99

            20-Sep-2013

            I2C Pass Though 'Smart Wire'

            100

            23-Sep-2013

            PSoC 4 Time Square Billboard

            • 3. Re: PSOC 4 ble and LIS2DH12 SPI interfacing
              user_242978793

              The Psoc 4 m kit has a program to read this kind of data.check this  http://www.cypress.com/?docID=53577 look at section 4.7 for information about its accelerometer.  The program also sends the data to Micrium μC/Probe .
               

              • 4. Re: PSOC 4 ble and LIS2DH12 SPI interfacing
                bmah

                 An accelerometer sample project can be obtained from: http://www.cypress.com/?rID=111982

                   

                This uses Analog accelerometer. SPI interface should be simple. You can refer the Creator example projects to understand SPI interfaces. 

                • 5. Re: PSOC 4 ble and LIS2DH12 SPI interfacing
                  user_14586677

                  From Bob in  a prior post on SPI -

                     

                   

                     

                      

                     

                            

                     

                  Reading from an SPI slave takes a little bit of getting used to.

                     

                   

                     

                  SPI is organized, so that for every bit written to the slave a bit is returned by the slave at the very same time.

                      

                  So the usual procedure to read from a slave is: 

                     
                        
                  • Assert  ss
                  •     
                  • Write byte(s) to slave to indicate what the slave has to answer (commands).
                  •     
                  • When done (transmitted), clear the recieve buffer
                  •     
                  • Write as many dummy bytes to the slave as you want to read.
                  •     
                  • When done (transmitted), de-assert ss
                  •     
                  • Now your RX-buffer is filled with the required information which you can read out now.
                  •    
                     

                   Seems to be a bit (or byte) weired, but that's the way SPI works.

                     

                   

                     

                  Regards, Dana.

                  • 6. Re: PSOC 4 ble and LIS2DH12 SPI interfacing
                    nchas

                    Finally I am able to interface both accelerometer and flash over the SPI bus.

                       

                     Thank you very much guys for your help.