Low speed vs full speed USB

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Full speed requires the 48 MHz oscillator and 12 MHz minimum MCU clock. My application is very simple: the xmega32a4u waits for a command on a USB CDC serial port and responds either by serial or by HID. So, I was wondering if there is any downside to switching to low speed and lower clocks.

 

And I tired it but just by defining the USB_DEVICE_LOW_SPEED macro, things don't work automatically - Windows says the USB device is no longer recognized. Any tips on why that might be?

 

Here's are the relevant excerpts of my ASF conf_usb.h:

//#define  USB_DEVICE_LOW_SPEED   // Defining this leads to "Device not recognized" in Windows. Without it, my device works well.

 

//! Control endpoint size
#define  USB_DEVICE_EP_CTRL_SIZE       64 // changing this to 8 makes no difference

//! Number of interfaces for this device
#define  USB_DEVICE_NB_INTERFACE       3 // 1 or more

#define  USB_DEVICE_MAX_EP             4 // 0 to max endpoint requested by interfaces

 

// CDC

#define  UDI_CDC_PORT_NB 1

//! Define it when the transfer CDC Device to Host is a low rate (<512000 bauds)
//! to reduce CDC buffers size
#define  UDI_CDC_LOW_RATE

#define  UDI_CDC_DEFAULT_RATE             38400
#define  UDI_CDC_DEFAULT_STOPBITS         CDC_STOP_BITS_1
#define  UDI_CDC_DEFAULT_PARITY           CDC_PAR_ODD
#define  UDI_CDC_DEFAULT_DATABITS         8

//! Endpoints' numbers used by single or first CDC port
#define  UDI_CDC_DATA_EP_IN_0          (2 | USB_EP_DIR_IN)  // TX
#define  UDI_CDC_DATA_EP_OUT_0         (3 | USB_EP_DIR_OUT) // RX
#define  UDI_CDC_COMM_EP_0             (4 | USB_EP_DIR_IN)  // Notify endpoint

//! Interface numbers used by single or first CDC port
#define  UDI_CDC_COMM_IFACE_NUMBER_0   1
#define  UDI_CDC_DATA_IFACE_NUMBER_0   2

 

// HID

#define  UDI_HID_MOUSE_EP_IN           (1 | USB_EP_DIR_IN)

//! Interface number
#define  UDI_HID_MOUSE_IFACE_NUMBER    0

 

//! USB Interfaces descriptor structure

//! USB Interface APIs
#define UDI_COMPOSITE_DESC_T \
    udi_hid_mouse_desc_t udi_hid_mouse; \
    usb_iad_desc_t udi_cdc_iad; \
    udi_cdc_comm_desc_t udi_cdc_comm; \
    udi_cdc_data_desc_t udi_cdc_data;

//! USB Interfaces descriptor value for Full Speed
#define UDI_COMPOSITE_DESC_FS \
    .udi_hid_mouse             = UDI_HID_MOUSE_DESC, \
    .udi_cdc_iad               = UDI_CDC_IAD_DESC_0, \
    .udi_cdc_comm              = UDI_CDC_COMM_DESC_0, \
    .udi_cdc_data              = UDI_CDC_DATA_DESC_0_FS

//! USB Interfaces descriptor value for High Speed
#define UDI_COMPOSITE_DESC_HS \
    .udi_hid_mouse             = UDI_HID_MOUSE_DESC, \
    .udi_cdc_iad               = UDI_CDC_IAD_DESC_0, \
    .udi_cdc_comm              = UDI_CDC_COMM_DESC_0, \
    .udi_cdc_data              = UDI_CDC_DATA_DESC_0_HS

//! USB Interface APIs
#define UDI_COMPOSITE_API  \
    &udi_api_hid_mouse, \
    &udi_api_cdc_comm, \
    &udi_api_cdc_data

 

Last Edited: Wed. Nov 25, 2020 - 07:59 PM