<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: USB ROM: hard fault when using composite device in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523340#M5976</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cneubert on Tue Dec 01 05:50:49 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Further tests showed me, that the ROM code only accepts EPs 0x01 and 0x81, when I use 0x02 and 0x82 I get a hardfault in the ROM code and with 0x03/83 and 0x04/84 I get an ERR_USBD_BAD_EP_DESC when I call "USBD_API-&amp;gt;hid-&amp;gt;init".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody help me?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a better free USB stack available for a LPC1857 I can use?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tested the Keil stack and with it I can get one USB device to running, but as I can´t find a compatible example for my mcu I couldn´t test it with a composite device.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:44:58 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:44:58Z</dc:date>
    <item>
      <title>USB ROM: hard fault when using composite device</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523338#M5974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cneubert on Mon Nov 30 07:44:17 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I´m using LPCXpresso 7.9.0, LPC1857 and USB1 as interface.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can run the MSC RAM and HID Generic examples without problems, but I can´t get both to run in a composite device. I can´t test the example of LPCOpen, because our hardware does only have the USB1 interface to use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try to run my composite device code, the USB ROM code hard faults and because there is no source for this code, I don´t know how to look for the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I´m right then the code crashes when the host sends a CONFIGURATION REQUEST to my device (I got this from wireshark).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my config descriptor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
/* Configuration 1 */
USB_CONFIGURATION_DESC_SIZE,/* bLength */
USB_CONFIGURATION_DESCRIPTOR_TYPE,/* bDescriptorType */
WBVAL(/* wTotalLength */
1 * USB_CONFIGURATION_DESC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +
USB_INTERFACE_DESC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +/* MSC interface */
2 * USB_ENDPOINT_DESC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +/* bulk endpoints */
USB_INTERFACE_DESC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +
HID_DESC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +
2*USB_ENDPOINT_DESC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +
0
),
0x02,/* bNumInterfaces */
0x01,/* bConfigurationValue */
0x00,/* iConfiguration */
USB_CONFIG_SELF_POWERED,/* bmAttributes */
USB_CONFIG_POWER_MA(100),/* bMaxPower */

/* Interface 0, Alternate Setting 0, MSC class interface descriptor */
USB_INTERFACE_DESC_SIZE,/* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE,/* bDescriptorType */
USB_MSC_IF_NUM,/* bInterfaceNumber: Number of Interface */
0x00,/* bAlternateSetting: Alternate setting */
0x02,/* bNumEndpoints: Two endpoints used */
USB_DEVICE_CLASS_STORAGE,/* bInterfaceClass: Communication Interface Class */
MSC_SUBCLASS_SCSI,/* bInterfaceSubClass: Abstract Control Model */
MSC_PROTOCOL_BULK_ONLY,/* bInterfaceProtocol: no protocol used */
0x04,/* iInterface: */

/* Endpoint, EP Bulk In */
USB_ENDPOINT_DESC_SIZE,/* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE,/* bDescriptorType */
USB_MSC_IN_EP,/* bEndpointAddress */
USB_ENDPOINT_TYPE_BULK,/* bmAttributes */
WBVAL(USB_FS_MAX_BULK_PACKET),/* wMaxPacketSize */
0x00,/* bInterval: ignore for Bulk transfer */
/* Endpoint, EP Bulk Out */
USB_ENDPOINT_DESC_SIZE,/* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE,/* bDescriptorType */
USB_MSC_OUT_EP,/* bEndpointAddress */
USB_ENDPOINT_TYPE_BULK,/* bmAttributes */
WBVAL(USB_FS_MAX_BULK_PACKET),/* wMaxPacketSize */
0x00,/* bInterval: ignore for Bulk transfer */

/* Interface 1, Alternate Setting 0, HID Class */
USB_INTERFACE_DESC_SIZE,/* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE,/* bDescriptorType */
USB_HID_IF_NUM,/* bInterfaceNumber */
0x00,/* bAlternateSetting */
0x02,/* bNumEndpoints */
USB_DEVICE_CLASS_HUMAN_INTERFACE,/* bInterfaceClass */
HID_SUBCLASS_NONE,/* bInterfaceSubClass */
HID_PROTOCOL_NONE,/* bInterfaceProtocol */
0x05,/* iInterface */
/* HID Class Descriptor */
/* HID_DESC_OFFSET = 0x0012 */
HID_DESC_SIZE,/* bLength */
HID_HID_DESCRIPTOR_TYPE,/* bDescriptorType */
WBVAL(0x0111),/* bcdHID : 1.11*/
0x00,/* bCountryCode */
0x01,/* bNumDescriptors */
HID_REPORT_DESCRIPTOR_TYPE,/* bDescriptorType */
WBVAL(sizeof(HID_ReportDescriptor)),/* wDescriptorLength */
/* Endpoint, HID Interrupt In */
USB_ENDPOINT_DESC_SIZE,/* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE,/* bDescriptorType */
HID_IN_EP,/* bEndpointAddress */
USB_ENDPOINT_TYPE_INTERRUPT,/* bmAttributes */
WBVAL(0x0004),/* wMaxPacketSize */
0x08,/* 16ms */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* bInterval */
/* Endpoint, HID Interrupt Out */
USB_ENDPOINT_DESC_SIZE,/* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE,/* bDescriptorType */
HID_OUT_EP,/* bEndpointAddress */
USB_ENDPOINT_TYPE_INTERRUPT,/* bmAttributes */
WBVAL(0x0004),/* wMaxPacketSize */
0x08,/* 16ms */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* bInterval */

/* Terminator */
0/* bLength */
};
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have these defines:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
#define USB_MSC_IF_NUM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00
#define USB_MSC_IN_EP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x81
#define USB_MSC_OUT_EP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x01

#define USB_HID_IF_NUM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x01
#define HID_IN_EP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x82
#define HID_OUT_EP 0x02
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:44:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523338#M5974</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM: hard fault when using composite device</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523339#M5975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cneubert on Tue Dec 01 03:02:43 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I began from start and for this I used the HID example of LPCOpen 2.12. This example is working as long as the EPs are 0x01 and 0x81.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It also does a hardfault if I change the EPs to e.g. 0x02 and 0x82.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So why can´t the ROM code handle this and how can I change the EPs?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:44:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523339#M5975</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM: hard fault when using composite device</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523340#M5976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cneubert on Tue Dec 01 05:50:49 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Further tests showed me, that the ROM code only accepts EPs 0x01 and 0x81, when I use 0x02 and 0x82 I get a hardfault in the ROM code and with 0x03/83 and 0x04/84 I get an ERR_USBD_BAD_EP_DESC when I call "USBD_API-&amp;gt;hid-&amp;gt;init".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody help me?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a better free USB stack available for a LPC1857 I can use?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tested the Keil stack and with it I can get one USB device to running, but as I can´t find a compatible example for my mcu I couldn´t test it with a composite device.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:44:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523340#M5976</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: USB ROM: hard fault when using composite device</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523341#M5977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by cneubert on Tue Dec 01 06:35:04 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally I found the problem, why the ROM code didn´t configure the EPs right. When one inits the USB stack you also have to say how much EPs the USB device supports and first I didn´t change this value and then I set it to high. Now I set it to USB_MAX_EP_NUM and my PCs find a HID and a MSC device :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I will see if everything still works as expected.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:44:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/USB-ROM-hard-fault-when-using-composite-device/m-p/523341#M5977</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:44:59Z</dc:date>
    </item>
  </channel>
</rss>

