??? 06/12/08 05:50 Read: times |
#155722 - Timer 0 Interrupt problem EZ-USB FX2LP(CY7C68013a) |
Hi There,
Currently i am developing a usb to parallel interfacing devece using Cypress EZ-USB FX2LP(CY7C68013a) controller. this controller having a 8051 mcu in its core. This controller is having 8052 standard interrupts as well as usb specific additional interrupts. I am able to use usb specific interrupts and 8052 standard interrupts individually. But while i use both type of interrupts(timer 0 and USBINT) together, both of them are not working. Detail explanation with code given below. i have written a timer-0 ISR as follows. --------------------------------------------------------------------------------------------------- void isr_timer(void) interrupt 1 using 1{ BYTE i; TR0 = 0; // printf("i"); sendtoPC("Interrupted"); TF0=1; TR0 = 0; } ------------------------------------------------------------------------------------------- and timer initialization function as follows -------------------------------------------------------------------------------------------- void init_timer0(){ TMOD = TMOD | 0x01; TH0 = 0xff; TL0 = 0xf0; // starts Timer 0 PT0 = 0; ET0 = 1; EA = 1; TR0 = 1; } ----------------------------------------------------------------------------------------------------------------- The printf() and sendtoPC() function is used to print a string in hyper terminal. On executing Independently this two functions are working fine. But when i am inserting it in bulkloop code(cypress sample code uses USBINT interrupts) it is failing to enumerate and the message from ISR is not printing in hyper terminal. I have modified the bulkloop code as follows.. ----------------------------------------------------------------------------------------------------------------- void main(void) { DWORD i; WORD offset; DWORD DevDescrLen; DWORD j=0; WORD IntDescrAddr; WORD ExtDescrAddr; // BYTE loc; // BYTE k; // Initialize Global States Sleep = FALSE; // Disable sleep mode Rwuen = FALSE; // Disable remote wakeup Selfpwr = FALSE; // Disable self powered GotSUD = FALSE; // Clear "Got setup data" flag setup_uart(); //setup the serial communication with PC. sendtoPC("Hello"); //test message TD_Init(); init_timer0(); //initialize timer _ _ _ _ _ _ _ _ ------------------------------------------------------------------------------------------- without calling the init_timer0() function it is enumerating finely but after calling init_timer0() is detecting as unknown device, after debugging i came to know that SetupCommand(); function is not calling i.e. ISR_Sudav interrupt is not occurring . So please explain me why this timer interrupt is affecting USB interrupts (Sudav, sutok..etc). How to use a timer interrupt with bulkloop code. Thanks in advance. Warm Regards rishi |