ATSAMD21J18A USB Confusion [ASF3]

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

I am attempting to use USB on my atsamd21j18a. I want to use the USB for two purposes: 

 - As a serial port com device

 - As a data channel for uploading firmware

 

I want to have these be isolated from eachother, and if I understand this guide correctly ( https://microchipdeveloper.com/usb:device-classes ) I can have two sets of endpoints. One for the serial port and one for bulk data transfers (Sending data). My first question is, am I correct about this? I just want to make sure I have an understanding of this beforehand.

 

Second, in ASF3, how would I go about doing this? I have an example pulled up, which is the example HID, CDC, and MSC example project.

 

In conf_usb.h, they have these endpoint definitions:

//! Endpoint numbers definition
#define  UDI_CDC_COMM_EP_0             (7 | USB_EP_DIR_IN)  // Notify endpoint
#define  UDI_CDC_DATA_EP_IN_0          (6 | USB_EP_DIR_IN)  // TX
#define  UDI_CDC_DATA_EP_OUT_0         (5 | USB_EP_DIR_OUT) // RX

Is it safe to say I could change these definitions to this:

//! Endpoint numbers definition
#define  UDI_CDC_COMM_EP_0             (7 | USB_EP_DIR_IN)  // Notify endpoint
#define  UDI_CDC_COMM_EP_IN_0          (6 | USB_EP_DIR_IN)  // TX
#define  UDI_CDC_COMM_EP_OUT_0         (5 | USB_EP_DIR_OUT) // RX
#define  UDI_CDC_DATA_EP_0             (4 | USB_EP_DIR_IN)  // Notify endpoint
#define  UDI_CDC_DATA_EP_IN_0          (3 | USB_EP_DIR_IN)  // TX
#define  UDI_CDC_DATA_EP_OUT_0         (2 | USB_EP_DIR_OUT) // RX

And my data and comms pipes would be completely separate? I guess I'm just having hard time understanding two things:

Are udi_cdc_dat and udi_cdc_comm the same thing? Just being used on two different pipes? Or are they actually different classes?

im a penguin