1 2 Previous Next 13 Replies Latest reply on Feb 4, 2012 10:57 AM by huiling.ong

    CY8CKIT-001 PSoC 3 Delta Sigma ADC

    huiling.ong

      Hi,
      I'm new here and new to cypress. I have measured the variable resistor on board with the multimeter and find that it ranges from 0.27V to 3.23V. And when i connect the variable resistor to the Delta Sigma ADC and print it on the LCD, it print out the digital value in Hex. I tried using a formula, to get back the input analog value for checking in this form, ADCResult/Total ADC bits resolution * max input voltage. I convert the ADC Hex value output into a int variable to do the calculation and realize i do not get back the same value as the analog input. Also i observe that the output of the ADC printed on the LCD does not seem to scale with the variable resistor when i was turning it. Can anyone tell me what's wrong?

        • 1. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
          ki.leung

           How about upload your project so others can check.:-)

          • 2. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
            gautam.das.g

            Hi hling,

               

             

               

            Welcome to the world of PSoC!

               

            You can use the Delta Sigma ADC in various modes. Depending upon the input mode, you can use it in:

               

            1) Differential mode

               

            2) Single ended mode.

               

             

               

            You can set the conversion mode as Continuous or multisample. Since in this case, you are using only a single analog channel you can use continuous mode.

               

            There are APIs available which will do the conversion similar to what you have mentioned and gives the output reading in voltage. The APIs are

               

            ADC_CountsTo_mVolts() - which gives the result in milli volts

               

            ADC_CountsTo_uVolts() - which gives the result in micro volts

               

            ADC_CountsTo_Volts() - which gives the result in volts

               

             

               

            You can refer to the component datasheet of Delta Sigma ADC to get more understanding on the various APIs available and the various configuration features supported.

            • 3. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
              gautam.das.g

              An example project is attached in which the Delta Sigma ADC is set to 16 bit resolution.

                 

              The ADC is operated in Single ended mode with the Input Range from Vssa to Vdda.

                 

              If you are using the Vdda as 3.3V on your board, then the Operating Conditions should also be changed accordingly. It can be done in cydwr > System > Operating Conditions

                 

              If you intend to use the Vdd as 5V, then change SW3 on the board (CY8CKIT-001) to 5V and make the necessary changes in the Operating Conditions.

                 

              The 16-bit value and the value converted to mVolts is displayed on the LCD.

                 

               

                 

              The project is attached.

              • 4. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                huiling.ong
                        Hi Dsag, I tried running the example ADC you provide and it has missing CyAnnotation files so i used an existing workspace and the problem still persist. Despite me turning the on board variable resistor the value printed on the LCD does not scaled. Eg. It only prints 1.44 to 1.51 no matter where i turn the variable resistor to. This is the simple program i wrote. void main() { uint16 ADCResult; float Vin; char OutputString[32]; int x; ADC_Start(); ADC_StartConvert(); LCD_Start(); CYGlobalIntEnable; while(1) { if(ADC_IsEndConversion(ADC_WAIT_FOR_RESULT)) { for(x = 0; x < 3; x++) { ADCResult = (int)ADC_GetResult16(); } sprintf(OutputString, "%i", ADC_GetResult16()); LCD_Position(1,0); LCD_PrintString(" "); LCD_Position(1,0); LCD_PrintString(OutputString); Vin = (float) ADC_CountsTo_Volts(ADCResult); sprintf(OutputString, "%4.3f", Vin); LCD_Position(0,0); LCD_PrintString(" "); LCD_Position(0,0); LCD_PrintString(OutputString); CyDelay(1000u); } } } I have attached a image of my ADC setting. Anyone got such problem too?   
                • 5. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                  gautam.das.g

                  Hi hling,

                     

                   

                     

                  Which kit are you using? Is it CY8CKIT-001 or CY8CKIT-030?

                     

                  Here are some of the questions which might help in narrowing down on the root cause of the issue:

                     

                  1) Are all the device settings on the board fine? If you are using CY8CKIT-001, the jumper on VR_PWR should be placed to enable the powering up of the potentiometer.

                     

                  2) The SW3 voltage should be set same as the Operating Conditions in the Voltage Configuration.

                     

                  3) Which version of PSoC Creator are you using? Please update to Creator 2.0 if you are using any older version. The link to this is give here http://www.cypress.com/?id=2494&source=home_documentation

                     

                  4) In the project attached, P0[2] is the analog pin selected in the cydwr. After connecting VR (Potentiometer) to P0[2] using an external jumper wire, is the ADC value displayed on the LCD not changing in accordance with change in the potentiometer voltage?

                     

                   

                     

                  Let us know if this helps.

                  • 6. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                    gautam.das.g

                    It is easier for us to debug the issue if you could attach your project here. Or atleast the part in which you are using the DAC.

                    • 7. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                      huiling.ong

                      I am using the kit, CY8CKIT-001 and the device used is PSoC3 CY8C3866AXI-040ES2. The jumper is correctly connected, and the SW3 voltage is set as 3.3V same as the Operating Conditions. I tried updating the Creator 2.0 already. As I do it while having a multimeter along side to measure the output of the VR, it shows that the VR output is changing from 0.2V to 3.3V but the ADC value displayed on the LCD is not changning in accordance with the change in VR, the LCD keep print a value of ranging around 1.3**V.

                         

                      I attached a .rar file that contain my code bundle and image of my board patching. Do let me know if anyone can run it properly. Thanks.

                         

                      • 8. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                        user_1377889

                        Sorry, The PSoC archiver generates a compressed ZIP-File, can you upload that, so I can immediately download it into my Kit to check for any inconsistencies.

                           

                        "Clean Project"

                           

                        "Make Workspace Bundle" (minimal) gives the smallest but still working archieve

                           

                        Bob

                        • 9. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                          ki.leung

                           Not sure if this is the problem.

                             

                          According to the data sheet:

                             

                          "When the ADC is configured for 16-bit single-ended mode, use the ADC_GetResult32() function instead."

                             

                          ie you should use a unsigned long to read the return value.

                          • 10. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                            gautam.das.g

                            Hi hling,

                               

                             

                               

                            I tested the project which you had attached on PSoC 3 production silicon.

                               

                            The project worked fairly as expected. The voltage readings obtained on the LCD was in strong correlation with the voltage measured using a multimeter. Here are some of my observations:

                               

                            1) In the project, P0[7] is used as the analog pin but in the snap-shot of the development board you have attached, other pin is used.

                               

                            2) As lleung has already mentioned, it is adviced to use ADC_GetResult32() when using a resolution of 16-bit or higher.

                               

                            3) In the project, the infinite loop has 3 read operations done at the beginning. The result is stored in a variable named "ADCResult". But while displaying the ADC count (2nd row), there is a direct read using GetResult16( ) API. Since the ADC is running in continuous mode, before reading an ADC result, it is mandatory to make sure that the conversion is complete. You can use the already received "ADCResult" in this case.

                               

                            4) In this project, since the voltage of the potentiopmeter is measured, it is advantageous to us Vdda as a reference. This is because, when ratiometric sources are involved, the change in Vdd will have very little effect on the output of ADC.

                            • 11. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                              gautam.das.g

                              The project is attached along with this comment. I tested it on production version od PSoC3 (not ES2).

                                 

                              Let us know if you still face the issue.

                              • 12. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                                huiling.ong

                                I finally got it working, though not perfectly. I guess it needs caliberation, not sure if it's cause of the hardware. But i managed to get it working after i changed the input port from P0[7] to P1[6] and using PSoC Creator 2.0. May I know what is the different between single sample and continuous sample? Thanks so much for everyone helps. I also learn a lot from everyone. Thanks so much.

                                • 13. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                                  user_1377889

                                  In single sample mode you have to request each conversion seperately, in continous mode you start and stop the conversions. In any case, you have to wait for a conversion beeing ready before you read it from the ADC (as soon as possible, before a new conversion starts)

                                     

                                  Bob

                                  • 14. Re: CY8CKIT-001 PSoC 3 Delta Sigma ADC
                                    gautam.das.g

                                    Hi hling,

                                       

                                     

                                       

                                    Delta Sigma ADC in PSoC can be used in Single Sample, Multi Sample or Continuous conversion mode.

                                       

                                    When using single sample mode, for every conversion, the ADC_StartConvert( ) API should be called.

                                       

                                    When using the Continuous mode, upon the first ADC_StartConvert( ) API the conversion is started. The subsequent conversions will occur automatically until an ADC_StopConvert( ) API is called.

                                       

                                    When using Multiple channels with ADC, it is required to operate in Multi-sample mode. In this mode, the filters are flushed between each sample so that there is no cross-talk between the channels.

                                    1 2 Previous Next