JunOllyLi / espidf5_edgetx

EdgeTX build with ESP-IDF v5
Apache License 2.0
23 stars 8 forks source link

May I ask if there is an actual finished product for this? #2

Open zhuwei opened 5 months ago

JunOllyLi commented 5 months ago

Well, I did this project for my own use. You can see more pictures in https://www.rcgroups.com/forums/showthread.php?4327269-EdgeTX-running-on-ESP32. I do not expect to make a product for sale. But anyone is welcome to use it as a starting point for their own use, including productize it.

zhuwei commented 5 months ago

I want to make a remote control for cars and ships. As a beginner, although I generally understand your flowchart, the specific details are confusing. I'm not sure if there is a more detailed one

JunOllyLi commented 5 months ago

Well, I don't think there is anything preventing you from using the EdgeTX for cars and ships. It is a generic TX for remote control. I am not really sure what confuses you, but if you were able to describe it, I would be happy to help.

zhuwei commented 5 months ago

For example, how can the pin connections between each module be consistent with the firmware?

zhuwei commented 5 months ago

How should trims and switches, buttons, SI2306, etc. be connected to gpio in order to correspond with edgetx? Also, what is flysky hall gift?

zhuwei commented 5 months ago

Does touch support MSP3520?

zhuwei commented 5 months ago

my tft-display is: ILI9488+MSP3520

I modified the file sdkconfig

#CONFIG_ LV_ TFT_ DISPLAY_ Controller_ HX8357=y
CONFIG_ LV_ TFT_ DISPLAY_ Controller_ ILI9488=y
JunOllyLi commented 5 months ago

How should trims and switches, buttons, SI2306, etc. be connected to gpio in order to correspond with edgetx? Also, what is flysky hall gift?

The trims, switches, and buttons are connected to the two MCP23017. I probably should document those. :) The FlySKy Hall gimbal is this: https://www.flysky-cn.com/hzczspecifications

JunOllyLi commented 5 months ago

my tft-display is: ILI9488+MSP3520

I modified the file sdkconfig

#CONFIG_ LV_ TFT_ DISPLAY_ Controller_ HX8357=y
CONFIG_ LV_ TFT_ DISPLAY_ Controller_ ILI9488=y

For display and touch, EdgeTX uses LVGL, so I integrated the lvgl_esp32_drivers into my source tree. I think ILI9488 is supported but I am not sure about the touch you mentioned. And for the sdkconfig, it is not recommended to modify it manually. You should use "idf.py menuconfig" and in the "Component Config" you can find "LVGL ESP Drivers" to choose the supported modules.

JunOllyLi commented 5 months ago

For example, how can the pin connections between each module be consistent with the firmware?

The pinout connection of the ESP32-S3-WROOM can be found in the main/edgetx/radio/src/targets/muffin/board.h, the numbers are the GPIO numbers, not the pin number.

And here is the picture of my notes while I solder the pins. I select those pins mainly for easy soldering and wiring. 20230312_115018

/* From Kconfig LCD D0 - D7: 14, 13, 12, 11, 10, 9, 46, 3 LCD CS 45 LCD DC 48 LCD WR 21

define I2C_SCL 40

define I2C_SDA 39

// MOSI -1 // MISO -1 // RESET -1 // SCLK -1 // TOUCH CS -1 // TOUCH IRQ -1 */

define POT1_ADC_CHANNEL ADC_CHANNEL_5 // GPIO 6

define POT2_ADC_CHANNEL ADC_CHANNEL_4 // GPIO 5

define BATT_ADC_CHANNEL ADC_CHANNEL_6 // GPIO 7

define BACKLITE_PIN 4

define RMT_TX_PIN 41

define TRAINER_IN_GPIO 42

define FLYSKY_UART_RX_PIN 44

define INTMOD_UART_PORT UART_NUM_2

define INTMOD_RX_PIN 2

define INTMOD_TX_PIN 1

define I2C_MASTER_NUM 0

define SD_DEDICATED_SPI

ifdef SD_DEDICATED_SPI

define SD_SPI_HOST SPI2_HOST

define SDSPI_CLK 47

define SDSPI_MOSI 0

define SDSPI_MISO 15

endif

define SDCARD_CS_GPIO 38

define I2S_DOUT 18

define I2S_BCLK 17

define I2S_LRCLK 16

zhuwei commented 5 months ago

Thank you very much for your help. I will study it again. Also, can we not use 4in1 and only use elrsTX?

zhuwei commented 5 months ago

It's already difficult for me to buy HX8357 here. The common ones are ILI9488+MSP3520(XPT2046), but I don't know how to wire or configure touch, XPT2046 should be an SPI interface, which can be found in idf.py menuconfig, but SPI pins (6) need to be set, and I feel that IO is not enough LCD D0-D7: 14, 13, 12, 11, 10, 9, 46, 3 LCD CS 45 LCD DC 48 LCD WR 21

image

zhuwei commented 5 months ago

What are these two?

#define POT1_ADC_CHANNEL ADC_CHANNEL_5 // GPIO 6
#define POT2_ADC_CHANNEL ADC_CHANNEL_4 // GPIO 5
zhuwei commented 5 months ago

Sorry to ask again, what functions do the two MCP23017 switches they are connected to correspond to? And one MCP23017 already has 16 GPIOs, is it necessary to use 2?

JunOllyLi commented 5 months ago

Also, can we not use 4in1 and only use elrsTX?

I think so, but you may need to make some changes to the main/edgetx/radio/src/targets/muffin/CMakeLists.txt by yourself.

JunOllyLi commented 5 months ago

It's already difficult for me to buy HX8357 here. The common ones are ILI9488+MSP3520(XPT2046), but I don't know how to wire or configure touch, XPT2046 should be an SPI interface, which can be found in idf.py menuconfig, but SPI pins (6) need to be set, and I feel that IO is not enough LCD D0-D7: 14, 13, 12, 11, 10, 9, 46, 3 LCD CS 45 LCD DC 48 LCD WR 21

image

The picture you attached here does not seem to have the 8-bit parallel bus for the display, so you probably can only use the SPI for display as well. Then I guess your touch and display can share the same SPI, which would make the IO usage a lot less. Or you could share the same SPI between touch and SD card. Either way it would work.

JunOllyLi commented 5 months ago

What are these two?

#define POT1_ADC_CHANNEL ADC_CHANNEL_5 // GPIO 6
#define POT2_ADC_CHANNEL ADC_CHANNEL_4 // GPIO 5

Those are the two knobs that you can turn to continuously change the input.

JunOllyLi commented 5 months ago

Sorry to ask again, what functions do the two MCP23017 switches they are connected to correspond to? And one MCP23017 already has 16 GPIOs, is it necessary to use 2?

Each trim needs two GPIOs, each 2-position switch needs one GPIO but 3-position switch needs 2, and depending on how many buttons you want to support, 16 GPIOs are not really a lot :)

For the pin orders, sorry I do not have a quick answer to that. I thought I wrote it down but cannot find it right now. But you can take a quick look at main/edgetx/radio/src/targets/muffin/keys_driver.cpp, it should not be too difficult to figure it out.

zhuwei commented 5 months ago

It's already difficult for me to buy HX8357 here. The common ones are ILI9488+MSP3520(XPT2046), but I don't know how to wire or configure touch, XPT2046 should be an SPI interface, which can be found in idf.py menuconfig, but SPI pins (6) need to be set, and I feel that IO is not enough LCD D0-D7: 14, 13, 12, 11, 10, 9, 46, 3 LCD CS 45 LCD DC 48 LCD WR 21 image

The picture you attached here does not seem to have the 8-bit parallel bus for the display, so you probably can only use the SPI for display as well. Then I guess your touch and display can share the same SPI, which would make the IO usage a lot less. Or you could share the same SPI between touch and SD card. Either way it would work.

Thank you very much for your reply. If LCD is also SPI, then D0-D7 should be used elsewhere, right? For example, touch_ Can both CS and SCK be shared? If you want to start the Elrs high-frequency head (usually half duplex), where can I configure it in "idf. py menuconfig"? Since you are using "flysky hall gift", if you change it to a regular potentiometer joystick (two are required for cars or ships), which specific menu is menuconfig

zhuwei commented 5 months ago

Have pins IO35, 36, and 37 not been utilized yet?

JunOllyLi commented 5 months ago

It's already difficult for me to buy HX8357 here. The common ones are ILI9488+MSP3520(XPT2046), but I don't know how to wire or configure touch, XPT2046 should be an SPI interface, which can be found in idf.py menuconfig, but SPI pins (6) need to be set, and I feel that IO is not enough LCD D0-D7: 14, 13, 12, 11, 10, 9, 46, 3 LCD CS 45 LCD DC 48 LCD WR 21 image

The picture you attached here does not seem to have the 8-bit parallel bus for the display, so you probably can only use the SPI for display as well. Then I guess your touch and display can share the same SPI, which would make the IO usage a lot less. Or you could share the same SPI between touch and SD card. Either way it would work.

Thank you very much for your reply. If LCD is also SPI, then D0-D7 should be used elsewhere, right? For example, touch_ Can both CS and SCK be shared? If you want to start the Elrs high-frequency head (usually half duplex), where can I configure it in "idf. py menuconfig"? Since you are using "flysky hall gift", if you change it to a regular potentiometer joystick (two are required for cars or ships), which specific menu is menuconfig

