Skip to content

Using UVC example for ESP32-S3 #126

Description

@marcpabst

Hi, I'm trying to use the UVC exmaple in /demos on a ESP3-S3 board. WHile I can get some easier stuff ike HID input to work, I can't seem the camera class to function properly. When connecting to a Windows or Mac mashine, both detect a webcam with the correct name, but can't seem to receive any frames. Moreover, on Windows, the ESP32 is constantly resetting (resulting in the well-known Windows USB-connected sound).

Maybe there is something I'm missing, but I can't seem to get it working. Any hints/tips?

Here is my main.c:

#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "spi_flash_mmap.h"
#include "hal/usb_hal.h"
#include "soc/usb_periph.h"
#include "rom/gpio.h"
#include "driver/gpio.h"
#include "driver/periph_ctrl.h"
#include <stdio.h>

//#include "hid_mouse_template.c"
#include "video_static_mjpeg_template.c"

static void ConfigureUsbPins(usb_hal_context_t *usb)
{
    /* usb_periph_iopins currently configures USB_OTG as USB Device.
     * Introduce additional parameters in usb_hal_context_t when adding support
     * for USB Host.
     */
    for (const usb_iopin_dsc_t *iopin = usb_periph_iopins; iopin->pin != -1; ++iopin)
    {
        if ((usb->use_external_phy) || (iopin->ext_phy_only == 0))
        {
            gpio_pad_select_gpio(iopin->pin);
            if (iopin->is_output)
            {
                gpio_matrix_out(iopin->pin, iopin->func, false, false);
            }
            else
            {
                gpio_matrix_in(iopin->pin, iopin->func, false);
                gpio_pad_input_enable(iopin->pin);
            }
            gpio_pad_unhold(iopin->pin);
        }
    }
    if (!usb->use_external_phy)
    {
        gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3);
        gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
    }
}

void app_main()
{

    // TURNO LED ON GPIO2 ON
    gpio_pad_select_gpio(2);
    gpio_set_direction(2, GPIO_MODE_OUTPUT);
    gpio_set_level(2, 1);

    periph_module_reset(PERIPH_USB_MODULE);
    periph_module_enable(PERIPH_USB_MODULE);

    usb_hal_context_t hal = {
        .use_external_phy = false};
    usb_hal_init(&hal);
    printf("Configuring USB pins\n");
    ConfigureUsbPins(&hal);

    video_init();
    video_test();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions