DroneBridge / ESP32

DroneBridge for ESP32. A secure & transparent telemetry link with support for WiFi and ESP-NOW. Supporting MAVLink, MSP, LTM or any other protocol
https://dronebridge.github.io/ESP32/
Apache License 2.0
382 stars 107 forks source link

ESP32-C3 support #36

Closed paony closed 9 months ago

paony commented 1 year ago

Would it be possible to compile this for ESP32-C3? Or is the C3 hardware incompatible? If it is possible: could you provide a binary?

seeul8er commented 1 year ago

I think it will work just fine on the C3 module. Maybe some api differences need to be fixed, but it should work just fine. Unfortunately I do not have the time to create the binaries myselfe.

backtozero commented 1 year ago

I think it will work just fine on the C3 module. Maybe some api differences need to be fixed, but it should work just fine. Unfortunately I do not have the time to create the binaries myselfe.

Trying to compile for EPS32-S3 and getting this error:

esp_wifi_default.h:31:41: error: unknown type name 'esp_netif_t'; did you mean 'esp_err_t'?
seeul8er commented 1 year ago

looks like an API problem. You will most likely have to change the WiFi code and use the recent API calls that are supported by the S3

JustinGibDev commented 1 year ago

I tried with a seed studio XAIO-esp32-c3 board and keeps rebooting, the GPIO pins on the board are 20,21

image

is there anything you can guide me in making it work with this board? I wouldnt mind re-compiling the source code if you'd point me in the right direction

seeul8er commented 1 year ago

@JustinGibDev The WiFi initialisation is done in this section of the code.

Check the esp-idf documentation on the ESP-C3 with the correct esp-idf version selected on how to init WiFi. Check out the example implementation using the latest code examples for that esp-idf version.

You can hard-code the pins here if you need to. In any case, you will have to check the logs (using esp-idf toolchains "idf.py monitor" command). Otherwise, you will not be able to know what actually causes the problem.

That seedstudio board looks interesting. I might take a look at it

JustinGibDev commented 1 year ago

Thank you very much for the advice, i will look into the code, if i get it working i'll let you know.

I have two spare esp32 board at the moment, one is the seedstudio board, and yeah i recommend you get one its quite good. Also i have a Heltec Wifi Kit 32, the crystal works at 26.7MHz and it wont run, seen on the serial monitor when it tries to boot up. This is another option i have for now, but ideally i am going to try to get it working on the other board.

As for the seed studio :

12:30:46.670 -> 0xffffffff 12:30:46.670 -> xffffffff ESP-ROM:esp32c3-api1-20210207 12:30:46.670 -> Build:Feb 7 2021 12:30:46.670 -> rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT) 12:30:46.670 -> Saved PC:0x4004c0d8 12:30:46.670 -> invalid header: 0xffffffff 12:30:46.670 -> invalid header: 0xffffffff 12:30:46.670 -> invalid header: 0xffffffff

this is what i get on the serial monitor.

I shall keep you abreast of any advancements i manage to make

I think the addressing options are not compatible with the board check out what i found on the data sheet:

image

JustinGibDev commented 1 year ago

More of an update.

Currently trying to get an enviroment ready with esp-idf in order to recompile and test with the new settings

If you would like a copy of the sdkconfig and might want to either recompile and create new binaries for the esp32-c3 specific board type

Razbotics commented 11 months ago

Did anyone manage to recompile for esp32-c3 target?

adrian0806 commented 10 months ago

@JustinGibDev Did you manage to get the code working on ESP32C3? I have managed to build and flash it, but the code keeps resetting

kspeco commented 9 months ago

Hello, i recompile code with a 4.4.6 framework for a c3 device, flashed boot ad addr 0x0 but after starting ap i have a reboot. Could someone give me some help?

kspeco commented 9 months ago

Hello i have some news. I fix the reboot. Problem is in uart pins. I change pins to work with UART1 and code run but i have problem with serial socket located in db_esp32_control.c file.

