USB recognition error - Code included

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USB recognition error - Code included

1,146件の閲覧回数
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,030件の閲覧回数
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,030件の閲覧回数
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 件の賞賛
返信