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.

Problem in interface of USB with PIC18f4550/PIC18f4455......

Status
Not open for further replies.

sakender

Junior Member level 3
Joined
May 21, 2009
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
PAk
Activity points
1,507
hi
i am working on project of interfacing PIC with PC thorugh USB .i am using MickroC for it but i have some problem regarding this the computer could not rececive any data from device and after a some time it will hang and i have to restart it
any one can help me
 

well, i you post your code and schematics....
 

Re: Problem in interface of USB with PIC18f4550/PIC18f4455..

thanks Kurenai_ryu

i have got another problm that the computer could not recognize my device. the crystal on the board could not send a stable signel, the simulation seem to be perfect but in real hardware it could not work,the computer have detected my device more then 5 time yesterday but could not recognize and does not response
i have attach the schematic
the code is below


#include"C:\Program Files\Mikroelektronika\mikroC\Examples\EasyPic4\extra_examples\HID-library\USBdsc_1.c"
unsigned char Read_buffer[64];
unsigned char Write_buffer[64];

unsigned char num;
void SEND_MDM(unsigned char*);
//
// Timer interrupt service routine
//
void interrupt()
{
HID_InterruptProc(); // Keep alive
TMR0L = 100; // Re-load TMR0L
INTCON.TMR0IF = 0; // Re-enable TMR0 interrupts
}
//
// Start of MAIN program

//
void main()
{
unsigned char data;
ADCON1 = 0xFF; // Set PORTB to digital I/O
TRISB = 0; // Set PORTB to outputs
PORTB = 0; // Clear all outputs
//
// Set interrupt registers to power-on defaults
// Disable all interrupts
//

INTCON=0;
INTCON2=0xF5;
INTCON3=0xC0;
RCON.IPEN=0;
PIE1=0;
PIE2=0;
PIR1=0;
PIR2=0;
//
// Configure TIMER 0 for 3.3ms interrupts. Set prescaler to 256
// and load TMR0L to 100 so that the time interval for timer
// interrupts at 48MHz is 256*(256-100)*0.083 = 3.3ms
//
// The timer is in 8-bit mode by default
//
T0CON = 0x47; // Prescaler = 256
TMR0L = 100; // Timer count is 256-156 = 100
INTCON.TMR0IE = 1; // Enable T0IE
T0CON.TMR0ON = 1; // Turn Timer 0 ON
INTCON = 0xE0; // Enable interrupts
//
// Enable USB port
//
Hid_Enable(&Read_buffer, &Write_buffer);
Delay_ms(100);

num=0;
Delay_ms(100);


while(1)
{

Write_buffer[0]='A';
Write_buffer[1]='B';
Write_buffer[2]='C';
Write_buffer[3]='D';

// Send the number via USB
Hid_Write(&Write_buffer,4);
Delay_ms(100);

num++;

PORTB = 0xff;

}
Hid_Disable();

}

i am using MickroC and a crystal of 8 MHZ
the setting of the MickroC is attched also
 

mmm so you have an hardware issue...

how is that you are sure the crystal is not sending an appropiated signal have you checked with an oscilloscope? have you tested putting out the crystal capacitors? (true! it works sometimes!)

which programmer are you using? is it sending the fuses bit according your selection?

have you disabled the watchdog? [maybe send all the config bytes...]

anyway, your clock selections seems ok...
please check this things and let us know how it's going...
 

Re: Problem in interface of USB with PIC18f4550/PIC18f4455..

i have check it with oscilloscope,the signel from the crystal is not stable the crystal value is 8Mhz some time it send 8Mhz and some time its value become 50hz or any

i am using ALL-100 universal progrmer .
 

Re: Problem in interface of USB with PIC18f4550/PIC18f4455..

HI sakender

I am facing the same problem.Using the same compiler and crystal.Did u find the solution.For me it worked in the beginning.Now its not working.I am attaching my schematic.
 

Attachments

  • SCHEMATIC.pdf
    17.4 KB · Views: 99

Please do these modifications,
1.Connect a 470pF capacitor from PIN18(VUSB) to ground
2.Connect 3 capacitor 0.1uF, 0.01uF and 0.001uF between the power supply (Connect it as close as possible to PIC)
3.Remove the pull-ups from the usb bus (D+ and D-) and also remove the R8 and R9 (its not required for a bus powered device)

this should work.
 

Hello.
I am interested with your project, I went through the code, can you tell me how you run the code in MicroC.. do you have to run it using the microBootloader in MicroC ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top