8 Replies Latest reply on Jun 29, 2014 3:27 PM by user_78878863

    end point not transferring data

    prakhar.kumar

       Hi guys,

         

      I am using an adc and USBFS (not USBUART) in a project. The adc output is being displayed on the lcd and simultaneously also being loaded into the endpoint of usb. I have configured usbfs for bulk transfer with endpoint 1 set for IN mode.

         

      However on execution, the transfer is not taking place and the program gets stuck at this command:

         

      while(USBFS_GetEPState(IN_EP)!=USBFS_IN_BUFFER_EMPTY);

         

      I have attached my project file under the folder name "proj3".

         

      I would be grateful for any suggestions quickly.

        • 2. Re: end point not transferring data
          prakhar.kumar

           I AM UNABLE TO POST MY FILE .I WILL SEND YOU GUYS THE CODE ITSELF.

          • 3. Re: end point not transferring data
            prakhar.kumar

             ========================================

               
                */   
               
                #include <device.h>   
               
                #include <stdio.h>   
               
                #include <string.h>   
               
                    
               
                #define IN_EP (0x01u)  /*end point IN1*/   
               
                    
               
                    
               
                void main()   
               
                {   
               
                    /* Place your initialization/startup code here (e.g. MyInst_Start()) */   
               
                    int32 output;   
               
                    char8 str[10]={0};   
               
                    uint16 len;    
               
                       
               
                    LCD_Start();   
               
                    VDAC_Start();   
               
                    IDAC_1_Start();   
               
                    IDAC_2_Start();   
               
                    TIA_1_Start();   
               
                    TIA_2_Start();   
               
                    ADC_Start();   
               
                    CyGlobalIntEnable;    /*always include this command for recognising usb devices*/   
               
                    USBFS_Start(0,USBFS_3V_OPERATION);   
               
                       
               
                       
               
                    TIA_1_SetResFB(TIA_1_RES_FEEDBACK_20K);   
               
                    TIA_2_SetResFB(TIA_2_RES_FEEDBACK_20K);   
               
                        
               
                    LCD_Position(0u,3u);   
               
                    LCD_PrintString("ADC OUTPUT");   
               
                       
               
                    ADC_StartConvert();   
               
                       
               
                    while(!USBFS_GetConfiguration());   
               
                    len=strlen(str);    
               
                       
               
                    USBFS_LoadInEP(IN_EP,&str[0],len); /*send a blank string*/   
               
                      
               
                         
               
                    for(;;)   
               
                    {   
               
                       ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);   
               
                       output=ADC_GetResult32();   
               
                       output=ADC_CountsTo_uVolts(output);   
               
                          
               
                       /*To account for offset error*/   
               
                       if(output>0)   
               
                       output=output-1500;   
               
                       else   
               
                       output=output+1500;   
               
                          
               
                       sprintf(str,"%7ld",output);   
               
                       LCD_Position(1u,3u);   
               
                       LCD_PrintString(str);   
               
                       len=strlen(str); /*calculate length of string to load in IN buffer*/   
               
                          
               
                       while(USBFS_GetEPState(IN_EP)!=USBFS_IN_BUFFER_EMPTY);/*load the in buffer if it is empty*/   
               
                          
               
                        USBFS_LoadInEP(IN_EP,&str[0],len);   
               
                           
               
                          
               
                    }   
               
                }   
            • 4. Re: end point not transferring data
              user_78878863

              For uploading files, use Firefox or IE, but not Chrome.

                 

              One question: do you have a program running at the other side of your USB connection that actually reads the data? Does the program get stuck on the first time it sends data or only on the second time? (OK, that were now two questions :)

              • 5. Re: end point not transferring data
                prakhar.kumar

                There is no program running on the PC side to read the data. However, i plan to use Labview later.

                • 6. Re: end point not transferring data
                  prakhar.kumar

                  To answer your second question :), it gets stuck at the first run itself and the lcd displays only one value.

                  • 7. Re: end point not transferring data
                    user_78878863

                    I'm not sure how your endpoint is configured. But if there is no one on the PC side to read the data, maybe the PSoC ist just not able so send the buffer fully...

                    • 8. Re: end point not transferring data
                      prakhar.kumar

                       In the project file that i attached in my previous post, the endpoint 1is configured as bulk transfer with packet size of maximum 64 bytes.