int open_serial_socket() { int serial_socket; uart_config_t uart_config = { .baud_rate = DB_UART_BAUD_RATE, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, .rx_flow_ctrl_thresh = 0, }; ESP_ERROR_CHECK(uart_param_config(UART_NUM, &uart_config)); ESP_ERROR_CHECK(uart_set_pin(UART_NUM, 7, 6, 4, 5)); ///reboot cause ESP_ERROR_CHECK(uart_driver_install(UART_NUM, 1024, 0, 0, NULL, 0)); if ((serial_socket = open("/dev/uart/2", O_RDWR)) == -1) { ESP_LOGE(TAG, "Cannot open UART1"); close(serial_socket); uart_driver_delete(UART_NUM); return ESP_FAIL; } esp_vfs_dev_uart_use_driver(2); return serial_socket; } The error "Cannot open UART1" is printed. I ran out of ideas

JustinGibDev commented 9 months ago

what is the exact board you are trying to use? probably you have to set the correct pins you might have this on the boards specific pinout sheet

seeul8er commented 9 months ago

Release v1.3 now comes with support for the ESP32C3. Load times of the website in AP-Mode and with Desktop browsers may be an issue. Mobile android browsers performed well.

Dhananjay2601 commented 7 months ago

I think it will work just fine on the C3 module. Maybe some api differences need to be fixed, but it should work just fine. Unfortunately I do not have the time to create the binaries myselfe.

It's not working on C3, as soon as I configure the ports to 21,20 on web interface and run a power cycle. The whole web interface crashes. I can still connect to AP but cannot access configuration from web or api.

Because of this the Esp32 C3 won't communicate with my FC (Matek H7 slim).

Help.

seeul8er commented 7 months ago

@Dhananjay2601 Can you try the older v1.3 release? Same issue as with v1.4?

Dhananjay2601 commented 7 months ago

Yes 1.3v had same issues

seeul8er commented 7 months ago

@Dhananjay2601 I need details on your board. my C3 works

Dhananjay2601 commented 7 months ago

Hey man you mind accepting my linkedin request? We can have a better communication on there please.

seeul8er commented 7 months ago

@Dhananjay2601 I do not solve issues via LinkedIn nor for individuals. If you have an issue post it here so everyone can have a look at. This is no private support hotline ;)

Dhananjay2601 commented 7 months ago

After updating the settings/parameters the webpage fails to open again. SSID shows up in the wifi networks though, and accepts pings through terminal/cmd Also, Mission planner is unable to connect to its FC via DronebridgeESP32 WiFi

Tried flashing the wifi module with binaries of both Releases v1.4 & v1.3 of DroneBridge/ESP32, both present the same problem. Flashing was done through ESP_IDF V5.1 via powershell.

seeul8er commented 7 months ago

OK. What C3 board are you using? Did you try any other pin configurations?

seeul8er commented 7 months ago

Can you post the output of: idf.py monitor I ordered the XIAO C3 yesterday as it seems to be a nice choice and still causes Problems

Dhananjay2601 commented 7 months ago

I am using Xiao ESP32-C3 by seeed studios

PS C:\Espressif\frameworks\esp-idf-v5.2> idf.py monitor Executing action: monitor Running cmake in directory C:\Espressif\frameworks\esp-idf-v5.2\build Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=C:\Espressif\python_env\idf5.2_py3.11_env\Scripts\python.exe -DESP_PLATFORM=1 -DCCACHE_ENABLE=1 C:\Espressif\frameworks\esp-idf-v5.2"... -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- The ASM compiler identification is GNU -- Found assembler: C:/mingw64/bin/gcc.exe -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/mingw64/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/mingw64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:5 (message): Current directory 'C:/Espressif/frameworks/esp-idf-v5.2' is not buildable. Change directories to one of the example projects in 'C:/Espressif/frameworks/esp-idf-v5.2/examples' and try again.

-- Configuring incomplete, errors occurred! See also "C:/Espressif/frameworks/esp-idf-v5.2/build/CMakeFiles/CMakeOutput.log". cmake failed with exit code 1, output of the command is in the C:\Espressif\frameworks\esp-idf-v5.2\build\log\idf_py_stderr_output_28020 and C:\Espressif\frameworks\esp-idf-v5.2\build\log\idf_py_stdout_output_28020

seeul8er commented 7 months ago

Duplicate to #61 Will be fixed there. Seems like the D6 & D7 Pads marked for TX & RX are internally connected to UART0 which is the same UART as the one connected to the USB connector. Try any other pin combination like D9 & D10 for UART TX&RX

Dhananjay2601 commented 7 months ago

It worked! The connection to D9 and D10 solved the issue. The Matek Fc finally accepts commands from the Esp32 C3. Thanks alot for the help.