2nd ARM Developer Day - NXP USB Workshop

3,475 views
3,222 views

Published on

Published in: Education, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,475
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • LPCXpresso is designed to challenge the notion that ARM development tools are too expensive Includes everything needed to develop a project
  • LPCXpresso is comprised of a software and hardware component Software leverages well established Eclipse development environment Hardware board allows rapid evaluation and development
  • LPCXpresso was created for NXP by: Software: Code Red Hardware: Embedded Artists
  • - Basic (Free) LPCXpresso can be upgraded to accommodate designs requiring more memory and additional debugging capabilities
  • LPCXpresso board combines two components: JTAG debugger using the NXP LPC315x with high-speed USB JTAG (serial wire debugger) operates through the USB port There is also an option to plug in a Cortex debugger using the mini JTAG connectorTarget board can stand-aloneLPCXpresso board designed to cut to separate into two parts
  • Use as a debugger with custom hardware during development Costs less than traditional JTAG debuggers
  • - LPCXpresso is designed to work with the entire design process, not just prototyping
  • - Support community for LPCXpresso
  • Sleep – the system clock to the ARM Cortex-M0 core is stopped, and execution of instructions is suspended until either a reset or an interrupt occurs. Peripherals continue to function and may generate an interrupt to start the clock. The processor state and registers, peripheral registers, and internal SRAM values are maintained, and the logic levels of the pins remain static. Use the wfi() instruction to allow wake-up.Deep-sleep - the system clock to the processor is disabled as in Sleep mode. All analog blocks are powered down, except for the BOD circuit and the watchdog oscillator, which must be selected or deselected during Deep-sleep mode in the PDSLEEPCFG register. In deep-sleep mode, only the watchdog oscillator is available as a clock source. Wake up can be accomplished using an external GPIO pin, a timer match, BODDeep power-down – power and clocks are shut off to the entire chip with the exception of the WAKEUP pin. During Deep power-down mode, the contents of the SRAM and registers are not retained except for a small amount of data which can be stored in the general purpose registers of the PMU block.All functional pins are tri-stated in Deep power-down mode except for the WAKEUP pin. The RESET pin has no functionality in Deep power-down mode.
  • Full and high-speed:K state: differential 0 occurs when D- is greater than D+J state: differential 1 occurs when D+ is greater than D-
  • Our latest ARM [say: “arm”] microcontroller families are based on the highly popular ARM [say: “arm”] Cortex-M cores. Although all our microcontrollers are based on the same ARM [say: “arm”] architecture, we are convinced that one size definitely does not fit all. For this reason, have aligned our MCU portfolio and roadmap very closely with ARM's [say: “arm’s”] roadmap for technology, and have been quick to adopt each new Cortex-M core. In our portfolio the Cortex-M0 [say “M-zero”] families run up to 50 mega-hertz and are directly positioned to replace traditional 8- and 16-bit architectures. The Cortex-M3 [say “M-three”]families, running up to 150 mega-hertz, are high performance microcontrollers designed for maximum bandwidth and connectivity. The most recent Cortex-M4 [say “M-four”] family is a unique new hybrid technology, combining microcontrollers with powerful DSP [say “D-S-P”] extensions.Designers that choose NXP for ARM get more than just one solution; we offer a whole range of pin- and software compatible options aimed to support our customer’s design requirements, now and in future. The LPC1100 [say: “L-P-C-eleven-hundred”] family provides best in class dynamic power consumption as low as 130 micro-amps per mega-hertz. Other LPC1100 [say: “L-P-C-eleven-hundred”] family members offer key peripherals like CAN, USB or a complete analog sub-system. The LPC1200 [say: “L-P-C-twelve-hundred”] family provides memory options up to 128k [say: “128-K”] flash.The LPC1300 [say: “L-P-C-thirteen-hundred”] family is pin- and software compatible to the LPC1100 [say: “L-P-C-eleven-hundred”]. It provides a bridge to out high-performance microcontrollers like LPC1700 [say: “L-P-C-seven-hundred”] and LPC4300 [say: “L-P-C-eighteen-hundred”] that offer key peripherals like USB [say: “U-S-B”], Ethernet and LCD [say: “L-C-D”] as well as large memory options.The LPC4000 [say: “L-P-C-four-thousand”] family is our first Cortex-M4 [say: “M-4”] family. Again, we offer pin- and software compatible solutions through the bridge with the LPC4300 [say: “L-P-C-eighteen-hundred”]. The key advantage from the LPC4000 [say: “L-P-C-four-thousand”] family is the powerful DSP [say: “D-S-P”] extensions that are added to the microcontroller.Please check our website www.nxp.com/microcontrollers for more detail.
  • 2nd ARM Developer Day - NXP USB Workshop

    1. 1. RIT Developer Days
    2. 2. NXP is a leader in ARM Flash MCUs Clear strategy: 100% focus on ARM Top performance through leading technology & architecture Design flexibility through pin- and software-compatible solutions – Scalable memory sizes – Widest range of peripherals Unlimited choice through complete families for multiple cores 2
    3. 3. NXP MCU – the only complete ARM range of Cortex-M0, Cortex-M3, and Cortex-M4 processors NXP ARM Cortex-M Continuum Cortex-M4Cortex-M3Cortex-M0 True 8/16-bit replacement - low power, low cost, higher performance High performance for communication and control - USB, Ethernet, CAN, and much more Advanced Digital Signal control - Floating point unit - Dual-core options $0.65* $7.00* Over 250 different ARM based microcontrollers available!! Entry level Cortex-M0 Fully featured Cortex-M4 (* Recommended price at 10kpcs)
    4. 4. Making USB Plug-and-Play easier with NXP Cortex™-M USB portfolio NXP Semiconductors
    5. 5. LPC1343 LPC11U14 LPC1768 LPC1769 LPC1114 LPC11C24 LPC1227 The NGX baseboard and an LPC1343 LPCXpresso board will be given to each attendee. The baseboard may also be used with mbed. USB Made Easy Training Sessions Devices in red support USB
    6. 6. 6 USB Made Easy
    7. 7. USB is a complex subject. Developing the firmware can be very time consuming. Purchasing specialized equipment may also be required …until now! NXP has made USB simple for many applications. Today, we will show you how we have achieved the ability to develop USB applications with little investment from the user, and with little knowledge about USB.
    8. 8. 8 Development Tools
    9. 9. LPCXpresso Features http://www.nxp.com/lpcxpresso/ LPCXpresso is NXP's low-cost fully integrated development tool platform for the LPC MCU family LPCXpresso is an end-to-end solution for creating applications all the way from initial evaluation to production Tool platform includes – Simplified Eclipse-based IDE (128 kB download limit) – GNU toolchain with optimized libraries – Low-cost target board with JTAG/SWD debugger LPC-link – The target board comes with an integrated JTAG Debugger – No need for a separate JTAG debug probe! 9
    10. 10. NXP’s Low Cost Development Tool Platform Eclipse-based IDE Development Board Evaluation Product Development 10
    11. 11. LPCXpresso Partners Powered by 11
    12. 12. Upgrade Options Code Red – Runtime tracing on Cortex-M3 parts (Profiling, Trace etc.) – Runtime variable manipulation (non-stop debug) – Flash programming utilities New versions available for easier upgrading ($1 per kB!) – Red Suite Xpresso LPC256 : $256 • Full featured Red Suite supporting all LPC parts up to 256kB – Red Suite Xpresso LPC512 : $512 • Full featured Red Suite supporting all LPC parts up to 512kB – Red Suite • Supports unlimited code size on all LPC1000, LPC2000 & LPC3000 Embedded Artists – Base board NGX – Base board 12
    13. 13. LPCXpresso Board Target (LPC1114, LPC11U14, LPC1343, LPC1768, LPC1769, LPC1227) LPC-Link 13
    14. 14. LPC-Link LPC-Link is an integrated JTAG/SWD debug interface based on LPC3154 (ARM9) LPC-Link can be used as a standalone JTAG debugger with other LPC target boards. So, no need for a separate debug probe! LPC-Link makes it possible for users to experience the same user interface all the way to final code development and testing 14
    15. 15. LPCXpresso Development Stages Evaluate Explore Develop 15
    16. 16. NXP Web Support www.nxp.com/lpcxpresso – Main marketing page www.nxp.com/lpcxpresso-forum – Support forum for LPCXpresso www.nxp.com/lpcxpresso-support – Application resources page www.nxp.com/lpczone – Training modules 16
    17. 17. LPC1300 Family 17
    18. 18. 18 LPC1300 Series 72-MHz, 32-bit Cortex-M3™ microcontrollers Low power operation (~200uA/MHz) with three reduced-power modes: Sleep, Deep-sleep, and Deep-power-down Memories – Up to 32kB Flash memory – Up to 8kB SRAM On-chip USB drivers for ISP, MSD, and HID Serial Peripherals – USB 2.0 full-speed device controller with on-chip PHY, UART, SSP, FM+ I²C Analog Peripherals : – 10-bit Analog-to-Digital Converter with eight channels and conversion rates up to 400 kHz Pin-compatible with LPC11U00 (Cortex-M0) new
    19. 19. Setting up the clocks in the LPC134x CGU (Clock Generation Unit) 19
    20. 20. 20 USB Basics
    21. 21. 5m 5m 5m 5m 5m Host Hub Device USB Topology Host – One host per system – Typically the PC in standard USB topology – Can be any device in OTG Hub – Provides connecting ports, power, terminations Peripheral – Slave application – Node – Device Root Hub Host Device Device Device Device Hub 21
    22. 22. USB Bus Topology Tiered star Hub at center of each star Maximum of six segments Each segment 5 meters max. Only a function is allowed in tier 7 Maximum of five non-root hubs Maximum cable length of 30 meters 22
    23. 23. USB Protocol Data Transfer Types Comparison Control Interrupt Bulk Isochronous Max Data bytes/msec in low-speed mode 24 bytes (three 8-byte transactions) 0.8 bytes (8-bytes per 10 msec) no support no support Max Data bytes/msec in full-speed mode 832 (thirteen 64-byte transactions/frame) 64 (one 64-byte transaction/frame) 1216 (nineteen 64-byte transactions/frame) 1023 (one 1023-byte transaction/frame) Max Data bytes/msec in high-speed mode 15,872 (thirty-one 64-byte transactions/microframe) 24,576 (three 1024-byte transactions/microframe) 53,248 (thirteen 512-byte transactions/microframe) 24,576 (three 1024-byte transactions/microframe) Error Correction yes yes yes no Guarantee rate of delivery no no no yes Guranteed time between transfers no yes no yes Typical uses Configuration Mouse, keyboard Printer, scanner Audio, video Note: frame = 1 msec Microframe = 1/8 frame (125 microseconds) 23
    24. 24. USB Dataflow Model Endpoints • Up to 16 endpoints can reside within a device • All USB transfers are targeted to/from a device endpoint • An endpoint is a buffer or FIFO used to transmit or receive data • Although a host has buffers, it does not have endpoints • Each endpoint has a direction and an address • The direction is from the host’s perspective  OUT transactions are to the device  IN transactions are from the device • A Control endpoint is bi-directional, while other endpoints types are not. • Endpoint 0 is always the Control endpoint BulkIn Endpoints Device Host Buffers Dataflow 24
    25. 25. USB Dataflow Model Default Control Pipe • The Default Control Pipe is always a message pipe. • This pipe is always available once a device is powered and has received a bus reset. • Other pipes come into existence when a USB device is configured. • The Default Control Pipe is used by the USB System Software to determine device identification and configuration requirements and to configure the device. • The Default Control Pipe can also be used by device-specific software after the device is configured. BulkIn Endpoints Device Host Buffers Control Pipe 25
    26. 26. USB Device Detection Host/Hub Controller Vcc D+ D- Gnd 15K 15K Vcc D+ D- Gnd Device Controller Current Limiter D+ D- Handshake Detection 0 0 No No Device 1.5K Vreg 26
    27. 27. USB Device Detection Host/Hub Controller Vcc D+ D- Gnd 15K 15K Vcc D+ D- Gnd Device Controller Current Limiter D+ D- Handshake Detection 0 0 No No Device 0 1 No Low-Speed 1.5K Vreg 27
    28. 28. USB Device Detection Host/Hub Controller Vcc D+ D- Gnd 15K 15K Vcc D+ D- Gnd Device Controller Current Limiter D+ D- Handshake Detection 0 0 No No Device 0 1 No Low-Speed 1 0 No Full-Speed D+ D- Handshake Detection 0 0 No No Device 0 1 No Low-Speed 1 0 No Full-Speed 1 0 Yes High-Speed 1.5K Vreg 28
    29. 29. LPC134x Schematics Typical for full-speed USB 29 Oscillator: FS: 12 MHz +/-0.25% (2500ppm) Impedance: 45 ohms Includes the driver (phy) impedance and Rs ESD Protection VBUS input 1.5kOhm pull-up Load capacitors C=2(CL-Cs)
    30. 30. LPC134x Schematics SoftConnect Feature 30 The 1.5kOhm pull-up resistor connected to USB_DP is used to notify the USB host that a USB device has been plugged in The 1.5kOhm resistor can be directly connected to +3V3 (3.0V to 3.6V) if used in a bus-powered application In a self-powered application, it will probably be necessary to use the SoftConnect feature The USB specification states that “The voltage source on the pull-up resistor must be derived from or controlled by the power supplied on the USB cable such that when VBUS is removed, the pull-up resistor does not supply current on the data line to which it is attached.” Power must be removed within 10 seconds. USB_CONNECT is automatically disabled when VBUS is not present
    31. 31. On-Chip USB Driver Benefits Implements USB Device Functions – In-system Programming using Mass Storage Class – Mass Storage Class (MSC) – Human Interface Device (HID) Binary ROM driver circumvents potential tool vendor porting issues Tested and validated USB certified code reduces product development risk What does USB certified mean? 31
    32. 32. 32 Warm-up Exercise: Blinky using the SYSTICK counter
    33. 33. Blinky Exercise LED2 is connected to PIO_7 We want to use the SYSTICK interrupt to generate a 0.5 Hz blink rate We will use the SYSTICKCLKDIV to divide the clock down so we can reach a 1 second interrupt Assume a 72 MHz system clock 33
    34. 34. Blinky Exercise Step 1: Start the LPCXpresso Step 2: Open the Blinky example file Step 3: Open the blinky_main.c file Step 3: Fill in the missing values shown with ???? Note that we will do this exercise together. Step 4: Fill in the Systick interrupt handler (toggle the LED at every interrupt) 34
    35. 35. What have we learned in the Blinky Exercise Use the LPCXpresso to build (your first) project Using the Systick Timer Configure the GPIOs in the LPC134x Interrupts using the Systick Timer 35
    36. 36. 36 Exercise 1 USB In-System Programming (ISP) Without Host Software
    37. 37. Plug the LPC1343 LPCXpresso board into the NGX baseboard The bootloader code is executed every time the part is powered-up or reset. The loader can either execute the ISP command handler or the user application code, or it can obtain the boot image as an attached MSC device through USB. A LOW level during reset at the PIO0_1 (SW5) pin is considered an external hardware request to start the ISP command handler or the USB device enumeration without checking for a valid user code first. The state of PIO0_3 (VBUS) determines whether the UART or USB interface will be used: – If PIO0_3 is sampled HIGH, the bootloader connects the LPC134x as a mass storage class (MSC) USB device to a PC host. The LPC134x flash memory space is represented as a drive in the Windows operating system. –If PIO0_3 is sampled LOW, the bootloader configures the UART serial port and calls the ISP command handler. Note that you can also use the SWD (serial wire debug) interface for programming LPC134x Programming Using On-Chip Drivers 37
    38. 38. 1. Insert the LPC1343 LPCXpresso board onto the NGX baseboard 2. Plug in the USB cable into the NGX baseboard (the USB cable to the debugger does not need to be plugged in) 3. Press the ISP button (SW5) located in the top left corner of the NGX baseboard 4. Press the RESET button (SW4) located below the ISP button 5. Release the RESET button 6. Release the ISP button Using On-Chip Drivers 38
    39. 39. 6. Delete the firmware.bin file 7. Drag the “half_second_blinky.bin” file, from the “Exercise 2 - ISP using USB” folder onto the CRP DISABLED drive 8. If you look in the CRP DISABLED drive, you will see “half_second_blinky.bin” 9. Press the Reset button on the base board 10. LED2 on the LPC1343 LPCXpresso board should now be blinking at a half-second rate 11. Invoke ISP again, then place “Two_second_blinky.bin” on the CRP DISABLED drive. 12. LED2 should be blinking at a much slower rate (two seconds) ISP Using On-Chip Drivers 39
    40. 40. What we learned in Exercise 1 Programming the LPC134x microcontrollers can be done using SWD (Serial Wire Debug), UART, or USB Programming the on-board flash using USB is as simple as drag- and-drop, and is easily achieved by controlling the state of three pins: RESET, PIO0_1 (ISP) and PIO0_3 (VBUS) 40
    41. 41. Exercise 2 Create a USB Device with the On- Chip HID Class Driver
    42. 42. LPC134x HID Device What is a HID device? 1. Data is transferred in structures called Reports - In Reports are used to transfer data to the host - Out Reports are used to transfer data to the device 2. The maximum size of a report is 64 bytes for a full-speed device 3. Data is transferred in structures called Reports - In Reports are used to transfer data to the host - Out Reports are used to transfer data to the device 4. There is no guaranteed rate of transfer. If configured for a specific interval, the time between transactions may be any period equal or less than this period 42
    43. 43. HidDevInfo.idVendor = USB_VENDOR_ID; HidDevInfo.idProduct = USB_PROD_ID; HidDevInfo.bcdDevice = USB_DEVICE; HidDevInfo.StrDescPtr = (uint32_t)&USB_StringDescriptor[0] HidDevInfo.InReportCount = 1; /* Bytes received */ HidDevInfo.OutReportCount = 1; /* Bytes sent */ HidDevInfo.InReport = GetInReport; /* In callback */ HidDevInfo.OutReport = SetOutReport; /* Out callback */ HidDevInfo.SampleInterval = 0x20; /* 32 milliseconds */ DeviceInfo.DevType = USB_DEVICE_CLASS_HUMAN_INTERFACE; DeviceInfo.DevDetailPtr = (uint32_t)&HidDevInfo; (*rom)->pUSBD->init(&DeviceInfo); /* USB Initialization */ LPC134x HID Device Code 1. Set Up USB Driver 43 Fill in the HidDevInfo structure which provides the drivers with product specific information:
    44. 44. LPC134x HID Device Code /* /* Enable Timer32_1 and IOCON and USB block */ LPC_SYSCON->SYSAHBCLKCTRL |= (EN_TIMER32_1 | EN_IOCON | EN_USBREG); /* Use USB PLL and pin init function in ROM */ (*rom)->pUSBD->init_clk_pins(); Call USB_Connect from the ROM coded drivers: (*rom)->pUSBD->connect(TRUE); /* USB Connect */ /* Delegate USB hardware interrupt to on-chip ROM interrupt */ void USB_IRQHandler() { (*rom)->pUSBD->isr(); } 2. Initialize the LPC134x All the code required to develop a HID application can be found in the usbhidrom_main.c file Descriptors can be found in the usbdesc.c file 44
    45. 45. LPC134x HID- String Descriptor The USB string descriptor (usbdesc.c) supplies extended device information to the USB host – Manufacturer = “NXP SEMICOND ” – Product = “NXP LPC1300 HID ” – Serial = “DEMO00000000” – Interface[0] = “HID ” Actual descriptor format (see USB specification) uses Unicode strings C declaration style is more complex than a typical string since it uses Unicode Note that the lengths of the strings should not be changed, unless you change the String Length in the Descriptor! Unicode String 45 String length
    46. 46. LPC134x HID Device Code src[0]= /* On-chip driver callback: Host request for data */ void GetInReport (uint8_t src[], uint32_t length) { src[0] = (LPC_GPIO0->DATA & (1<<1))>>1; /* switch SW5 (PIO0_1) state */ } dst[0] = /* On-chip driver callback: Data sent by host */ void SetOutReport (uint8_t dst[], uint32_t length) { if (dst[0] & 0x001) /* LED2 on PIO0_7 */ LPC_GPIO0->DATA |= (1<<7); else LPC_GPIO0->DATA &= ~(1<<7); } 3. Write Interrupt and In/Out callbacks 46 X X X X X X X SW5 X X X X X X X LED2
    47. 47. LPC134x HID- String Descriptor The LPC1343 LPCXpresso board should be in the NGX baseboard Open the “USB HID rom code.zip” file using the “Import archived projects (zip) Run the program Start the LPC1343 Eval application (in Exercise 2 folder) If you have changed the string descriptors, they should be displayed in the app Press switch SW5 Unicode String 47
    48. 48. What we learned in Exercise 2 Creating a USB HID Class device using the ROM-based drivers in the LPC134x is very simple Code space is saved 48
    49. 49. Exercise 3 Reading an ADC value via the HID interface
    50. 50. Peripheral Driver Libraries All NXP microcontrollers have what we call a Peripheral Driver Library (PDL) which you can use to speed up your development We will use the ADC module 50
    51. 51. USB HID with LEDs and ADC We will only be using the AD5 (PIO1_4) in polling mode 51
    52. 52. USB HID with LEDs and ADC There are only two calls that need to be made to the adc.c file: void ADCInit ( uint32_t ADC_Clk ) /* 4.5 MHz max ! */ uint32_t ADCRead( uint8_t channelNum ) The ADCInit() function initializes all eight ADCs. Since we are only going to use AD5, what changes need to be made to the ADCInit() function (look in the adc.c file)? // LPC_IOCON->JTAG_TDI_PIO0_11 = 0x02; // Select AD0 pin function // LPC_IOCON->JTAG_TMS_PIO1_0 = 0x02; // Select AD1 pin function // LPC_IOCON->JTAG_TDO_PIO1_1 = 0x02; // Select AD2 pin function // LPC_IOCON->JTAG_nTRST_PIO1_2 = 0x02; // Select AD3 pin function // LPC_IOCON->ARM_SWDIO_PIO1_3 = 0x02; // Select AD4 pin function LPC_IOCON->PIO1_4 = 0x01; // Select AD5 pin function // LPC_IOCON->PIO1_10 = 0x01; // Select AD6 pin function // LPC_IOCON->PIO1_11 = 0x01; // Select AD7 pin function 52
    53. 53. USB HID with LEDs and ADC What else do we need to change? 1. InReportCount = 3 2. GetInReport – read the 10-bit ADC (channel 5) - place the lower 8 bits in the second member of the array (src[1]) - place the upper 2 bits of the ADC results in the lower two bits of third member of the array (src[2]) X X X X X X X SW5 AD.7 AD.6 AD.5 AD.4 AD.3 AD.2 AD.1 AD.0 X X X X X X AD.9 AD.8 src[0] src[1] src[2] 53 Note: all items requiring changes are marked with “????”
    54. 54. USB HID with LEDs and ADC 54 An application named “LPC1343_HID_with_ADC.exe” is in the Exercise 3 folder
    55. 55. What we learned in Exercise 3 Adding NXP code library (in this project, it was the ADC) files into a USB project make it relatively simple to add functionality to your code 55
    56. 56. Demonstration 4 Communications Device Class (CDC)
    57. 57. Communications Device Class (CDC) What is CDC? The CD Class defines a set of peripherals such as analog telephones and modems, and other networking devices like Ethernet adapters Windows supports standard CDC devices with the usbser.sys driver Each CDC device should have a unique *.inf file linking it to usbser.sys The Device Descriptor indicates if a device is CDC: 57 /* USB Standard Device Descriptor */ const uint8_t USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0200), /* 2.0 */ /* bcdUSB */ USB_DEVICE_CLASS_COMMUNICATIONS, /* bDeviceClass CDC*/ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(USB_VENDOR_ID), /* idVendor */ WBVAL(USB_PROD_ID), /* idProduct */ WBVAL(USB_DEVICE), /* 1.00 */ /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01 /* bNumConfigurations: one possible configuration*/ };
    58. 58. Communications Device Class (CDC) A CDC device manages device management, call management (optional), and data transmission Data management defines controlling and configuring a device, as well as notifying the host of events Call management is optional but would include functionality such as creating and terminating telephone call or other data connections As the name implies, data transmission is the actual sending and receiving of data, such as phone conversations or modem data Notifications (if implemented) such as ring detect, and network connect/disconnect can use an interrupt or bulk endpoint, however, most use interrupt endpoints The descriptor on the following slide shows that our example code utilizes an interrupt endpoint for Communications Class interface The notifications use an 8-byte header and an variable-length data field 58
    59. 59. Communications Device Class (CDC) 59 /* Interface 0, Alternate Setting 0, Communication class interface descriptor */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_CDC_CIF_NUM, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x01, /* bNumEndpoints: One endpoint used */ CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */ CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass: Abstract Control Model */ 0x00, /* bInterfaceProtocol: no protocol used */ 0x5E, /* iInterface: */ /*Header Functional Descriptor*/ 0x05, /* bLength: Descriptor size */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */ WBVAL(CDC_V1_10), /* 1.10 */ /* bcdCDC */ /*Call Management Functional Descriptor*/ 0x05, /* bFunctionLength */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_CALL_MANAGEMENT, /* bDescriptorSubtype: Call Management Func Desc */ 0x01, /* bmCapabilities: device handles call management */ 0x01, /* bDataInterface: CDC data IF ID */ /*Abstract Control Management Functional Descriptor*/ 0x04, /* bFunctionLength */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype: Abstract Control Management desc */ 0x02, /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */ /*Union Functional Descriptor*/ 0x05, /* bFunctionLength */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_UNION, /* bDescriptorSubtype: Union func desc */ USB_CDC_CIF_NUM, /* bMasterInterface: Communication class interface is master */ USB_CDC_DIF_NUM, /* bSlaveInterface0: Data class interface is slave 0 */ /*Endpoint 1 Descriptor*/ /* event notification (optional) */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(1), /* bEndpointAddress */ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ WBVAL(0x0010), /* wMaxPacketSize */
    60. 60. Communications Device Class (CDC) 60 /* Interface 1, Alternate Setting 0, Data class interface descriptor*/ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_CDC_DIF_NUM, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: no alternate setting */ 0x02, /* bNumEndpoints: two endpoints used */ CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass: Data Interface Class */ 0x00, /* bInterfaceSubClass: no subclass available */ 0x00, /* bInterfaceProtocol: no protocol used */ 0x5E, /* iInterface: */ /* Endpoint, EP3 Bulk Out */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_OUT(3), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ WBVAL(USB_CDC_BUFSIZE), /* wMaxPacketSize = 64 bytes */ 0x00, /* bInterval: ignore for Bulk transfer */ /* Endpoint, EP3 Bulk In */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(3), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ WBVAL(USB_CDC_BUFSIZE), /* wMaxPacketSize = 64 bytes */ 0x00, /* bInterval: ignore for Bulk transfer */ The data is transferred using a Bulk In and a Bulk Out endpoint using the Data Class Interface (only bulk or isochronous may be used)
    61. 61. Communications Device Class (CDC) Demonstration One connection will use the LPC1343 LCPXpresso USB-Serial code while the other will use an off-the-shelf USB-Serial cable The off-the-shelf USB-serial cable can be plugged into the baseboard as shown below User Tera Term to communicate between the two USB-serial connections Set both interfaces to 9600, 8, N, 1 61
    62. 62. Communications Device Class (CDC) Demonstration 62
    63. 63. What we learned in Demonstration 4 USB devices can easily be configured to implement USB-serial converters Windows supports USB-serial converters so no additional driver development is required. Usbser.sys is a standard driver included in Windows. Communications with USB-serial converters can accomplished using any terminal programs, such as Hyperterminal or TerraTerm 63
    64. 64. What new USB projects are we working on?
    65. 65. High-speed USB The LPC1800 family of Cortex-M3 will support high-speed USB host and device The LPC4300 family of Cortex-M4 will support high-speed USB host and device The following classes will be supported in ROM: – In-System Programming (ISP) – Mass Storage (MSC) – Human Interface Device (HID) – Virtual Serial Port (CDC) – DFU (Device Firmware Upgrade) 65
    66. 66. USB Host Stacks (nxpUSBLib) nxpUsbLib is a complete and full function USB software library for all USB equipped LPC processors A complete source code license is available to NXP customers free of charge The three main IDEs will be supported: LPCXpresso, uVision, Ewarm It will be posted and maintained on www.lpcware.com The library includes device, host (OHCI and EHCI), and OTG stacks 66
    67. 67. USB Host Stacks (nxpUSBLib) Host Classes support (goals): – Audio * – CDC – HID – Mass storage * – MIDI – Printer – RNDIS – Still Image * Functional now 67
    68. 68. USB Device Stacks (nxpUSBLib) These stacks run on our full-speed and high-speed controllers All four types of endpoints (control, bulk, interrupt, isochronous) are supported Device Class support (goals) – Audio * – CDC (Communications Device Class) – HID (Human Interface Device) – Mass storage * – MIDI – RNDIS (Remote Network Interface Specification) * Functional now 68
    69. 69. Where to get started? www.nxp.com/ – MCU homepage www.nxp.com/lpczone – Product updates and training www.nxp.com/lpcxpresso – Low-cost development http://www.lpcware.com – MCU community
    70. 70. 7 0
    71. 71. Cortex-M0 Up to 50MHz Cortex-M3 Up to 150MHz Cortex-M4 +150MHz Rapidly growing family of Cortex-M microcontrollers  Check pin- and software compatible options: www.nxp.com/microcontrollers LPC1100L LPC1200 LPC1300 LPC1700 LPC1800 LPC4300 Best-in-class dynamic power consumption, CAN, USB, Segment LCD Memory options up to 128k flash USB solution, incl. on-chip USB drivers High-performance with USB, Ethernet, LCD, and more Memory options up to 1MB flash, 200k SRAM MCU with powerful DSP extensions
    72. 72. Breaking the Price Barrier for USB! 8-bit Up to 40% savings in pricing as compared to typical 8- and 16-bit processors in the market! ~40% 16-bit vs.
    73. 73. Low cost USB solution – Price point starting at $0.99* Smart card interface – Ideal for ecommerce applications Serial Interfaces – 2 SSPs, I2C, UART Integrated power profiles – Runtime power management One stop shop for USB – Evaluation boards, free USB drivers for HID, MSD & CDC, USB certified Miniature 4.5 x 4.5 mm TFBGA48 package – Small form factor for mobile and consumer applications Introducing LPC11U00- Key Features *Starting distribution price at 10K quantities
    74. 74. Bridging Two Great Families Cortex-M0 & Cortex-M3 LPC1300 Cortex-M3 LPC11U00 Cortex-M0 Pin-to-pin and software compatible options between Cortex-M0 LPC1100, LPC11U00 and 72MHz Cortex-M3 LPC1300
    75. 75. 32K Flash, up to 10K SRAM, up to 4K EEPROM LQFP64 package offering Platform for mbed 32K Flash, 6K SRAM Low cost USB Platform for LPCXpreso USB Roadmap for Cortex-M0 LPC11U1x LPC11Uxx LPC11U2x 40-128K Flash, up to 10K SRAM, up to 4K EEPROM Small sector size (256 bytes) LQFP64 package offering Launch in Q3 Launch in Q4 LPC134x Up to 64K Flash, up to 10K SRAM, up to 4K EEPROM Small sector size (256 bytes) LQFP64 package offering Launch in Q4 89
    76. 76. LPC1800 Family- HS USB Fastest speeds: 150 MHz Designed using NXP’s ultra low-leakage 90nm process technology Up to 1 MB Flash – Dual-Bank Flash provides safe in- application programming (IAP) Large SRAM: up to 200 kB SRAM SPI Flash Interface with four lanes and up to 120 Mbps/lane State Configurable Timer Subsystem Two High-speed USB 2.0 interfaces. An on-chip High-speed PHY Pin compatibility with Cortex-M4 parts 120 MHz External Memory Interface with 8 Chip Selects LPC4300 Cortex-M4LPC1800 Cortex-M3 Pin/Peripheral Compatible 90 – 10/100 Ethernet MAC – LCD panel controller (up to 1024H × 768V) – Two 10-bit ADCs and 10-bit DAC at 400ksps – Eight-channel General-Purpose DMA (GPDMA) controller – Motor Control PWM – Quadrature Encoder Interface – 4x UARTs, 2x I2C, 2x I2S, CAN 2.0B, 3x SSP/SPI – Smart card interface – Up to 164 general purpose I/O pins

    ×