USB recognition error - Code included

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB recognition error - Code included

428 Views
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

Labels (1)
0 Kudos
2 Replies

312 Views
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 Kudos

312 Views
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 Kudos