USB recognition error - Code included

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USB recognition error - Code included

1,142 次查看
AdnanNovak
Contributor I

Hey:

 

How come a few lines of code in my program is not letting windows recognize my board even though the code is not even being run. Its using the CMX-USB stack.

 

-Tic Counter is a timer intterupt.

-Sending bits back and forth between my board and PC

 

Here is the code :

 

ticCounter = 0  ;
            while ( ticCounter < 10 )
              {  }
               
                hid_write_report(in_report, &opcode2[0]);
               
                hid_process();
                   
                ticCounter = 0  ;
            while ( ticCounter < 10 )
              {  }
             
              while (!hid_report_pending(out_report))
              {
                    
              }
               
             ticCounter = 0  ;  
             while ( indata[0] != 0xc0 && ticCounter < 100   )
             {
             
                hid_read_report(out_report, &indata[0]);
                
             }
                 
             ticCounter = 0  ;
            while ( ticCounter < 10 )
              {  }
             
              hid_write_report(in_report, &opcode2[8]);
               
                hid_process();
      
                         
                ticCounter = 0  ;
            while ( ticCounter < 10 )
              {  }
             
              while (!hid_report_pending(out_report))
              {
                    
              }
             
             ticCounter = 0  ;  
             while ( indata[0] != 0xc1 && ticCounter < 100   )
             {
             
                hid_read_report(out_report, &indata[0]);
                
             }

 

Everytime I comment this portion of my code out, my USB is correctly recognized by windows but with this code in, my fails to initialize in windows. This portion of my code is not even supposed to be reached without a command from the PC. How can this inured code cause this? I can give more information. Thanks

标签 (1)
0 项奖励
回复
2 回复数

1,026 次查看
Tsuneo
Contributor IV

I have an impression that the code does nothing so bad.
Overflow of the code or RAM space?
Or, stack overflow, if the code is called from USB ISR.

You may confirm it with a map; file.


Tsuneo

0 项奖励
回复

1,026 次查看
JimDon
Senior Contributor III

With out seeing all the code, I would ask if this code runs before the device is done intializing.

If you try to send data before it is ready, it will crash and not be recognised.

 

0 项奖励
回复