CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

USB not recognised by computer

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
BM92



Joined: 04 Oct 2013
Posts: 18

View user's profile Send private message

USB not recognised by computer
PostPosted: Wed Jan 29, 2014 1:46 pm     Reply with quote

I am using a PIC32MX795F512L in device mode but cannot get it to connect.

So here is a step by step of what is happening to aid with any help people can give.

Before i attach USB cable:

3.3v at Vusb (RF6)
3.3v at Vbus (RF7)
0V at D+ (RG2)
0V at D- (RG3)

After i attach USB

3.7v at Vusb (RF6)
5v at Vbus (RF7)
0V at D+ (RG2)
0V at D- (RG3)

I am unsure why Vusb is getting a voltage increase when it is attached to nothing but a capacitor and 3.3v
The computer is not recognizing that a device is attached and D+ and D- show no activity on oscilloscope

My setup is as follows:

VCC (pin 1) -> vbus (RF7) with 4.7uF cap
GND (pin 4) -> GND
D+ (pin 3) -> RG2
D- (pin 2) -> RG3
3.3v via 100nF cap to Vusb (RF6)
Wire from Vcc to RB5 to trigger USB_BUS_SENSE

i am using interrupt mode and the main part of my code can be seen below

Code:
int main(void)
{   
    InitializeSystem();

    USBDeviceAttach();

    while(1)
    {
        ProcessIO();       
    }//end while
}//end main


Code:
static void InitializeSystem(void)
{
    AD1PCFG = 0xFFFF;
    SYSTEMConfigPerformance(60000000);

    #if defined(USE_USB_BUS_SENSE_IO)
    tris_usb_bus_sense = INPUT_PIN; // See HardwareProfile.h
    #endif

    #if defined(USE_SELF_POWER_SENSE_IO)
    tris_self_power = INPUT_PIN;   // See HardwareProfile.h
    #endif

    UserInit();
   
    USBDeviceInit();   //usb_device.c.  Initializes USB module SFRs and firmware
                   //variables to known states.
}//end InitializeSystem


Code:
void USBDeviceAttach(void)
{
    //if we are in the detached state
    if(USBDeviceState == DETACHED_STATE)
    {
        if(USB_BUS_SENSE == 1)
        {
           //Initialize registers to known states.
            U1CON = 0;         
   
            // Mask all USB interrupts
            U1IE = 0;                               
   
            //Configure things like: pull ups, full/low-speed mode,
            //set the ping pong mode, and set internal transceiver
            SetConfigurationOptions();
   
            USBEnableInterrupts();  //Modifies global interrupt settings
   
            // Enable module & attach to bus
            while(!U1CONbits.USBEN){U1CONbits.USBEN = 1;}
   
            //moved to the attached state
            USBDeviceState = ATTACHED_STATE;
        }
    }
}


Theses are the main snippets of code i believe to be important to get it to connect. Is there any reason why my PC does not recognise my device at all.
Ttelmah



Joined: 11 Mar 2010
Posts: 19469

View user's profile Send private message

PostPosted: Thu Jan 30, 2014 1:42 am     Reply with quote

That is the MicroChip USB stack, not CCS. Go and ask in their forum.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group