8000 Merge pull request #4774 from kamtom480/spresense_usb_fix · adafruit/circuitpython@4c928ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c928ac

Browse files
authored
Merge pull request #4774 from kamtom480/spresense_usb_fix
spresense: Fix USB CDC and MSC
2 parents 8c0f358 + aebee2d commit 4c928ac

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

ports/cxd56/mpconfigport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// so define these before #include'ing that file.
3838
#define USB_CDC_EP_NUM_NOTIFICATION (3)
3939
#define USB_CDC_EP_NUM_DATA_OUT (2)
40-
#define USB_CDC_EP_NUM_DATA_IN (2)
40+
#define USB_CDC_EP_NUM_DATA_IN (1)
4141
#define USB_MSC_EP_NUM_OUT (5)
4242
#define USB_MSC_EP_NUM_IN (4)
4343

shared-module/storage/__init__.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ static const uint8_t usb_msc_descriptor_template[] = {
6363
0xFF, // 11 bEndpointAddress (IN/D2H) [SET AT RUNTIME: 0x80 | number]
6464
#define MSC_IN_ENDPOINT_INDEX (11)
6565
0x02, // 12 bmAttributes (Bulk)
66+
#if USB_HIGHSPEED
67+
0x00, 0x02, // 13,14 wMaxPacketSize 512
68+
#else
6669
0x40, 0x00, // 13,14 wMaxPacketSize 64
70+
#endif
6771
0x00, // 15 bInterval 0 (unit depends on device speed)
6872

6973
// MSC Endpoint OUT Descriptor
@@ -72,7 +76,11 @@ static const uint8_t usb_msc_descriptor_template[] = {
7276
0xFF, // 18 bEndpointAddress (OUT/H2D) [SET AT RUNTIME]
7377
#define MSC_OUT_ENDPOINT_INDEX (18)
7478
0x02, // 19 bmAttributes (Bulk)
79+
#if USB_HIGHSPEED
80+
0x00, 0x02, // 20,21 wMaxPacketSize 512
81+
#else
7582
0x40, 0x00, // 20,21 wMaxPacketSize 64
83+
#endif
7684
0x00, // 22 bInterval 0 (unit depends on device speed)
7785
};
7886

shared-module/usb_cdc/__init__.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ static const uint8_t usb_cdc_descriptor_template[] = {
121121
0xFF, // 54 bEndpointAddress (OUT/H2D) [SET AT RUNTIME]
122122
#define CDC_DATA_OUT_ENDPOINT_INDEX 54
123123
0x02, // 55 bmAttributes (Bulk)
124+
#if USB_HIGHSPEED
125+
0x00, 0x02, // 56,57 wMaxPacketSize 512
126+
#else
124127
0x40, 0x00, // 56,57 wMaxPacketSize 64
128+
#endif
125129
0x00, // 58 bInterval 0 (unit depends on device speed)
126130

127131
// CDC Data IN Endpoint Descriptor
@@ -130,7 +134,11 @@ static const uint8_t usb_cdc_descriptor_template[] = {
130134
0xFF, // 61 bEndpointAddress (IN/D2H) [SET AT RUNTIME: 0x80 | number]
131135
#define CDC_DATA_IN_ENDPOINT_INDEX 61
132136
0x02, // 62 bmAttributes (Bulk)
137+
#if USB_HIGHSPEED
138+
0x00, 0x02, // 63,64 wMaxPacketSize 512
139+
#else
133140
0x40, 0x00, // 63,64 wMaxPacketSize 64
141+
#endif
134142
0x00, // 65 bInterval 0 (unit depends on device speed)
135143
};
136144

shared-module/usb_midi/__init__.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ static const uint8_t usb_midi_descriptor_template[] = {
127127
0xFF, // 66 bEndpointAddress (OUT/H2D) [SET AT RUNTIME]
128128
#define MIDI_STREAMING_OUT_ENDPOINT_INDEX (66)
129129
0x02, // 67 bmAttributes (Bulk)
130+
#if USB_HIGHSPEED
131+
0x00, 0x02, // 68,69 wMaxPacketSize (512)
132+
#else
130133
0x40, 0x00, // 68,69 wMaxPacketSize (64)
134+
#endif
131135
0x00, // 70 bInterval 0 (unit depends on device speed)
132136

133137
// MIDI Data Endpoint Descriptor
@@ -143,7 +147,11 @@ static const uint8_t usb_midi_descriptor_template[] = {
143147
0xFF, // 78 bEndpointAddress (IN/D2H) [SET AT RUNTIME: 0x80 | number]
144148
#define MIDI_STREAMING_IN_ENDPOINT_INDEX (78)
145149
0x02, // 79 bmAttributes (Bulk)
146-
0x40, 0x00, // 8081 wMaxPacketSize 64
150+
#if USB_HIGHSPEED
151+
0x00, 0x02, // 80, 81 wMaxPacketSize (512)
152+
#else
153+
0x40, 0x00, // 80, 81 wMaxPacketSize (64)
154+
#endif
147155
0x00, // 82 bInterval 0 (unit depends on device speed)
148156

149157
// MIDI Data Endpoint Descriptor

0 commit comments

Comments
 (0)
0