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 CCS Technical Support

Problem with USB_CDC for PIC18F2450

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



Joined: 16 Feb 2006
Posts: 9
Location: Viet Nam

View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

Problem with USB_CDC for PIC18F2450
PostPosted: Wed Sep 24, 2008 10:00 pm     Reply with quote

Hi all,

I'm having a problem with PIC18F2450. I tried to create USB-to-COM with PIC USB. I used example code from CCS compiler, file name: ex_usb_serial.c

When I tried with PIC18F2550, It OK, no problem. PC could recognize the board and virtual COM port created successful Very Happy .

The problem is, when I changed to PIC18F2450 in the code ("#include <18F2550.h>" to "#include <18F2450.h>"), then I compile, there are no error, put HEX file to PIC18F2450 by PICKit2, OK. But the PC can not recognize my USB, nothing happen when I connect usb to PC Sad .

I used the same board for both PIC18F2550 and PIC18F2450.
pls help me to solve this. Thank.
CCS version is 4.057
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Sep 24, 2008 11:28 pm     Reply with quote

Hello,

I'm not aware of other differences between the chips than less memory and some missing peripherals. It seems to me, that the core and USB functions are identical.

However, not recognized means, that the internal pullup resistors triggering the device enumeration aren't activated. If so, some basic initialization of the USB interface is apparently missing. (The device may also have been recognized as a non-operational USB device, did you check that?).

Or it's an unnoticed circuit assembly failure.
linhnc308



Joined: 16 Feb 2006
Posts: 9
Location: Viet Nam

View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

PostPosted: Thu Sep 25, 2008 8:16 pm     Reply with quote

I found the problem. It is because of pic18_usb.h file. I used CCS version 4.057 and it still had this problem. To fix this, find the code like below

Code:
//---pic18fxx5x memory locations
#if defined(__USB_4550__)
   #byte UFRML   =  0xF66
   #byte UFRMH   =  0xF67
   #byte UIR     =  0xF68
   #byte UIE     =  0xF69
   #byte UEIR    =  0xF6A
   #byte UEIE    =  0xF6B
   #byte USTAT   =  0xF6C
   #byte UCON    =  0xF6D
   #byte UADDR   =  0xF6E
   #byte UCFG    =  0xF6F
   #define  UEP0_LOC 0xF70
#else
   #byte UFRML   =  0xF60
   #byte UFRMH   =  0xF61
   #byte UIR     =  0xF62
   #byte UIE     =  0xF5C
   #byte UEIR    =  0xF63
   #byte UEIE    =  0xF5D
   #byte USTAT   =  0xF64
   #byte UCON    =  0xF65
   #byte UADDR   =  0xF5E
   #byte UCFG    =  0xF5F
   #define  UEP0_LOC 0xF4C
#endif


Change the first line from
Code:
#if defined(__USB_4550__)

to
Code:
#if defined(__USB_4550__) || defined(__USB_4450__) 


Because of memory allocation of USB block in 2550 and 2450 is the same, so we should keep it unchange when compile code.
That all,
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