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

USB PICF18F4550, WIN 7 64 bit
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MiniMe



Joined: 17 Nov 2009
Posts: 50

View user's profile Send private message

PostPosted: Fri Jan 07, 2011 8:30 am     Reply with quote

matheuslps, Thank You !

You reply helped me much, now I've got virtual PC running on my main Win7 laptop and I managed to fix some issues with Proteus (you might want to re-install Proteus USB driver every time you start the program).
Also thank you for this minimized examples for 18F4550 USB.

Later I will build PCB and will do a reply on my progress.
gmua



Joined: 07 Feb 2011
Posts: 11

View user's profile Send private message

PostPosted: Mon Feb 07, 2011 11:28 am     Reply with quote

matheuslps wrote:
A small program to test the hardware:

Code:
#include <18F4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL1,CPUDIV1,VREGEN                        //For 4Mhz cristal
#use delay(clock=48000000)

#include <usb_cdc.h>

void main()

   usb_cdc_init();   // Start cdc
   usb_init();      // Start USB
   
   for(;;)          //Forever
   {       
      usb_task();     // Test usb
     
      if (usb_enumerated())
      {     
            printf(usb_cdc_putc,"Testando Conexao USB->Serial!\n\r");
            delay_ms (100);
      }
   }
}


Greetings matheuslps, what version of CCS are you using to compile the code?

I am getting the following warnings when I compile it, and when I try to simulate it in Proteus, it doesn't work (the USB analizer shows nothing).

Quote:
>>> Warning 203 "C:\Archivos de programa\PICC\drivers\pic18_usb.c" Line 531(1,1): Condition always TRUE
>>> Warning 216 "USBPROJ.c" Line 24(0,1): Interrupts disabled during call to prevent re-entrancy: (usb_token_reset)
>>> Warning 216 "USBPROJ.c" Line 24(0,1): Interrupts disabled during call to prevent re-entrancy: (usb_tbe)
>>> Warning 216 "USBPROJ.c" Line 24(0,1): Interrupts disabled during call to prevent re-entrancy: (usb_cdc_flush_out_buffer)
Memory usage: ROM=14% RAM=20% - 23%
0 Errors, 4 Warnings.


I have some sample HEX files from other sites that do work, so I'm guessing the problem is with my version of the compiler (I'm using v4.106).

Thanks in advance.
Ttelmah



Joined: 11 Mar 2010
Posts: 19509

View user's profile Send private message

PostPosted: Mon Feb 07, 2011 3:37 pm     Reply with quote

No.
These are _warnings_ only.
They are just pointing out some things that _might_ be potential problems. They are not.
The 'condition always TRUE', comes from the infinite loop to keep the code from dropping off the end. Normal.
The warnings about interrupts being disabled, are because a couple of things in the library call code inside and outside interrupts. Perfectly OK, since the routines involved are short.

Best Wishes
gmua



Joined: 07 Feb 2011
Posts: 11

View user's profile Send private message

PostPosted: Mon Feb 07, 2011 7:16 pm     Reply with quote

Ttelmah wrote:
No.
These are _warnings_ only.
They are just pointing out some things that _might_ be potential problems. They are not.
The 'condition always TRUE', comes from the infinite loop to keep the code from dropping off the end. Normal.
The warnings about interrupts being disabled, are because a couple of things in the library call code inside and outside interrupts. Perfectly OK, since the routines involved are short.

Best Wishes


Thanks for the reply Ttelmah, I compiled the program using version 3.249 and it didn't show any of the warnings, but still doesn't work with Proteus.

The included USB samples in Proteus 7.5 SP3 do work, so I must be connecting something wrong.
geolover



Joined: 08 Feb 2011
Posts: 18

View user's profile Send private message

PostPosted: Tue Feb 08, 2011 6:24 pm     Reply with quote

Thank you matheuslps!


Noob question:
I'm currently trying to implement 18F4550 on Explorer 16 to transmit data to PC with Matlab. It was connected to a 20MHz crystal. How should I reconfigure the code in order to get it working?
Ttelmah



Joined: 11 Mar 2010
Posts: 19509

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 3:10 am     Reply with quote

The USB support with 3.249, differs from that on 4.106, taking less space, but creating the last couple of warnings to do so. The USB libraries for V4, won't work with 3.249. You can turn which warnings are given on/off.
With the standard libraries, these warnings are _normal_.

USB, in Proteus is poor. You _can_ get an occasional small program to work, but more fail than do. I have not got a single 'full scale' program that works in the real world, to work in Proteus. As far as I'm concerned, the USB simulation in Proteus, is not worth wasting time on.

Best Wishes
geolover



Joined: 08 Feb 2011
Posts: 18

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 8:40 am     Reply with quote

Hello! I used the same code but while I'm trying to install the driver I got error code 10. Do you have any idea why?

To be a little bit more specific:

Sometimes the USB CDC could be successfully installed, but however when I try to access it with putty I got unable to configure COM port message, any idea on why this is happening?
neohimura



Joined: 08 Feb 2011
Posts: 14

View user's profile Send private message

PostPosted: Thu Feb 10, 2011 3:24 am     Reply with quote

Hi,
I was able to install the PIC18F4550 USB CDC driver and it works on my laptop with Windows 7 X64. I'm using Visual Basic 2010 to display the data. My problem is the data will freeze after running for ~1 minute. I tried the same codes on a Windows 7 X32 and had the same problem. But it works fine in Windows XP. I tried different value of capacitor for VUSB but no luck. Anyone had this problem?
gmua



Joined: 07 Feb 2011
Posts: 11

View user's profile Send private message

PostPosted: Fri Feb 11, 2011 1:20 pm     Reply with quote

Ttelmah wrote:
The USB support with 3.249, differs from that on 4.106, taking less space, but creating the last couple of warnings to do so. The USB libraries for V4, won't work with 3.249. You can turn which warnings are given on/off.
With the standard libraries, these warnings are _normal_.

USB, in Proteus is poor. You _can_ get an occasional small program to work, but more fail than do. I have not got a single 'full scale' program that works in the real world, to work in Proteus. As far as I'm concerned, the USB simulation in Proteus, is not worth wasting time on.

Best Wishes


Thanks a lot Ttelmah, I guess it was too good to be true about PROTEUS being able to simulate the USB port a 100%, I will have to do it the old fashion way.
gmua



Joined: 07 Feb 2011
Posts: 11

View user's profile Send private message

PostPosted: Wed Feb 16, 2011 7:29 pm     Reply with quote

Ttelmah wrote:
USB, in Proteus is poor. You _can_ get an occasional small program to work, but more fail than do. I have not got a single 'full scale' program that works in the real world, to work in Proteus. As far as I'm concerned, the USB simulation in Proteus, is not worth wasting time on.


Proteus 7.4 SP3 works much better than Proteus 7.5 SP3, I modified and recompiled a C source file (made with CCS version 3.227) with version 4.114 and it worked perfectly (I still got the same normal warnings), the Windows application made with Visual C# 2005 turned the LEDs ON and OFF inside the ISIS simulation like it was supposed to.

The project is a slightly modified version of the PicUSB project found at: http://www.hobbypic.com/

Again, thanks a lot Ttelmah
Bilal



Joined: 24 Apr 2010
Posts: 75
Location: Islamabad

View user's profile Send private message Send e-mail

PostPosted: Sat Mar 12, 2011 8:36 am     Reply with quote

its OK to have a .33nF Capacitance at PIN18 instead of 47uF????
_________________
...
Ttelmah



Joined: 11 Mar 2010
Posts: 19509

View user's profile Send private message

PostPosted: Sat Mar 12, 2011 3:33 pm     Reply with quote

The recommended value, is _not_ 47uF. 0.47uF. Factor of 100 different.
The data sheet requires a minimum of 0.22uF.
_But_ historically quite a few people have found the USB to be unreliable, with the minimum value, so have doubled it, and used 0.47uF, but 0.33, if a good quality capacitor, is well in spec.
So 0.33uF _ought_ the be OK.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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