Skip to content

Commit

Permalink
fix(Examples): Fix 'this device cannot start COM port' error in MAX32…
Browse files Browse the repository at this point in the history
…665 USB_CDCACM example (#729)
  • Loading branch information
karaanil authored and EricB-ADI committed Oct 26, 2023
1 parent 2f91db2 commit 6a09801
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Examples/MAX32665/USB_CDCACM/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void echoUSB(void);
/***** File Scope Variables *****/

/* This EP assignment must match the Configuration Descriptor */
static const acm_cfg_t acm_cfg = {
static acm_cfg_t acm_cfg = {
1, /* EP OUT */
MXC_USBHS_MAX_PACKET, /* OUT max packet size */
2, /* EP IN */
Expand Down Expand Up @@ -279,6 +279,14 @@ static int setconfigCallback(MXC_USB_SetupPkt *sud, void *cbdata)
if (sud->wValue == config_descriptor.config_descriptor.bConfigurationValue) {
configured = 1;
MXC_SETBIT(&event_flags, EVENT_ENUM_COMP);

acm_cfg.out_ep = config_descriptor.endpoint_descriptor_1.bEndpointAddress & 0x7;
acm_cfg.out_maxpacket = config_descriptor.endpoint_descriptor_1.wMaxPacketSize;
acm_cfg.in_ep = config_descriptor.endpoint_descriptor_2.bEndpointAddress & 0x7;
acm_cfg.in_maxpacket = config_descriptor.endpoint_descriptor_2.wMaxPacketSize;
acm_cfg.notify_ep = config_descriptor.endpoint_descriptor_3.bEndpointAddress & 0x7;
acm_cfg.notify_maxpacket = config_descriptor.endpoint_descriptor_3.wMaxPacketSize;

return acm_configure(&acm_cfg); /* Configure the device class */
} else if (sud->wValue == 0) {
configured = 0;
Expand Down

0 comments on commit 6a09801

Please sign in to comment.