WebUSB communication: datasheet/documentation for AT MEGA 2560

Hello everyone, I'm looking for a document specifying the possible USB requests (class and vendor requests, apart from the standard ones) that I can send to my AT MEGA 2560 controller (from what I understand it's the generic version of the Arduino Mega 2560).

I am currently trying to establish a basic communication between the generic Arduino and my PC through USB because I'm developing a project with the WebUSB API. I've already gone through it a couple of times now but I can't seem to understand why, during the control transfer stage, is it that they provide the function with the following parameters:

{
    requestType: 'vendor',
    recipient: 'interface',
    request: 0x01,  // vendor-specific request: enable channels
    value: 0x0013,  // 0b00010011 (channels 1, 2 and 5)
    index: 0x0001   // Interface 1 is the recipient
}

I assume it's just some specific request for a specific device that the writers used as an example. I do know what the parameters are for a control transfer communication through USB. I just don't know where to find the available vendor and class request parameters for my device so that I can send the request I want to send to establish connection with a specific peripheral (specifically the HC-SR04 proximity sensor).

I've already searched for the AT MEGA 2560 datasheet, but all I could find were some documents that were more focused on specifying the internals of the controller and the electronic communication with peripherals. What I'm looking for is the information regarding the USB communication of the controller. I've also read the Google developers' post on accessing USB devices through the web, that's how I got to the WebUSB API in the first place.

I need to use the WebUSB API because the project is supposed to be a SPA webapp.

The Atmega2560 chip has no USB capability. On an Arduino Atmega2560 board the USB activity is done by an Atmega 16U2 MCU

It may be useful to study the 16U2 datasheet

...R

The Mega 2650 is not listed on the Arduino WebUSB page.

Hello everyone, is there a way to have the Arduino Mega 2560 communicate with a PC over the USB protocol instead of using serial communication? I would like to take advantage of the WebUSB API to develop a web project that communicates with the Arduino through the browser.

This is a double post so I am suggesting to the Moderator to merge it with your other Thread where there have already been some answers.

...R

@lucas_sg, do not cross-post. Threads merged.

Thank you @Robin2!

I didn't mean to cross-post, I thought they were a bit different because when I posted the first one I was assuming USB communication was possible and I wanted to find the information regarding USB requests for the Mega. :sweat_smile:

Can you expand a little on your project? That might answer the question "why a Mega and not e.g. a Leonardo?" and we might be able to suggest alternatives :wink: