-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCD SPI with shared DC / MISO does not return MISO back to initial INPUT state (IDFGH-14740) #15478
Comments
Hi @jlmurdoch Can you try if the following fix help? diff --git a/components/esp_lcd/spi/esp_lcd_panel_io_spi.c b/components/esp_lcd/spi/esp_lcd_panel_io_spi.c
index 57948340294..70c299c5182 100644
--- a/components/esp_lcd/spi/esp_lcd_panel_io_spi.c
+++ b/components/esp_lcd/spi/esp_lcd_panel_io_spi.c
@@ -93,11 +93,9 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p
// if the DC line is not encoded into any spi transaction phase or it's not controlled by SPI peripheral
if (io_config->dc_gpio_num >= 0) {
- gpio_config_t io_conf = {
- .mode = GPIO_MODE_OUTPUT,
- .pin_bit_mask = 1ULL << io_config->dc_gpio_num,
- };
- ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err, TAG, "configure GPIO for D/C line failed");
+ gpio_set_level(io_config->dc_gpio_num, 0);
+ gpio_func_sel(io_config->dc_gpio_num, PIN_FUNC_GPIO);
+ gpio_output_enable(io_config->dc_gpio_num);
} |
Thank you @suda-morris ! - this is working for me (with minor include additions). I tested with I'll go off and test the W5500... Before change:
After change:
Changes made to patch:
|
The W5500 Ethernet (esp_eth) over SPI is continuing to fail when the esp_eth timer tries to check the link. If I remove esp_lcd, it works. It may be that the half duplex SPI that the esp_lcd uses causing issues. Let me know if a separate GitHub issue should be raised. Repeating error below:
|
Answers checklist.
IDF version.
v5.4
Espressif SoC revision.
ESP32S3
Operating System used.
Linux
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
M5Stack CoreS3 SE
Power Supply used.
USB
What is the expected behavior?
An SPI LCD operations using a shared DC/MISO line should allow other SPI devices sharing the same SPI host bus to regain control by converting the DC OUTPUT line back to an MISO INPUT when the bus is released.
What is the actual behavior?
The SPI LCD init initializes the D/C line as an OUTPUT and never restores the MISO line to an INPUT, causing other devices to receive no data from the SPI bus, resulting in timeouts or no data.
Steps to reproduce.
Debug Logs.
More Information.
This is an M5Stack CoreS3 SE, so there an understanding there will be unavoidable GPIO / SPI contention and the DC / MISO sharing is an edge-case
I have tested the following modules which stop working when the LCD is initialized / used:
Initialization of the DC / MISO line as an OUTPUT is done here:
esp-idf/components/esp_lcd/spi/esp_lcd_panel_io_spi.c
Line 97 in 0461e2f
No other signs of restoring the MISO to an INPUT is visible in
esp_lcd_panel_io_spi.c
, other than a gpio-based reset upon esp_lcd failure.Adding a
gpio_set_direction(PIN_NUM_MISO, GPIO_MODE_INPUT)
after an LCD action makes the SPI devices work, but causes the LCD to stop functioning.I have attempted to modify the SPI LCD callbacks, with mixed results (i.e. commands work, but longer color transfers fail). I probably need to perform a reset on the MISO line.
The text was updated successfully, but these errors were encountered: