I use TUSB3210 develop a USB to IIC bridge. I download code from PC. Now my code can receive the first setup packet (get device description).
when I respond the "get device descrition", I can only send first 8 bytes to PC only. The standary packet has 18 bytes.
I write below code in setup interrupt, than I can enter the INT_INPUT_ENDPOINT0 one time.
EP0_in_Buffer0 = 0x12;
EP0_in_Buffer1 = bDescriptorType;
EP0_in_Buffer2 = bcdUSB_L;
EP0_in_Buffer3 = bcdUSB_H;
EP0_in_Buffer4 = bDeviceClass;
EP0_in_Buffer5 = bDeviceSubclass;
EP0_in_Buffer6 = bDeviceProtocol;
EP0_in_Buffer7 = bMaxPacketSize;
IEPCNFG_0 = 0x84; //enable EP0 out and in interrupt
IEPBCNT_0 = 0x08;
I write below code in the INT_INPUT_ENDPOINT0 process code, but I can't enter the interupt once more.
void Ep0InputInterruptHandler(void)
{
IEPBCNT_0 = 0;
OEPBCNT_0 = 0;
IEPCNFG_0 |=STALL;
switch (T_CNT)
{
case 0:
EP0_in_Buffer0 = idVendor_L;
EP0_in_Buffer1 = idVendor_H;
EP0_in_Buffer2 = idProduct_L;
EP0_in_Buffer3 = idProduct_H;
EP0_in_Buffer4 = bcdDevice_L;
EP0_in_Buffer5 = bcdDevice_H;
EP0_in_Buffer6 = iManufacturer;
EP0_in_Buffer7 = iProduct;
IEPCNFG_0 = 0x94;
USBSTA = 0xFFFF;
T_CNT = 1;
// T2 = 0;
break;
case 1:
// T2 = 0;
EP0_in_Buffer0 = iSerialNumber;
EP0_in_Buffer1 = bNumconfigurations;
EP0_in_Buffer2 = 0;
EP0_in_Buffer3 = 0;
EP0_in_Buffer4 = 0;
EP0_in_Buffer5 = 0;
EP0_in_Buffer6 = 0;
EP0_in_Buffer7 = 0;
IEPCNFG_0 = 0x84;
USBSTA = 0xFFFF;
break;
default:
break;
}
}
Could you please give me some advices.