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

Request: USB HID Test code for 18LF14K50 12MHz [Solved]
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 18219

View user's profile Send private message

PostPosted: Tue Jan 11, 2022 12:38 pm     Reply with quote

Have you got USB_CONNECTION_SENSE wired and enabled?.
This is actually _required_ by the USB specs. You can only run without it
on a device that is USB powered.
If this is correctly setup, the USB port will automatically power down when
the cable is unplugged.
FFT



Joined: 07 Jul 2010
Posts: 92

View user's profile Send private message

PostPosted: Tue Jan 11, 2022 12:51 pm     Reply with quote

OK, I have the USB detect pin enabled.

Here is the result:
I didn't touch on USB side at all.
Changed my previous config to following one:
Code:
// configure 12MHz clock for USB operation and 48Mhz CPU operation
#fuses HS
//#fuses PLLEN   //enable pll, we can now use CPUDIVx fuses
//#fuses CPUDIV1 //CPU clock set to 48MHz
//#fuses USBDIV2 //when using low speed USB, need to divide 12MHz by 2.  this fuse has no effect when using full speed.

//#use delay(clock=48000000, restart_wdt) // 48Mhz
//#use delay(clock=48MHz, crystal=12MHz, USB_FULL, restart_wdt) // 48Mhz
#use delay(clock=12MHz, crystal=12MHz, USB_FULL, restart_wdt) // 12Mhz

Respectively reconfigured other modules such as timers etc..
Current consumption is now 6.4mA at 12Mhz

It draws 11.6mA at 48Mhz setup.

@temtronic, it looks more than 20%.

My whole question was "how to reduce clock frequency" since #fuses confused me. It is as easy as a #use delay parameter.
I just asked this and found by myself.

You cannot get some basic questions Smile
Inability to think simple.
temtronic



Joined: 01 Jul 2010
Posts: 8572
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 11, 2022 1:58 pm     Reply with quote

Glad it's working for you.
As a test though, it'd be interesting for you to use the internal RC clocks and see if power can be reduced even further.
By not having the primary osc/12MHz xtal/caps, it should use less power.
Ttelmah



Joined: 11 Mar 2010
Posts: 18219

View user's profile Send private message

PostPosted: Wed Jan 12, 2022 7:21 am     Reply with quote

The figures you have, suggest that the PIC is doing quite a few things
that are drawing extra power over the basic chip operation. The 'delta'
between 12MHz, and 48MHz, in the actual CPU consumption, is about
6 to 7mA, which is pretty much what you are seeing. It is perhaps worth
looking for other things that may be wasting power. Typical list:

Whatever regulator you are using for the 3.3v supply. Some of these
waste a significant power....
Make sure you have no PIC pins left floating.
Make sure where possible, pins are driven to high or low, whichever
draws the least power on the attached devices.
Look carefully at whether attached devices can be powered down when
not in use.

Well done in moving to 'half power'. Smile
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 Previous  1, 2, 3, 4
Page 4 of 4

 
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