For the LCD, yes if you use SPI, D0-D7 can be used otherwise, but you do need to set aside several pins for the SPI, unless you want to share SPI among LCD, touch and SD all together. You would see something like "pin assignment" in the menuconfig, once you select the controller and bus correctly. I think the SCK is part of the "common" signal of the SPI bus so if you share a SPI bus then SCK is shared. But the CS need to be unique for each module, that is to identify which module the data on the SPI bus is for.

For the ELRS, it is not really ESP configuration, so it does not show up in the menuconfig. It is EdgeTX specific so you need to modify the CMakeLists manually. And I have no idea how ELRS module work so you do need to figure it out. I just know EdgeTX supports it.

For the gimbal, if you want to use potenionmeter joystick it should work as well, but you do need a fast and accurate ADC. I am not sure if the ESP32 can meet the expectation or not. Or you may need to add some external ADC. SW wise you just need to get the position reading of the joysick and fill into the array of hall_adc_values[]. The first 4 of that array stands for the sticks. Also how you design your schematics around it and how you wire those things together definitely would affect the analog part, so a lot to be considered.

JunOllyLi commented 5 months ago

Have pins IO35, 36, and 37 not been utilized yet?

I do not have the spec in hand, but since I put a cross to those on my notes, I suppose they are not available for use. Maybe those were designated to the PSRAM on the module

zhuwei commented 5 months ago

It's already difficult for me to buy HX8357 here. The common ones are ILI9488+MSP3520(XPT2046), but I don't know how to wire or configure touch, XPT2046 should be an SPI interface, which can be found in idf.py menuconfig, but SPI pins (6) need to be set, and I feel that IO is not enough LCD D0-D7: 14, 13, 12, 11, 10, 9, 46, 3 LCD CS 45 LCD DC 48 LCD WR 21 image

The picture you attached here does not seem to have the 8-bit parallel bus for the display, so you probably can only use the SPI for display as well. Then I guess your touch and display can share the same SPI, which would make the IO usage a lot less. Or you could share the same SPI between touch and SD card. Either way it would work.

Thank you very much for your reply. If LCD is also SPI, then D0-D7 should be used elsewhere, right? For example, touch_ Can both CS and SCK be shared? If you want to start the Elrs high-frequency head (usually half duplex), where can I configure it in "idf. py menuconfig"? Since you are using "flysky hall gift", if you change it to a regular potentiometer joystick (two are required for cars or ships), which specific menu is menuconfig

For the LCD, yes if you use SPI, D0-D7 can be used otherwise, but you do need to set aside several pins for the SPI, unless you want to share SPI among LCD, touch and SD all together. You would see something like "pin assignment" in the menuconfig, once you select the controller and bus correctly. I think the SCK is part of the "common" signal of the SPI bus so if you share a SPI bus then SCK is shared. But the CS need to be unique for each module, that is to identify which module the data on the SPI bus is for.

For the ELRS, it is not really ESP configuration, so it does not show up in the menuconfig. It is EdgeTX specific so you need to modify the CMakeLists manually. And I have no idea how ELRS module work so you do need to figure it out. I just know EdgeTX supports it.

For the gimbal, if you want to use potenionmeter joystick it should work as well, but you do need a fast and accurate ADC. I am not sure if the ESP32 can meet the expectation or not. Or you may need to add some external ADC. SW wise you just need to get the position reading of the joysick and fill into the array of hall_adc_values[]. The first 4 of that array stands for the sticks. Also how you design your schematics around it and how you wire those things together definitely would affect the analog part, so a lot to be considered.

Understood, thank you. I don't think the requirements for cars and ships will be very high.

zhuwei commented 5 months ago

Have pins IO35, 36, and 37 not been utilized yet?

I do not have the spec in hand, but since I put a cross to those on my notes, I suppose they are not available for use. Maybe those were designated to the PSRAM on the module

OKey. Why does PPM require 2 IOs? Usually, there is only one connection simulator?

JunOllyLi commented 5 months ago

Have pins IO35, 36, and 37 not been utilized yet?

I do not have the spec in hand, but since I put a cross to those on my notes, I suppose they are not available for use. Maybe those were designated to the PSRAM on the module

OKey. Why does PPM require 2 IOs? Usually, there is only one connection simulator?

One input for this TX act as trainer, one output for this TX act as trainee. Probably they can be time-shared since trainer and trainee would not happen at the same time, but since we do have enough pins, no need to bother

zhuwei commented 5 months ago

