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.

About the usb port in my PIC

Status
Not open for further replies.

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Currently using the PIC18F25k50 and I want to send data through it's usb port. I'm using the below coding to do usb transmitting:


Code:
 if(!HIDTxHandleBusy(USBInHandle))    
 {    
       USBInHandle = HIDTxPacket(HID_EP,(BYTE*)&ToSendDataBuffer[0],64);    
 }

Is it that my data will straightaway transmit out after it reach the 'HIDTxPacket' function? Or it waits awhile and only send out in the background? How do we know that our protocol got successfully sent out?

I'm sending four protocols out at one time. Protocol A (11 bytes data + 53 bytes 0x00), Protocol B (15 bytes data + 49 bytes 0x00), Protocol C (30 bytes data + 34 bytes 0x00) and Protocol D (11 bytes data + 53 bytes 0x00).

I'm asking this because sometimes my receiver device miss out some data that I transmit out and usually it misses out protocol C which is the one with longest data. So, I don't know it is my usb transmitter problem or it's my receiver problem? Since I don't have the coding for my receiver, I only can check my transmitting part.
 

In my view you should first try CDC (comport communication) class of USB than HID.... Because HID class on PIC can interact with HID class device like mouse , key board etc...... I am not sure you will able to do communication with that...

Good luck
 

In my view you should first try CDC (comport communication) class of USB than HID.... Because HID class on PIC can interact with HID class device like mouse , key board etc...... I am not sure you will able to do communication with that...

Good luck
I successfully do the CDC class before this. It just that I only transmit one protocol after I received one protocol. One in one out... Now, it's without receiving, I only transmit out. And it's four protocols at a time. So, it's zero in and four out.
 

I have solved this problem and apparently I overwrite the usb buffer before I transmit out. That's why the receiver will miss.

Now I got another problem.
I test until some point where the HIDTxHandleBusy(USBHandle) is always set, means the usb always busy and my usb can't transmit anymore. Do you know what cause this? How do I clear it so that I can transmit again?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top