Skip to content

Commit cde661c

Browse files
committed
Fixing USB compliance issues
- Incorrectly set power attributes (conflicting settings for bus powered and self powered) - Set the correct power rating for firmware and bootloader - Added udd_ack_setup_received to sam stalls * Was missing a packet, which caused SETUP packets which received a stall to hang and fail the next test Fixes Issue #311
1 parent a698a69 commit cde661c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: Lib/ASF/config/conf_usb.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@
4949
#define USB_DEVICE_VENDOR_ID VENDOR_ID
5050
#define USB_DEVICE_PRODUCT_ID PRODUCT_ID
5151
#define USB_DEVICE_VERSION BCD_VERSION
52-
#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA)
53-
#define USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED)
54-
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED)
55-
// (USB_CONFIG_ATTR_BUS_POWERED)
52+
#define USB_DEVICE_ATTR (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED)
5653

5754
#ifdef USB_Priority_define
5855
#define UDD_USB_INT_LEVEL USB_Priority_define
@@ -149,6 +146,7 @@ extern bool main_extra_string();
149146
#define USB_DEVICE_SPECIFIC_REQUEST udi_dfu_atmel_setup
150147
#define UDC_GET_EXTRA_STRING() main_extra_string()
151148
#define USB_DEVICE_MAX_EP 1
149+
#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA)
152150
#include "udi_dfu_atmel_conf.h"
153151

154152
// ===== Firmware =====
@@ -163,6 +161,7 @@ extern bool main_extra_string();
163161
#define UDC_SOF_EVENT() usb_sof_event()
164162
#define USB_DEVICE_SPECIFIC_REQUEST my_udi_hid_setup
165163
#define USB_CONFIGURATION_CHANGED usb_set_configuration
164+
#define USB_DEVICE_POWER 500 // Consumption on Vbus line (mA)
166165

167166
#endif
168167

Diff for: Output/USB/arm/usb_dev.c

+3
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ static void endpoint0_stall()
209209
#if defined(_kinetis_)
210210
USB0_ENDPT0 = USB_ENDPT_EPSTALL | USB_ENDPT_EPRXEN | USB_ENDPT_EPTXEN | USB_ENDPT_EPHSHK;
211211
#elif defined(_sam_)
212+
// XXX (HaaTa): Only for setup packets (must ack received packet before stalling)
213+
udd_ack_setup_received( 0 );
214+
212215
udd_ctrl_stall_data();
213216
#endif
214217
}

0 commit comments

Comments
 (0)