TWR-K60N512-KEIL Freescale Semiconductor, TWR-K60N512-KEIL Datasheet - Page 125

no-image

TWR-K60N512-KEIL

Manufacturer Part Number
TWR-K60N512-KEIL
Description
K60N512 Keil Tower Kit
Manufacturer
Freescale Semiconductor
Series
Kinetisr
Type
MCUr

Specifications of TWR-K60N512-KEIL

Rohs Compliant
YES
Contents
4 Boards, Documentation, DVD
Peak Reflow Compatible (260 C)
Yes
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
Freescale Tower System, K60N512
The function that returns the charger type result is:
UINT8 DCD_GetChargerType(void)
{
}
The DCD interrupt service routine:
Freescale Semiconductor
2. Next, enable the USB and the DCD clock gating bits in the SIM.
3. Pre-initialize the USB. This is required to enable the pullup resistor that is controlled
4. Configure the DCD clock register.
5. At this point the application is polling the PTB0 pin for VBUS detection, but a port
6. Finally, when the detection sequence is completed the application needs to read the
UINT8 u8ChargerType;
u8ChargerType = (UINT8)((USBDCD_STATUS & USBDCD_STATUS_SEQ_RES_MASK)>>16);
u8ChargerType|= (UINT8)((USBDCD_STATUS & USBDCD_STATUS_FLAGS_MASK)>>16);
return(u8ChargerType);
by the USB module.
interrupt can also be used to avoid polling method.
results in the DCD registers and send them to the terminal.
/* SIM Configuration */
SIM_SCGC4|=(SIM_SCGC4_USBOTG_MASK);
SIM_SCGC6|=(SIM_SCGC6_USBDCD_MASK);
// USB pre-initialization
USBOTG_USBTRC0|=USBOTG_USBTRC0_USBRESET_MASK;
while(FLAG_CHK(USBOTG_USBTRC0_USBRESET_SHIFT,USBOTG_USBTRC0)){};
FLAG_SET(USBOTG_ISTAT_USBRST_MASK,USBOTG_ISTAT);
// Enable USB Reset Interrupt
FLAG_SET(USBOTG_INTEN_USBRSTEN_SHIFT,USBOTG_INTEN);
USBOTG_USBCTRL=0x00;
USBOTG_USBTRC0|=0x40;
USBOTG_CTL|=0x01;
USBDCD_CLOCK=(DCD_TIME_BASE<<2)|1;
// DCD results
// Waiting for VBUS
if(FLAG_CHK(0,GPIOB_PDIR) && !FLAG_CHK(VBUS_Flag,gu8InterruptFlags))
{
}
if(FLAG_CHK(DCD_Flag,gu8InterruptFlags))
{
USBDCD_CONTROL=USBDCD_CONTROL_IE_MASK
FLAG_SET(USBDCD_CONTROL_START_SHIFT,USBDCD_CONTROL);
FLAG_SET(VBUS_Flag,gu8InterruptFlags);
u8Error=DCD_GetChargerType();
if((u8Error&0xF0))
else
{
}
printf("Oooooops DCD Error");
if((u8Error&0x0F)==STANDARD_HOST)
if((u8Error&0x0F)==CHARGING_HOST)
if((u8Error&0x0F)==DEDICATED_CHARGER)
Kinetis Quick Reference User Guide, Rev. 0, 11/2010
printf("Connected to a Standard Host");
printf("Connected to a Charging Host");
printf("Connected to a Dedicated Charger");
Chapter 13 USB Device Charger Detection (USBDCD) Module
| USBDCD_CONTROL_IACK_MASK;
// USB Clock Gating
// USB Clock Gating
125

Related parts for TWR-K60N512-KEIL