View previous topic :: View next topic |
Author |
Message |
sstewart
Joined: 16 Aug 2004 Posts: 57
|
Posted: Wed Feb 10, 2016 7:51 pm Post subject: USB shutdown PRGEN XMEGA |
|
|
Is there a method to shutdown the USB module in a XMEGA A4 ? CONFIG POWER_REDUCTION in BASCOM does not seem to address that module, the 40 options in the DAT file don't appear to set USB, and PRGEN isn't in the xm32A4Udef.dat file so I can't set the bit in the PRGEN resister directly.
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Wed Feb 10, 2016 8:30 pm Post subject: Re: USB shutdown PRGEN XMEGA |
|
|
sstewart wrote: | Is there a method to shutdown the USB module in a XMEGA A4 ? |
The ATXMEGA..A4 contain no USB module, what exact device you're refering to?
edit: Ah.., OK, XM32A4U.
edit II: if PRGEN isn't in the dat file, then look up the address in the datasheet and simply add it to the proper dat section. |
|
Back to top |
|
|
sstewart
Joined: 16 Aug 2004 Posts: 57
|
Posted: Thu Feb 11, 2016 9:39 am Post subject: |
|
|
Thought of that, and went though the data sheets. The PR reg is 0x0070, or 112 decimal. This is in the BASCOM DAT file "PR_PR = 112 ; General Power Reduction"
Comparing the DAT file to Atmel's XML, bits 5 and 7 aren't used, bit 6 is the USB. I would suppose that There could / should be a line here,
OPTION7=USB
OPTION7VALUE=[ON,OFF]
Although following Atmel's convention USB would be option 2 and all others would push down numerically. What I can't see is where "Option2" or "Option7" equate to a Hex address or bit location to set a pin, is this in the compiler itself and not a line that can be added to the DAT file ?
It appears a work-around is to set the PRGEN register by it's BASCOM name of PR_PR, and set the bits manually.
By adding PR_PR = 255 I get a current reduction of 0.5mA so I assume it is turning off those modules.
[CONFIG-POWERREDUCTION]
SECTION=POWER_REDUCTION
OPTIONCOUNT=40
OPTION1=POWER_REDUCTION
OPTION1VALUE=[DUMMY]
OPTION2=AES
OPTION2VALUE=[ON,OFF]
OPTION3=EBI
OPTION3VALUE=[ON,OFF]
OPTION4=RTC
OPTION4VALUE=[ON,OFF]
OPTION5=EVSYS
OPTION5VALUE=[ON,OFF]
OPTION6=DMA
OPTION6VALUE=[ON,OFF]
OPTION7=DACA
OPTION7VALUE=[ON,OFF]
This is from the Atmel ATxmega32A4U.xml file.
<register-group caption="Power Reduction" name="PR" size="7">
<register caption="General Power Reduction" name="PRGEN" offset="0x00" size="1">
<bitfield caption="USB" mask="0x40" name="USB"/>
<bitfield caption="AES" mask="0x10" name="AES"/>
<bitfield caption="External Bus Interface" mask="0x08" name="EBI"/>
<bitfield caption="Real-time Counter" mask="0x04" name="RTC"/>
<bitfield caption="Event System" mask="0x02" name="EVSYS"/>
<bitfield caption="DMA-Controller" mask="0x01" name="DMA"/>
</register> |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Feb 11, 2016 10:04 am Post subject: |
|
|
you better not change the dat files.
i see the USB is missing. Tomi will add them.
you can simply do this : PR_PR.6=1
the usb module itself is disabled by default. _________________ Mark |
|
Back to top |
|
|
sstewart
Joined: 16 Aug 2004 Posts: 57
|
Posted: Thu Feb 11, 2016 10:54 am Post subject: |
|
|
Thanks Mark,
It didn't look like patching the DAT file would help, using the PR_PR will work for now. We did get a 0.5mA reduction by turning off all modules, was hoping for more current reduction, which modules are on by default ? |
|
Back to top |
|
|
|