Skip to content

Commit c9bce8f

Browse files
ccli80xc0170
authored andcommitted
Fix USB EP setting error in USBAudio
NUC472/M453 USB doesn't support configuration of the same EP number for IN/OUT simultaneously.
1 parent 907e7db commit c9bce8f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

features/unsupported/USBDevice/USBAudio/USBAudio.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bool USBAudio::readWrite(uint8_t * buf_read, uint8_t * buf_write) {
8585
SOF_handler = false;
8686
writeIN = false;
8787
if (interruptIN) {
88-
USBDevice::writeNB(EP3IN, buf_write, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
88+
USBDevice::writeNB(EPISO_IN, buf_write, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
8989
} else {
9090
buf_stream_out = buf_write;
9191
}
@@ -102,7 +102,7 @@ bool USBAudio::write(uint8_t * buf) {
102102
writeIN = false;
103103
SOF_handler = false;
104104
if (interruptIN) {
105-
USBDevice::writeNB(EP3IN, buf, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
105+
USBDevice::writeNB(EPISO_IN, buf, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
106106
} else {
107107
buf_stream_out = buf;
108108
}
@@ -115,13 +115,13 @@ bool USBAudio::write(uint8_t * buf) {
115115

116116
void USBAudio::writeSync(uint8_t *buf)
117117
{
118-
USBDevice::writeNB(EP3IN, buf, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
118+
USBDevice::writeNB(EPISO_IN, buf, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
119119
}
120120

121121
uint32_t USBAudio::readSync(uint8_t *buf)
122122
{
123123
uint32_t size = 0;
124-
USBDevice::readEP(EP3OUT, (uint8_t *)buf, &size, PACKET_SIZE_ISO_IN);
124+
USBDevice::readEP(EPISO_OUT, (uint8_t *)buf, &size, PACKET_SIZE_ISO_IN);
125125
return size;
126126
}
127127

@@ -134,15 +134,15 @@ bool USBAudio::EPISO_OUT_callback() {
134134
uint32_t size = 0;
135135
interruptOUT = true;
136136
if (buf_stream_in != NULL) {
137-
readEP(EP3OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN);
137+
readEP(EPISO_OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN);
138138
available = true;
139139
buf_stream_in = NULL;
140140
}
141141
else {
142142
if (rxDone)
143143
rxDone.call();
144144
}
145-
readStart(EP3OUT, PACKET_SIZE_ISO_IN);
145+
readStart(EPISO_OUT, PACKET_SIZE_ISO_IN);
146146
return false;
147147
}
148148

@@ -164,10 +164,10 @@ void USBAudio::SOF(int frameNumber) {
164164
if (!interruptOUT) {
165165
// read the isochronous endpoint
166166
if (buf_stream_in != NULL) {
167-
if (USBDevice::readEP_NB(EP3OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN)) {
167+
if (USBDevice::readEP_NB(EPISO_OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN)) {
168168
if (size) {
169169
available = true;
170-
readStart(EP3OUT, PACKET_SIZE_ISO_IN);
170+
readStart(EPISO_OUT, PACKET_SIZE_ISO_IN);
171171
buf_stream_in = NULL;
172172
}
173173
}
@@ -177,7 +177,7 @@ void USBAudio::SOF(int frameNumber) {
177177
if (!interruptIN) {
178178
// write if needed
179179
if (buf_stream_out != NULL) {
180-
USBDevice::writeNB(EP3IN, (uint8_t *)buf_stream_out, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
180+
USBDevice::writeNB(EPISO_IN, (uint8_t *)buf_stream_out, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
181181
buf_stream_out = NULL;
182182
}
183183
}
@@ -194,11 +194,11 @@ bool USBAudio::USBCallback_setConfiguration(uint8_t configuration) {
194194
}
195195

196196
// Configure isochronous endpoint
197-
realiseEndpoint(EP3OUT, PACKET_SIZE_ISO_IN, ISOCHRONOUS);
198-
realiseEndpoint(EP3IN, PACKET_SIZE_ISO_OUT, ISOCHRONOUS);
197+
realiseEndpoint(EPISO_OUT, PACKET_SIZE_ISO_IN, ISOCHRONOUS);
198+
realiseEndpoint(EPISO_IN, PACKET_SIZE_ISO_OUT, ISOCHRONOUS);
199199

200200
// activate readings on this endpoint
201-
readStart(EP3OUT, PACKET_SIZE_ISO_IN);
201+
readStart(EPISO_OUT, PACKET_SIZE_ISO_IN);
202202
return true;
203203
}
204204

0 commit comments

Comments
 (0)