Skip to content

LPC11U35 support for USBDevice and mbed-rtos #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/USBDevice/USBDevice/USBDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ uint8_t * USBDevice::stringLangidDesc() {
static uint8_t stringLangidDescriptor[] = {
0x04, /*bLength*/
STRING_DESCRIPTOR, /*bDescriptorType 0x03*/
0x09,0x00, /*bString Lang ID - 0x009 - English*/
0x09,0x04, /*bString Lang ID - 0x0409 - English*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows won't display the USB strings during driver installation if the language ID isn't 0x0409 - English (United States).

};
return stringLangidDescriptor;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/USBDevice/USBDevice/USBDevice_Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/* Descriptors */
#define DESCRIPTOR_TYPE(wValue) (wValue >> 8)
#define DESCRIPTOR_INDEX(wValue) (wValue & 0xf)
#define DESCRIPTOR_INDEX(wValue) (wValue & 0xff)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Masking off the upper nibble of wValue causes the USBDevice library to report it's 6 strings repeatedly, starting on every requested index that is a multiple of 16. This is made evident by using SimpleHIDWrite with the Generic HID example program.

usb_string_bug


typedef struct {
struct {
Expand Down
9 changes: 7 additions & 2 deletions libraries/USBDevice/USBDevice/USBHAL_LPC11U.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#if defined(TARGET_LPC11U24) || defined(TARGET_LPC1347)
#if defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC1347)

#if defined(TARGET_LPC1347)
#define USB_IRQ USB_IRQ_IRQn
#elif defined(TARGET_LPC11U24)
#elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401)
#define USB_IRQ USB_IRQn
#endif

Expand Down Expand Up @@ -145,6 +145,11 @@ USBHAL::USBHAL(void) {
epCallback[6] = &USBHAL::EP4_OUT_callback;
epCallback[7] = &USBHAL::EP4_IN_callback;

#if defined(TARGET_LPC11U35_401)
// USB_VBUS input with pull-down
LPC_IOCON->PIO0_3 = 0x00000009;
#endif

// nUSB_CONNECT output
LPC_IOCON->PIO0_6 = 0x00000001;

Expand Down
3 changes: 3 additions & 0 deletions libraries/rtos/rtx/RTX_CM_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ osThreadDef_t os_thread_def_main = {(os_pthread)main, osPriorityNormal, 0, NULL}
#elif TARGET_LPC11U24
#define INITIAL_SP (0x10002000UL)

#elif TARGET_LPC11U35_401
#define INITIAL_SP (0x10002000UL)

#elif TARGET_LPC1114
#define INITIAL_SP (0x10001000UL)

Expand Down
6 changes: 3 additions & 3 deletions libraries/rtos/rtx/RTX_Conf_CM.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#ifndef OS_TASKCNT
# if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC1347)
# define OS_TASKCNT 14
# elif defined(TARGET_LPC11U24) || (TARGET_LPC1114) || (TARGET_LPC812) || defined(TARGET_KL25Z)
# elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || (TARGET_LPC1114) || (TARGET_LPC812) || defined(TARGET_KL25Z)
# define OS_TASKCNT 6
# endif
#endif
Expand All @@ -60,7 +60,7 @@
#ifndef OS_SCHEDULERSTKSIZE
# if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC1347)
# define OS_SCHEDULERSTKSIZE 256
# elif defined(TARGET_LPC11U24) || (TARGET_LPC1114) || (TARGET_LPC812) || defined(TARGET_KL25Z)
# elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || (TARGET_LPC1114) || (TARGET_LPC812) || defined(TARGET_KL25Z)
# define OS_SCHEDULERSTKSIZE 128
# endif
#endif
Expand Down Expand Up @@ -107,7 +107,7 @@
# elif defined(TARGET_LPC1347)
# define OS_CLOCK 72000000

# elif defined(TARGET_LPC11U24) || (TARGET_LPC1114) || defined(TARGET_KL25Z)
# elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || (TARGET_LPC1114) || defined(TARGET_KL25Z)
# define OS_CLOCK 48000000
#
# elif defined(TARGET_LPC812)
Expand Down