Today while working on C4-Protocol example, i made some changes in code as shown below
while (1)
{
// Check the USB state and directly main loop accordingly
switch (USB_getConnectionState())
{
// This case is executed while your device is enumerated on the
// USB host
case ST_ENUM_ACTIVE:
if(bCDCDataReceived_event)
{
ECGTxPacket[0] = 0x02; //Start of packet
ECGTxPacket[1] = 0x10; // Acquire header
ECGTxPacket[2] = (unsigned char)(0x33);
ECGTxPacket[3] = (unsigned char)(0x34);
ECGTxPacket[4] = 0x03;
ECGTxPacket[5] = 0x03; //endof packet
ECGTxPacket[6] = '\n';
USBCDC_sendDataInBackground((uint8_t*)&ECGTxPacket,7,CDC0_INTFNUM,0); // Send the response over USB
USBCDC_abortSend(&x,CDC0_INTFNUM);
bCDCDataReceived_event = FALSE;
}
break;
// These cases are executed while your device is disconnected from
// the host (meaning, not enumerated); enumerated but suspended
// by the host, or connected to a powered hub without a USB host
// present.
case ST_PHYS_DISCONNECTED:
case ST_ENUM_SUSPENDED:
case ST_PHYS_CONNECTED_NOENUM_SUSP:
__bis_SR_register(LPM3_bits + GIE);
_NOP();
break;
// The default is executed for the momentary state
// ST_ENUM_IN_PROGRESS. Usually, this state only last a few
// seconds. Be sure not to enter LPM3 in this state; USB
// communication is taking place here, and therefore the mode must
// be LPM0 or active-CPU.
case ST_ENUM_IN_PROGRESS:
default:;
}
} // while(1)
Here on 1 char receive i am sending 7 byte packet. But after two RX and TX i am not able to do even RX/TX. Control goes to always
case ST_PHYS_CONNECTED_NOENUM_SUSP:
__bis_SR_register(LPM3_bits + GIE);
_NOP();
While debug i saw control never goes to USB interrupt at all. How to come out of this ? Whether i am doing any wrong thing here?
What could be the reason?
Please suggest me.
Nitesh