Skip to content

Update the GENERIC-7789 firmware#169

Open
asherevan wants to merge 2 commits intorusshughes:masterfrom
asherevan:master
Open

Update the GENERIC-7789 firmware#169
asherevan wants to merge 2 commits intorusshughes:masterfrom
asherevan:master

Conversation

@asherevan
Copy link
Copy Markdown

I updated the GENERIC-7789 firmware

@dusan-zervan
Copy link
Copy Markdown

Thank you, it is working (MicroPython v1.24.0-preview.309.gf1bdac375.dirty on 2024-09-17), but LCD SPI is limited to 26 MHz, there is an error when 40 MHz is set:

E (2261) spi_hal: spi_hal_cal_clock_conf(110): When work in full-duplex mode at frequency > 26.7MHz, device cannot read correct data.
Try to use IOMUX pins to increase the frequency limit, or use the half duplex mode.
Please note the SPI master can only work at divisors of 80MHz, and the driver always tries to find the closest frequency to your configuration.
Specify SPI_DEVICE_NO_DUMMY to ignore this checking. Then you can output data at higher speed, or read data at your own risk.

Then fatal error and reboot.

@asherevan
Copy link
Copy Markdown
Author

I will work on fixing that.

@asherevan asherevan marked this pull request as draft December 24, 2024 17:29
I should have added support for 40 MHz SPI.
@asherevan asherevan marked this pull request as ready for review December 29, 2024 03:52
@asherevan
Copy link
Copy Markdown
Author

It should work now.

@dusan-zervan
Copy link
Copy Markdown

Thank you for your work, but it is still not working for me:
spi = SPI(1, baudrate = 40_000_000, sck = Pin(13), mosi = Pin(15), miso = None)

E (92552) spi_master: spi_bus_add_device(427): assigned clock speed not supported

Then the program continues, but crashes. I am using M5StickC Plus, old version was working fine on 40 MHz, some pieces (we have dozens) also on 80 MHz.

@asherevan
Copy link
Copy Markdown
Author

It is working for me with this code:

spi = machine.SPI(1, baudrate=40000000)

It could be the pins you are using. I am not sure.

@jluiscu
Copy link
Copy Markdown

jluiscu commented Feb 19, 2025

Thank you, everything works very well on the ESP32 TTGO, with the particularity of the frequency being a maximum of 26000000, but perhaps it is due to the fact that this specific board needs something special that the generic one does not have. However, for my projects, it works great. I needed ESPNOW.

@dusan-zervan
Copy link
Copy Markdown

Well, I have found the reason, why the SPI frequency is limited to 26 MHz: there is a check condition in IDF 5 which is not allowing to set higher frequency, if other than ideal pins are used. The condition is in IDF file /opt/esp/idf/components/hal/spi_hal_iram.c. Easy patch is to add this line just after all #include directives:
#undef SPI_LL_SUPPORT_TIME_TUNING

Tested on M5StickC Plus and LILYGO T-Display.

You can download my firmware builder or .bin file with latest MicroPython: https://github.com/dusan-zervan/st7789_mpy-builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants