8 Replies Latest reply on Aug 2, 2011 3:08 PM by arun.kumar.3

    Writing Host application code for cy68013a

    jeff.simpson

      I am trying to write some application software that will access an Analog Devices AD7152 device that uses the cy68013a. I want to use the CyUsb.sys driver and the CyUSB managed .NET library to communicate with the device through the device driver.

         

      The AD7152 ships with the ezusb.sys driver, but I already got the CyUsb.sys driver working. I can see the device in CyConsole and see all the End Points it exposes. I have writen the .NET code to establish connection with the device and I can see the EndPoint data there too.

         

      Now I need to start transfering data from this device. It is a capacitance Analog to Digital Converter. This is where there is a large gap in my knowledge. Looking at the AD7152 documentation, I was expecting to see information related to EndPoints, but it does not mention End Points at all. Instead, there are statements like "The master initiates a data transfer by establishing a start condition, defined by a high-to-low transition on SDA while SCL remains high," which seem way too low level for my situation. I'm not writing firmware for the device, after all.

         

      There are several useful tables in the AD7152 documentation, however, but no sample code. I do know that I need to write 0x19 to register subaddress 0x0F to enable channel 1 and channel 2 for continuous operation. However, I have no idea how the concept of register translates to the concept of End Point.

         

      I tried to use the CyConsole to write to the device on different End Points, but I always get  "Control Transfer Failed." I was thinking I could use CyConsole to figure out what bytes I need to write and read and what End Points to use, and then translate this into code.

         

      I've hit a big wall, and any help would be greatly appreciated. I realize that the board is not Cypress, although the USB controller is. Any help would be greatly appreciated, as this is my first experience interfacing with hardware and I have a customer who is going to want to see data flowing from the device to my app within the next week.

         

      Thanks,

         

      Jeff

        • 1. Re: Writing Host application code for cy68013a
          user_611219

          Hi Jeff,

             

          The AD7152 has an I2C port, not USB, that's why you can find no mention of endpoints in the AD7152 documentation.

             

          You would have to use the I2C port of the CY7C68013a, to communicate with the AD7152.

             

           

             

          On the other hand, depending on your application (capacitive sensing?), you may consider using a Cypress PSoC, and that would have both USB and capacitive sensing on the same device.

             

          • 2. Re: Writing Host application code for cy68013a
            jeff.simpson

            Thanks for the reply. Let's assume I need to continue using the I2C port on the cy7c68013a. What resources should I be looking at to figure out how to do this? Does Cypress have any windows libraries or example code for doing this?

               

            Thanks,

               

            Jeff

            • 3. Re: Writing Host application code for cy68013a
              user_611219

              Hi Jeff,

                 
                 

              Your communication path is as follows:

                 
                 

              Windows- USB<-->USB-CY7C68013a-I2C <-->I2C-AD7152

                 
                 

              So depending on the amount of data, timing etc, you will choose a USB protocol and endpoints to enable transfer of data from the CY7C8013a to the PC, and perhaps some control instruction back down to the CY7C68013a.

                 
                 

              There should be plenty of cypress examples to get that portion working.

                 
                 

              Then it's a matter of getting the data you want from the AD device. What I am trying to point out here is that the connection between the CY and AD (over I2C), have nothing to do with USB or Windows API.

                 
                 

              The I2C is just another "serial" port used in embedded systems.

                 
                 

              This application note should have enough information to get you started. It's an example of I2C interfacing to an EEPROM.

                 
                 

              Hope this helps.

              • 4. Re: Writing Host application code for cy68013a
                jeff.simpson

                Thanks, you've been really nice to help me, as this is a Cypress Chip but not a Cypress board. I'll look over this example. Do you think I will need to write any firmware for the board, or is that unlikely? I'm thinking that I won't need to, as there is an application that comes with the AD board that allows me to configure the board and gather data from it, much in the same manner that I'm going to need to do. I wish they sent the source with that app.

                   

                 

                   

                If I had it to do over again, I would have inserted myself in this process earlier and we would probably be using a Cypress board to save time in development. I assume that was what you were implying earlier... that I would have less low-level code to write if I were using this PSOC solution?

                   

                 

                   

                I still have a ton of software to write which revolves around the data I'm gathering. That's my specialty, not this hardware stuff.

                   

                 

                   

                Thanks Again,

                   

                Jeff

                • 5. Re: Writing Host application code for cy68013a
                  user_611219

                  Hi Jeff,

                     

                  You have the evaluation board, so you should have all the firmware required for the task.
                  You would have to replace the PC application with your application.
                  Looking at the functionality of the evaluation pc application, you should have all the hooks in the evaluation firmware to setup the ADC and get the data you want. IOW, you shouldn't have to touch the firmware on the evaluation board, if you use the USB as it is on the evaluation board.

                     

                  If you have already written your own USB firmware for the evaluation board, you should be able to pick out the relavant functions to communicate with the ADC from the evaluation board firmware.

                     

                  Good luck.

                  • 6. Re: Writing Host application code for cy68013a
                    tony.mathew

                    you will choose a USB protocol and endpoints to enable transfer of data from the CY7C8013a to the PC, and perhaps some control instruction back down to the CY7C68013a.

                       

                    There should be plenty of cypress examples to get that portion working.

                       

                     

                       

                    Hi Terrence,

                       

                     

                       

                    I am also in a similar situation .Can you provide me some pointers to some examples on the same?

                    • 7. Re: Writing Host application code for cy68013a
                      anand.srinivasan.asokan

                      You can find example host applications in SuiteUSB http://www.cypress.com/?rID=34870 .

                         

                      Regards,

                         

                      Anand

                      • 8. Re: Writing Host application code for cy68013a
                        arun.kumar.3

                        I am also facing the same problem. Can you please point to an examle that shows how to talk with an i2c device through CY68013A. I looked at the examples in the .net folder of cyusb libary but they did not make much sense for talking to an i2c device.

                           

                        Thanks,

                           

                        Arun