Have pins IO35, 36, and 37 not been utilized yet?

I do not have the spec in hand, but since I put a cross to those on my notes, I suppose they are not available for use. Maybe those were designated to the PSRAM on the module

OKey. Why does PPM require 2 IOs? Usually, there is only one connection simulator?

One input for this TX act as trainer, one output for this TX act as trainee. Probably they can be time-shared since trainer and trainee would not happen at the same time, but since we do have enough pins, no need to bother

Got it, thank you

zhuwei commented 5 months ago

Also, can we not use 4in1 and only use elrsTX?

I think so, but you may need to make some changes to the main/edgetx/radio/src/targets/muffin/CMakeLists.txt by yourself.

I saw this: if(INTERNAL_MODULE_ELRS) add_definitions(-DHARDWARE_INTERNAL_MODULE) add_definitions(-DINTERNAL_MODULE_ELRS) add_definitions(-DINTERNAL_MODULE_SERIAL_TELEMETRY) set(INTERNAL_MODULE_MULTI NO) set(TARGET_SRC ${TARGET_SRC}

../common/arm/stm32/intmodule_serial_driver.cpp )

endif() Does it look like Elrs only supports stm32?

zhuwei commented 5 months ago

Also, can we not use 4in1 and only use elrsTX?

I think so, but you may need to make some changes to the main/edgetx/radio/src/targets/muffin/CMakeLists.txt by yourself.

I saw this: if(INTERNAL_MODULE_ELRS) add_definitions(-DHARDWARE_INTERNAL_MODULE) add_definitions(-DINTERNAL_MODULE_ELRS) add_definitions(-DINTERNAL_MODULE_SERIAL_TELEMETRY) set(INTERNAL_MODULE_MULTI NO) set(TARGET_SRC ${TARGET_SRC} #../common/arm/stm32/intmodule_serial_driver.cpp ) endif() Does it look like Elrs only supports stm32?

Sorry, I made a mistake. This stm32 has been annotated. However, it's strange why 4IN1 cannot be YES with ELRS at the same time as "set (INTERNAL_MODULE-MULTI NO)"? I think it's just a matter of switching between them during use, right

zhuwei commented 5 months ago

It seems like even if ELRS is enabled, I can't seem to find where to set up GPIO

JunOllyLi commented 5 months ago

The part of code you quoted earlier was copied from the STM32 code and I just commented it out since I did not really use it. Based on that, it seems the ELRS module also talks to the SOC over UART. I doubt you can connect 4In1 and ELRS to the same UART and switch at runtime... On the other hand, I think the ESP32 UART would work with ELRS as well. I just never used it since I don't have any ELRS

zhuwei commented 5 months ago

The part of code you quoted earlier was copied from the STM32 code and I just commented it out since I did not really use it. Based on that, it seems the ELRS module also talks to the SOC over UART. I doubt you can connect 4In1 and ELRS to the same UART and switch at runtime... On the other hand, I think the ESP32 UART would work with ELRS as well. I just never used it since I don't have any ELRS

Understood, I really haven't found the place to set it up. I will try using the same serial port

zhuwei commented 5 months ago

Joystick that requires a serial port is uncomfortable because it is very expensive. I feel like giving up (I bought half of the components) T_T

JunOllyLi commented 5 months ago

Joystick that requires a serial port is uncomfortable because it is very expensive. I feel like giving up (I bought half of the components) T_T

Well, nowadays, people DIY things mostly for passion, not really for cost saving. It probably would be hard to beat the price of a real product from the manufacture line.

zhuwei commented 5 months ago

Joystick that requires a serial port is uncomfortable because it is very expensive. I feel like giving up (I bought half of the components) T_T

Well, nowadays, people DIY things mostly for passion, not really for cost saving. It probably would be hard to beat the price of a real product from the manufacture line.

But in my place, the 4in1+Elrs remote control for cars and ships doesn't feel cheap. More importantly, the joystick of the vehicle and ship cannot be replaced by FlySKy Hall gimbal

JunOllyLi commented 5 months ago

So you already have some cars and ships that had the RX included and you are just trying to find TX to match it? Then I probably cannot help you if your concern is about the cost. But if you are starting from scratch, then no need to stick with 4in1 or ELRS. Just get a cheap FlySky FS6 series TX and an RX to work with it.

zhuwei commented 5 months ago

So you already have some cars and ships that had the RX included and you are just trying to find TX to match it? Then I probably cannot help you if your concern is about the cost. But if you are starting from scratch, then no need to stick with 4in1 or ELRS. Just get a cheap FlySky FS6 series TX and an RX to work with it.

Yes, because I play model aircraft, I have many RX with different protocols on hand