3 Replies Latest reply on Mar 8, 2017 6:31 AM by user_1377889

    EzI2C data reading with pointers

    janne.lesonen_2259471

      Hi,

         

      I have CY8CKIT-145-40XX PSoC 4000s prototyping kit.

         

      Original idea was to read e.g. slider position directly from memory via EzI2C. To enable that, I updated the original CapSense V3.0 component to V3.1 to be able to export register map. I trialed the code functionality with Tuner and everything worked as usual.

         

      To get better understanding what is transferred via I2C I was probing the communicating protocol directly with jump wires and logic analyzer. I was surprised that in every read, the whole registrymap is read through I2C, including somewhat irrelevant info such as device and config ID's..

         

      Anyhow, I hooked Arduino as Master and tried to read directly from address SLD_POSITION 0x54, by setting pointer by writing to the same address, but alas, the reading starts always from registy position CONFIG_ID 0x00 position no matter what. I also used Bridge Control Panel without any better results. I start to get data from 0x00.

         

      Have I understood something incorrectly? In EZI2C_Slave_V1-90_Datasheet.pdf document, at page 15,  It is said in the first sentence of last paragraph "Read operations always begin at the offset data pointer provided by the most recent write operation".

         

      As an attachment, I added a screenshot from Bridge Control Panel demonstrating the writing/reading I tried to do.

        • 1. Re: EzI2C data reading with pointers
          user_1377889

          Welcome in the forum, Janne.

             

          Isn't that too complicated what you do? To see the relevant registers it would be easier using the capsense tuner. For transmitting the slider values to another device it will be more efficient to transmit the slider position only. The tuning method selects at the PC side what to display, not on the PSoC side. That implies that all relevant information must be sent to the PC.

             

           

             

          Bob

          • 2. Re: EzI2C data reading with pointers
            janne.lesonen_2259471

            Hi Bob and thanks!

               

            Yes indeed, the idea is to use 4000s as a i2c slave sensing device, whereas the i2c master does what ever it gets from the 4000s. The problem is that in order to get e.g. only the slider position, I have to read from 0x00 to 0x53, throw that data out and then save the data what I get from 0x54-0x55. not that efficient use of i2c lines.

               

            Apparently it seems easier to:

               
                  
            • gather data with 4000s
            •     
            • process data with 4000s
            •     
            • select only the valuable data and concatenate new data array from it
            •     
            • pull external pin down as a mark of new scanning (xint) -> Host reads the value from 4000s
            •     
            • check whether i2c line is active
            •     
            • release external pin up
            •     
            • return to top of this loop.
            •    
            • 3. Re: EzI2C data reading with pointers
              user_1377889

              There are a lot of APIs to get data from a capsense slider. Right click on the capsense component and select "Datasheet". At same window is a "Find Code Example" which will help you.

                 

               

                 

              Bob