Page 1 of 1

PowerSwitch problem

Posted: Sun Mar 23, 2008 1:18 pm
by johnM
I have modified PowerSwitch source code to use with ATtiny45 and written host computer with Delphi 6 which I have downloaded and modified from http://www.mydarc.de/dg8saq/AVR-USB/
The source I use to toggle a LED on PortB 1.
Every thing OK except when I send a command from computer to toggle LED, the error has occurred every time after third or forth toggle.
Error => Could not find USB device "PowerSwitch" with vid=$16c0 and pid=$5dc!


Here is the source code that I suppose it was caused the problem.
Why I think so?
If I comment all lines that involve PORTB.It works fine.But,if I remove comments it doesn't work, and I got a problem mentioned above.

Code: Select all

else if(rq->bRequest == 1){             // use usbFunctionWrite to transfer len bytes to DDS       
      
      if(toggle){
              PORTB |= 1 << BIT_LED;      /* LED on */
       }else{
              PORTB &= ~(1 << BIT_LED);   /* LED off */
      }
      toggle = ~toggle;
      return 0;
               
   }


Sorry for my English.

Posted: Sun Mar 23, 2008 7:42 pm
by johnM
OK,the problem has been solved.
The error has occurred because I use the USB circuit from EayLogger.
Now I use 3.3V regulator instead using 3.6V zener.It works fine.