Seeed-Studio / Seeed_Arduino_SSCMA

Arduino library for devices supporting the SSCMA-Micro firmware
MIT License
23 stars 5 forks source link

examples/camera_web_server/camera_web_server.ino not working w/ recommended Xiao ESP32S3 #26

Closed mbz4 closed 2 months ago

mbz4 commented 2 months ago
..
WiFi connected
E (1078) uart: uart_driver_install(1603): uart rx buffer length error
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x4037d2f8
file: "/home/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c" line 213
func: uartBegin
expression: uart_driver_install(uart_nr, rx_buffer_size, tx_buffer_size, 20, &(uart->uart_event_queue), 0)

abort() was called at PC 0x4037d2fb on core 1

Backtrace: 0x403776b6:0x3fcebd80 0x4037d305:0x3fcebda0 0x40383211:0x3fcebdc0 0x4037d2fb:0x3fcebe40 0x42017f33:0x3fcebe60 0x42015648:0x3fcebec0 0x420055d1:0x3fcebf10 0x4200de37:0x3fcebf40 0x42018172:0x3fcebf70

ELF file SHA256: 1cadbfec2e4cb365

Rebooting...

Tried fixing by updating app_httpd.cpp: (tried corect pin assignments for multi-protocol handler)


void startRemoteProxy(Proto through = PROTO_UART) {
    switch (through) {
    case PROTO_UART: {
#ifdef ESP32
        static HardwareSerial atSerial(0);
        // the esp32 arduino library may have a bug in setRxBufferSize
        // we cannot set the buffer size larger than uint16_t max value
        // a workaround is to modify uartBegin() in
        //     esp32/hardware/esp32/2.0.14/cores/esp32/esp32-hal-uart.c
        atSerial.setRxBufferSize(COM_BUFFER_SIZE);
        atSerial.begin(921600);
#else
    #define atSerial Serial1
        atSerial.setRxBufferSize(COM_BUFFER_SIZE);
        atSerial.begin(921600);
#endif
        AI.begin(&atSerial, D6, D7);
        break;
    }
    case PROTO_I2C: {
        Wire.setBufferSize(COM_BUFFER_SIZE);
        Wire.begin();
        AI.begin(&Wire, D4, D5);
        break;
    };
    case PROTO_SPI: {
        SPI.begin(SCK, MOSI, MISO, -1);
        AI.begin(&SPI, D8, D9, D10, 15000000);
        break;
    };
    default:
        assert(false && "Unknown proto...");
    }
}
mbz4 commented 2 months ago

looks like the pin assignment was fine

fixed by following instructions here: https://wiki.seeedstudio.com/grove_vision_ai_v2_webcamera/#1-uart-buffer-length-error

not a good workaround as we have to overwrite the global driver for esp32 hal uart.c, .h files to:

uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint32_t rx_buffer_size, uint32_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd)

and uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint32_t rx_buffer_size, uint32_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd); (changed uint16_t to uint32_t for both buffer_size variables)