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

plse help...rebooting system

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







plse help...rebooting system
PostPosted: Fri Jul 24, 2009 2:26 am     Reply with quote

Code:
#include<18F2550.h>

#define __USB_PIC_PERIF__ 1
#define LED1 PIN_B4                       //Previously it was "DEFINE"

#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)

#build(reset=0x1, interrupt=0x8)          // Necessary for Bootloader
//#ORG 0x0F00,0x0FFF {}                     // Necessary for Bootloader
//#use rs232(stream=PC, baud=9600, xmit=PIN_C6, rcv=PIN_C7)

//Tells the CCS PIC USB firmware to include HID handling code. 
//#define USB_HID_DEVICE  TRUE              //Previously it was "DEFINE"

//the following defines needed for the CCS USB PIC driver to enable the TX endpoint 1   
// and allocate buffer space on the peripheral   
//#define USB_EP1_TX_ENABLE  USB_ENABLE_INTERRUPT   //turn on EP1 for IN bulk/interrupt transfers   
//#define USB_EP1_TX_SIZE    8                      //allocate 8 bytes in the hardware for transmission   
   
//the following defines needed for the CCS USB PIC driver to enable the RX endpoint 1   
// and allocate buffer space on the peripheral   
//#define USB_EP1_RX_ENABLE  USB_ENABLE_INTERRUPT   //turn on EP1 for OUT bulk/interrupt transfers   
//#define USB_EP1_RX_SIZE    8  //allocate 8 bytes in the hardware for reception   
 
// CCS USB Libraries
#include <pic18_usb.h>          //Microchip 18Fxx5x hardware layer for usb.c
#include <usb_desc_hid.h>       //USB Configuration and Device descriptors for this UBS device
#include <usb.c>                //handles usb setup tokens and get descriptor reports


#define LED_ON output_high 
#define LED_OFF output_low

void main() {
//   int8 out_data[20];   
//   int8 in_data[2];   
//   int8 send_timer=0;
   usb_init();
   LED_ON(LED1);
   usb_task();      //USB_ATTACH
//   usb_wait_for_enumeration();
   if(usb_enumerated()){
     LED_OFF(LED1);
     delay_ms(1000);
     LED_ON(LED1);   
     }
   else {  LED_ON(LED1);}

}

This code causes system to reboot
29MHz Oscillator
LED on Pin B4
2 warnings:

>>> Warning 203 "C:\PROGRA~1\PICC\drivers\pic18_usb.h" Line 436(1,1): Condition always TRUE
>>> Warning 216 "exp_USB_LED.c" Line 53(1,2): Interrupts disabled during call to prevent re-entrancy: (usb_token_reset)
Ttelmah
Guest







PostPosted: Fri Jul 24, 2009 2:41 am     Reply with quote

Don't multiple post....
What chipset is on the PC, what operating system?.
There is a PC bug, with some Via chipsets, with particular drivers, which will cause a lockup/crash. The drivers supplied by the motherboard manufacturer, rather than the ones that come with Windows, usually fix this. There is also a problem with particular revisions of Intel chipset. Normally this hangs the system, rather than completely crashing it though.....

Best Wishes
sumith
Guest







PostPosted: Fri Jul 24, 2009 3:17 am     Reply with quote

I am sorry. Windows Operating system(XP also in vista too). Is it due to the device firmware or hardware? I am using pic18f2550 and I modified ex_usb_hid.c code.
Ttelmah
Guest







PostPosted: Fri Jul 24, 2009 4:51 am     Reply with quote

It is the USB chipset in the _PC_ I am talking about.
The fault exists with other devices as well, it is just that 'most' don't cause it.
Do a google search on 'VIA USB chipset reboots system'.
It may not a problem at the PIC end at all...

Best Wsihes
sumith
Guest







PostPosted: Fri Jul 24, 2009 5:03 am     Reply with quote

But the same problem arise when i connected to my laptop also???Actually its not reboot,System crashed???I will check that also usb Chip set???Thank u for replying
sumith
Guest







PostPosted: Fri Jul 24, 2009 5:28 am     Reply with quote

There is no problem with other USB Devices. Here we are using USB thumb drive daily. I also don't know which chip set is using. Sad


Thank u..................
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 24, 2009 11:59 am     Reply with quote

It looks like you are trying to make an HID USB program.
I assume this is your first USB project. I suggest that you
try the CCS HID demo first. Get that working, then try
your own code. See the link below.

In this post, I provide a "walk through" for the CCS Hiddemo example.
It has tips to make the demo work with a 18F4550:
http://www.ccsinfo.com/forum/viewtopic.php?t=38897
sumith
Guest







PostPosted: Fri Jul 24, 2009 10:31 pm     Reply with quote

Thank you for replying.....Actually it was problem with my chipset, not in the code...once again thank u
ibsumith



Joined: 24 Jul 2009
Posts: 21

View user's profile Send private message

ibsumith
PostPosted: Sat Jul 25, 2009 3:13 am     Reply with quote

My system contains Intel chipset....So what to do???
ibsumith



Joined: 24 Jul 2009
Posts: 21

View user's profile Send private message

sumith
PostPosted: Sat Jul 25, 2009 4:09 am     Reply with quote

>>> Warning 203 "C:\PROGRA~1\PICC\drivers\pic18_usb.h" Line 436(1,1): Condition always TRUE
>>> Warning 216 "exp_USB_LED.c" Line 53(1,2): Interrupts disabled during call to prevent re-entrancy: (usb_token_reset)


What about these two warnings????
socerba



Joined: 25 Jul 2009
Posts: 5

View user's profile Send private message

PostPosted: Sat Jul 25, 2009 12:27 pm     Reply with quote

I have the same problem on Windows XP with example usb_kbmouse.
I have a blue of screen on usbport.sys. In my Windows XP the automatic reboot is disabled.

The problem are in the code, I create the project and modified some files. In my changes I removed some defines for error:
Code:

#define __USB_PIC_PERIF__ 1

//Tells the CCS PIC USB firmware to include HID handling code.
#DEFINE USB_HID_DEVICE  TRUE

//the following defines needed for the CCS USB PIC driver to enable the TX endpoint 1
#define USB_EP1_TX_ENABLE  USB_ENABLE_INTERRUPT   //turn on EP1 for IN bulk/interrupt transfers
#define USB_EP1_TX_SIZE 8

#define USB_EP2_TX_ENABLE  USB_ENABLE_INTERRUPT   //turn on EP2 for IN bulk/interrupt transfers
#define USB_EP2_TX_SIZE 8

#define USB_EP2_RX_ENABLE  USB_ENABLE_INTERRUPT   //turn on EP2 for IN bulk/interrupt transfers
#define USB_EP2_RX_SIZE 4

and so without the defines the PIC produce an bad error on Windows XP, and simple error on Linux.

I have seen in your code the define are comments.
Ttelmah
Guest







PostPosted: Sat Jul 25, 2009 12:50 pm     Reply with quote

First key thing to undertsand, is that if the USB drivers are written 'properly', it should never be possible to crash the PC, with anything on the USB bus!...
Basically, it should be possible to hang the USB, or lose communication, but resetting the system, is always a sign of a fault in the PC driver. The fault may be _trigerred_ by something a USB device is doing, but actually resetting, is really always a faulty PC driver.
The two drivers that are 'known' to have problems, are those for a couple of VIA chipsets, and for a couple of Intel chipsets. In both cases, the drivers from the chipset manufacturers actually fix the problem. So (for example), there is an Intel driver, for use with systems that don't have a supplied driver, loading this (and ignoring the message that this is only for systems without a supplied MS driver), fixes the Intel chipset problems.
MS also have a rather large number of fixes for the USB drivers, 'beyond' the ones they admit to. For some chipsets, they have a fix available 'on request', if you report certain problems, which updates both the driver, and part of the USB stack. One part of this was included in the latest service packs, but part is still not 'standard'. One part of this fix, also massively improves the performance of some USB devices....

Best Wishes
sumith
Guest







PostPosted: Sat Jul 25, 2009 10:03 pm     Reply with quote

Thank you for your reply........... Smile
ibsumith



Joined: 24 Jul 2009
Posts: 21

View user's profile Send private message

PostPosted: Mon Jul 27, 2009 12:46 am     Reply with quote

I tried it with disabling automatic reboot on error....And I am able to locate USBPORT.SYS file is the causing error.
Guest








PostPosted: Mon Jul 27, 2009 4:32 am     Reply with quote

Smile Laughing
Thank You its nw working...It was problem with definitions which I Commented.Once agan thank u.... Very Happy
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