Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Pic32 and USB cdc basic demo problem

Status
Not open for further replies.

nick703

Advanced Member level 1
Joined
Oct 17, 2011
Messages
422
Helped
21
Reputation
44
Reaction score
22
Trophy points
1,298
Location
surat
Activity points
3,987
hello friends,
i have a micro pic32 and configure as a cdc basic demo using microchip Mal library. everything working as a fine using pc to pic and pic to pc communication using echo back service of usb cdc function. but when my pc restart and open c# application then my communication is hang and only solution is remove usb cable and attache usb cable. so i don't like this type of communication where every first time usb cable remove and attache again so is there any hardware or software problem? please give me some hint?
 

Try to Debug your Problem, using any in-circuit debugger.
And if possible post your code and provide additional information like which controller of PIC32 you are using.

I had implement PIC32 CDC class without any problem on mikroelektronika MINi PIC32 Board
 

hi xpress_embedo

thanks for reply my micro is pic32mx575f256h . and my code is based on AN1164 application . in this application is only half duplex mode am i right ya wrong ? so i think that is my problem when my pc restart then usb cable throug micro always power up and after comuper start then windows form application not communicate to micro. so is there any way to transfer half duplex mode to full duplex or any other solution ?
 

Code:
switch (gState)
{
case BUFFER_EMPTY: // Buffer is empty & available to receive data.
// If the buffer is free, read any available data.
if (USBUSARTRxIsReady())
{
gState = RECEIVING_DATA;
USBUSARTRx(gBuffer, BUFFER_SIZE);
}
break;
case RECEIVING_DATA: // App is waiting to receive data from USB.
// Check to see if we have data yet.
if ( (gSize = USBUSARTRxGetLength()) > 0 )
{
gState = DATA_AVAILABLE;
// Intentional Fall Through! Avoids unnecessary loop iteration.
}
else
{
break;
}
case DATA_AVAILABLE: // Data has been received, app can act on the data.
// If the transmitter is ready, echo the data back to the host.
if (USBUSARTTxIsReady())
{
gState = SENDING_DATA;
USBUSARTTx(gBuffer, gSize);
}
break;
case SENDING_DATA: // App is waiting to finish sending data on USB.
// If we’re done transmitting, free up the buffer to receive new data.
if (USBUSARTTxIsReady()) {
gSize = 0;
gState = BUFFER_EMPTY;
}
break;
default:
while(1); // Invalid state, hang the application.
}

ok my code is based on an1164 application.
 

Is that any problem if i power up my controller throw USB connector ? i used 5v to 3.3 v converter so when my pc restart that time my usb port is powered up and at that time also controller is powered up so i think that time my controller need to be a restart . is there any way to controller restart if my system is restart not use on MCLR throw a switch?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top