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 CDC communication problem between PIC18F4550 and PC

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



Joined: 04 Sep 2009
Posts: 10

View user's profile Send private message

USB CDC communication problem between PIC18F4550 and PC
PostPosted: Mon May 10, 2010 7:29 pm     Reply with quote

Hi all,

I found that there is a missing byte found when receiving data from PIC18F4550 (in USB CDC).

Problem description:
When C# program is receiving data from 18F4550 in which firmware is written by CCS USB CDC function, there is missing byte found in the received string (around 1 byte lost out of 1 thousand bytes received). It is very strange that missing byte always happened when the data is sent out periodically but not in a burst (see the two C# transmission method in below).

To check whether it is hardware or software problem, same C# program and MCU hardware is used but the MCU firmware is replaced by C18 (modified from CDC -Basic Demo in Microchip's MCHPFSUSB framework). This time no missing byte is found. It is likely the problem come from CCS complier in handling heavy USB IN and OUT tranmission. Is that right? Any suggestion to solve this problem?

Transmission method
PC side (Simple serial port program written in C#):
1. send out 7byte data (e.g. "012345D") in every millisecond and display what is received in the text box. Missing byte found in the received string for CCS USB CDC function.
2. send out a burst of data 7byte x 1000 (e.g. "012345D012345D01245D........") in every second and display what is received in text box. No missing byte found in the received string for CCS USB CDC function.

MCU program (complied by PIC C complier V4.093):
Code:

void main()
{
    .....
    .....
    .....
 
    while(TRUE)
    {
        if (usb_cdc_khbit())
        {
            //send out "012345K" when receiving "D".
            while(usb_cdc_getc()!='D') {}
            printf(usb_cdc_putc, "012345K");
        }
    }
}

Could anyone help me please?

Thank you!
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