-
Notifications
You must be signed in to change notification settings - Fork 205
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
Adding Lilygo ESP32S3 Platform Support #203
Comments
Sorry but you started wrong, because there is a PR #180 that is still not merged, that will enable EPDiy to compile in IDF v 5.0 |
@THSLP13 since it's on your own best interest to have this working on Arduino, please help me test this PR: #180 (comment) |
Hi,thanks for your reply. |
When my Lilygo S3 arrives I will try to port the updates over the existing working branch on IDF v5. I started on my fork but is very raw still and needs to be debugged. |
I'm curious how the S3-based board will perform. I have some normal S3 dev boards on the way since the Lilygo board is a bit expensive and not flexible enough for prototyping, but I'm confident @martinberlin can make the necessary changes :) |
@THSLP13 you can try this: https://github.com/martinberlin/epdiy-rotation/tree/lilygos3 Just checkout the lilygos3 branch. Note that it will work only with ESP-IDF ver. 5-beta1
It's much slower. I don't know if it would be possible to improve that (Measured with CPU at 240Mhz, is not related to CPU, is the esp_lcd data speed) |
@martinberlin Using the LCD peripheral to output each line separately probably also adds a lot of overhead. I'll be back at home where I have my oscilloscope in ~10 days and by then my S3 boards will hopefully have arrived, so I can do some experiments. |
Nice work though for porting to esp_lcd as a prototype :) Did you try higher pixel clocks and did that make a difference? |
Thanks Valentin but in fact I just cleaned up Lilygo's take on this and adapted it to the latest version. I tried different clocks including the fastest one as described here in esp_lcd docs. Note that the 240Khz that uses PLL_D2 drops a lcd_i80_select_periph_clock(490): unsupported clock source: 7 The dragon takes: update_screen() 1620 ms -> to be drawn. Still high but better than 2 seconds.
Yes that is a great idea. In my opinion this is slower because in the older version you filled a buffer while sending the other. But this one uses just 1 so it's like double slow. I'm quite sure that well optimized can be some good percentage faster with S3 that is at least 15% faster and maybe has a faster PSRAM also. But we cannot confirm it till someone tries that for real. If that is possible then a new board with S3 makes great sense for big panels. On other rants that crossed my head using this board: What makes me crazy about this new Lilygo S3 board is that they did something weird with the Serial. A flash monitor often delivers: And you have to flash it 2 times in order to get the new program flashed. This and the fact that after 2 days of using it has a dead row make me discard this as anything that will use on the future, even though is a great info for us Lilygo going forward with this new MCU, so we can make a powerful S3 board and they are proven IOs that work. |
Attention: Additional weirdness found in this LilygoS3 device: This is my BLE receive JPG demo. Just an experimental receive and decode JPG that is too slow to be anything useful (100Kb in about 30 seconds, but hey consumes less than WiFi) And what I found is this: Still in my humble opinion, this is a highly experimental device, that I won't think even remotely to use in any real-life project. Is a pity, because the idea is good, and has SD card and an RTC on board. A lot of goodies, but this failures make it really untrustworthy. To discard that is my part of porting this to the new version of EPDiy I just ran their code with a simple program that does only this in arduino-esp32: void loop() {
epd_poweron();
epd_clear();
epd_poweroff();
delay(1000);
} No Wifi, or BLE, just that and this is the result: About 294 mA spikes every time epd_poweron() triggers the HV pumps (Or what is that otherwise) |
Damn, that sounds bad. Is the lilygo board still using the LT1945-based power generation? I think epdiy v5 had a rather high inrush current as well, but the TPS65185 in v6 should not have this problem. In a way, it's good to have them do some mistakes, so we can learn from them and avoid them ;) Regarding the clock speed: If we can get DMA working and fill the buffer while the LCD peripheral is feeding the EPD, a clock speed of ~30MHz should be sufficient for all EPDs i've checked. Maybe 35MHz if we account for some overhead. So the trick will be in efficiently using DMA and both cores of the ESP. I'm currently thinking of the following architecture: |
Hi Valentin,
Yes they are still using them: U2 ( Schematics ) |
I think the S3 dev board will probably arrive before your lilygo board, so I'm not sure if it's worth it. Once we have our own board it will (hopefully) be obsolete anyway ;) But if you really don't need it / want it it could be useful as a backup :) |
Here are our test results: The test code is: https://github.com/Xinyuan-LilyGO/LilyGo-EPD47/tree/perfect-refresh/examples/drawImages The full refresh time is about 450ms. |
I think double buffering, the improvement may be less than 5%, because the current method only takes some more copy time than buffering, which is almost negligible. |
My test was after being ported to EPDiy using IDF v5.
Yes sure, but that's after receiving the framebuffer, when it starts rendering! That is the update_screen() which is sending the parallel data. Note that this version supports Waveforms, I don't have any idea if that can add more time, maybe Valentin can tell more about that. About the spikes in consumption in epd_poweron() @liangyingy you should take a look for yourself. This will reset the device if it's using while other consuming things are taking place, like WiFi or BLE. And in my humble opinion, this makes your S3 device hardly usable, if you need to draw stuff while downloading an image. But don't take me wrong here: I like a lot the hardware on the device, it cames with goodies like RTC on board, Raspberry Pi connector and more. I'm just criticizing it objectively from a user point of view, precisely because I want to use it for something. |
We should have a unified interpretation of the concept of full refresh. The full refresh time I think is the time it takes to call |
There is a reset problem using ble or wifi, is it found by which code test? We want to reproduce this bug. |
Hi Liang, https://github.com/martinberlin/epdiy-rotation/tree/lilygos3
It's on examples/ble-image Here you can find an article I wrote about BLE receive JPG. |
I ran ble-image on both boards and no device reset occurred. The current is about 250ma. |
It occurs only when it receives data. When it's idle of course does not consume. If you want I can prepare an account for you with the right configuration and image gallery so you can log in and try it right away. My email is on my GitHub profile |
The above test result is to use https://cale.es/ to send the image to the device through ble. |
Great. But did you tried to remove my ifdef pre-processor directives so it does an epd_poweron() / epd_poweroff() Try to change here: void epaper_power_off() {
#ifndef CONFIG_EPD_BOARD_REVISION_LILYGO_S3_47
epd_poweroff();
#endif
} That function wrapper I did just to avoid switching power on /off and avoid the reset. Just leave it with the epd_poweroff() and try to receive the image again. By the way if you want to add a BLE receive image example feel free to use it also in your own repository. I can share also the backend part that converts the JPG into HEX bytes. |
You can apply the following patch and run it on your device if there is still a device reset issue: Please add the following patch to epdiy-rotation: diff --git a/examples/ble-image/main/gatt_server_receive.cpp b/examples/ble-image/main/gatt_server_receive.cpp
index d38744c..1357820 100644
--- a/examples/ble-image/main/gatt_server_receive.cpp
+++ b/examples/ble-image/main/gatt_server_receive.cpp
@@ -222,9 +222,9 @@ extern "C"
* That means you cannot turn on -> draw something fast -> turn off or you will have a Reset
*/
void epaper_power_off() {
- #ifndef CONFIG_EPD_BOARD_REVISION_LILYGO_S3_47
+ // #ifndef CONFIG_EPD_BOARD_REVISION_LILYGO_S3_47
epd_poweroff();
- #endif
+ // #endif
}
void progressBar(long processed, long total)
@@ -303,7 +303,7 @@ int decodeJpeg(uint8_t *source_buf, int xpos, int ypos) {
if (jpeg.decodeDither(dither_space, 0))
{
time_decomp = (esp_timer_get_time() - decode_start)/1000 - time_render;
- ESP_LOGI("decode", "%d ms - %dx%d image MCUs:%d", time_decomp, jpeg.getWidth(), jpeg.getHeight(), mcu_count);
+ ESP_LOGI("decode", "%ld ms - %dx%d image MCUs:%d", time_decomp, jpeg.getWidth(), jpeg.getHeight(), mcu_count);
} else {
ESP_LOGE("jpeg.decode", "Failed with error: %d", jpeg.getLastError());
}
@@ -489,7 +489,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
}
case ESP_GATTS_READ_EVT:
{
- ESP_LOGI(GATTS_TAG, "GATT_READ_EVT, conn_id %d, trans_id %d, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
+ ESP_LOGI(GATTS_TAG, "GATT_READ_EVT, conn_id %d, trans_id %ld, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
esp_gatt_rsp_t rsp;
memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
rsp.attr_value.handle = param->read.handle;
@@ -518,7 +518,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
(param->write.value[2] << 8) +
(param->write.value[3] << 16) +
(param->write.value[4] << 24);
- ESP_LOGI(GATTS_TAG, "0x01 content-lenght received:%d", received_length);
+ ESP_LOGI(GATTS_TAG, "0x01 content-lenght received:%ld", received_length);
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
}
@@ -531,8 +531,8 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
time_receive = (esp_timer_get_time()-start_time)/1000;
decodeJpeg(source_buf, 0, 0);
- ESP_LOGI("ble-rec", "%d ms - download", time_receive);
- ESP_LOGI("render", "%d ms - copying pix (JPEG_CPY_FRAMEBUFFER:%d)", time_render, JPEG_CPY_FRAMEBUFFER);
+ ESP_LOGI("ble-rec", "%ld ms - download", time_receive);
+ ESP_LOGI("render", "%ld ms - copying pix (JPEG_CPY_FRAMEBUFFER:%d)", time_render, JPEG_CPY_FRAMEBUFFER);
epd_poweron();
epd_hl_update_screen(&hl, MODE_GC16, temperature);
@@ -546,7 +546,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
memcpy(&source_buf[img_buf_pos], param->write.value, param->write.len);
img_buf_pos += param->write.len;
- ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, total:%d", param->write.len, img_buf_pos);
+ ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, total:%ld", param->write.len, img_buf_pos);
}
// Debug received bytes
diff --git a/src/epd_driver/board/epd_board_lilygo_s3_47.c b/src/epd_driver/board/epd_board_lilygo_s3_47.c
index d71e1f7..57089d1 100644
--- a/src/epd_driver/board/epd_board_lilygo_s3_47.c
+++ b/src/epd_driver/board/epd_board_lilygo_s3_47.c
@@ -27,13 +27,14 @@
/* Edges */
#define CKH GPIO_NUM_41
-typedef struct {
+typedef struct
+{
+ bool ep_latch_enable : 1;
bool power_disable : 1;
bool pos_power_enable : 1;
bool neg_power_enable : 1;
- bool ep_scan_direction : 1;
- bool ep_latch_enable : 1;
bool ep_stv : 1;
+ bool ep_scan_direction : 1;
bool ep_mode : 1;
bool ep_output_enable : 1;
} epd_config_register_t;
@@ -98,8 +99,7 @@ static void epd_board_init(uint32_t epd_row_width) {
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[CFG_DATA], PIN_FUNC_GPIO);
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[CFG_CLK], PIN_FUNC_GPIO);
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[CFG_STR], PIN_FUNC_GPIO);
-
-
+
fast_gpio_set_lo(CFG_STR);
config_reg.ep_latch_enable = false;
@@ -160,20 +160,6 @@ static void epd_board_poweron(epd_ctrl_state_t *state) {
fast_gpio_set_hi(STH);
}
-void epd_powerdown_lilygo_t5_47() {
- config_reg.pos_power_enable = false;
- push_cfg(&config_reg);
- busy_delay(10 * 240);
- config_reg.neg_power_enable = false;
- push_cfg(&config_reg);
- busy_delay(100 * 240);
- config_reg.power_disable = true;
- push_cfg(&config_reg);
-
- config_reg.ep_stv = false;
- push_cfg(&config_reg);
-}
-
static void epd_board_poweroff_common(epd_ctrl_state_t *state) {
// POWEROFF
epd_ctrl_state_t mask = { // Trigger output to shift register
@@ -203,8 +189,17 @@ static void epd_board_poweroff_common(epd_ctrl_state_t *state) {
static void epd_board_poweroff(epd_ctrl_state_t *state) {
// This was re-purposed as power enable.
- config_reg.ep_scan_direction = false;
- epd_board_poweroff_common(state);
+ config_reg.pos_power_enable = false;
+ push_cfg(&config_reg);
+ busy_delay(10 * 240);
+ config_reg.neg_power_enable = false;
+ push_cfg(&config_reg);
+ busy_delay(100 * 240);
+ config_reg.power_disable = true;
+ push_cfg(&config_reg);
+
+ config_reg.ep_stv = false;
+ push_cfg(&config_reg);
}
static void epd_board_poweroff_touch(epd_ctrl_state_t *state) {
diff --git a/src/epd_driver/i2s_data_bus_s3.c b/src/epd_driver/i2s_data_bus_s3.c
index 48b0b8f..7910f5b 100644
--- a/src/epd_driver/i2s_data_bus_s3.c
+++ b/src/epd_driver/i2s_data_bus_s3.c
@@ -53,7 +53,7 @@ static bool notify_trans_done(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_
void i2s_bus_init(i2s_bus_config *cfg)
{
- ESP_LOGI(TAG, "Initialize Intel 8080 bus\n6:%d 7:%d 4:%d 5:%d 2:%d 3:%d 0:%d 1:%d\nstart_pulse:%d clock:%d\nepd_row_width:%d",
+ ESP_LOGI(TAG, "Initialize Intel 8080 bus\n6:%d 7:%d 4:%d 5:%d 2:%d 3:%d 0:%d 1:%d\nstart_pulse:%d clock:%d\nepd_row_width:%ld",
cfg->data_6,cfg->data_7,cfg->data_4,cfg->data_5,cfg->data_2,cfg->data_3,cfg->data_0,
cfg->data_1, cfg->start_pulse, cfg->clock, cfg->epd_row_width);
Here is the current when rendered (at the red arrow): |
Nice catch 👍 |
Adding support for their board should be straightforward, but we don't have any hardware to test. I don't feel like buying one from my own money though, i'd rather spend it on epdiy boards. |
@ggros esp32s3 is already supported. As @vroland mentioned you need to add a board. |
Yes interested to test, if I get it to work I will do the PR. |
Hello @vroland Update about adding Lilygo board S3: |
Emailed Lilygo to see if I can get a discount coupon for Tindie. Sorry but I’m also refusing to buy a new S3 EPD047 since I don’t have any project with it and I’m doing it just to have it working with this epdiy update. UPDATE: Lilygo is sending me an EPD047 S3 to my new address so I will hopefully collaborate adding a new driver. If someone wants an older but still 100% working Lilygo EPD047 ESP32-WRover version I can ship it just for the sending costs |
The board arrived some days ago. After this end of the year time I will start slowly adding the new S3 Lilygo board. I will need some of you to test it once I make the pull request |
I also have an LilyGo T5 4.7 S3. Mine has as EPaper an ET047TC01-SD. The LilyGo T5 4.7 has an ED047TC1. Not sure what the difference is between them. |
@martinberlin was busy lately to experiment more but happy to test your pr |
All that I know is that in S3 has a flexible display. Old one was not flex (And for me was a bit nicer) |
I found in a display database that the S3 display has supposedly a bit higher contrast. |
You should ask Lilygo. All I know is that there is an open source one, and another Waveform: epdiy_ED047TC2 that they provided. Just try it out |
By the way @THSLP13 are you still interested to have this working? |
Update: Started with this https://github.com/vroland/epdiy/tree/203/lilygo-s3 However as I mentioned before, this is using LEH & STV signal via an IO expander, something that is not done AFAIK since v4 that already used an ESP32 GPIO for Latch enable. So I need to take a decision: I either implement Lilygo Solution, that is using a mix of LCD module and RTC to do this. Or someone else implements it and I send the Hardware to him/her, but ONLY if there is a commitment to implement it. Otherwise makes no sense. I'm really very close to give up on this one, since I've more interesting things to do than fight with this piece of hardware. |
Sorry guys but me at least, won't take any more time to work adding this board, for the facts mentioned above. After all, I do not have any interest at all, to use Lilygo S3 EPD047 board. Is really a nice thing that they got working the S3 in LCD mode, but as they've kept on using a v2 version of this project is really a weird combination. |
This is my video explanation of why I downvote this board to be added in epdiy: @vroland if you agree then we can close this |
@martinberlin in your fork I do not see recent commits, is it ok? Where you able to make that board work along with CalEPD ? |
Hi @ggros like I commented above it was decided that this board will not be supported in epdiy. So you can use either use my fork or Lilygo’s own repository.
Yes is an older version but for this board is the same. I'm really not willing to add this board for the reasons already described in this ticket. If someone wants to add it, this is open source, so just fork it and follow what I did. IMHO does not make sense to refactor many parts of the code just for this board, that is like version 2 of the PCB but with LCD component (Albeit in a much slower fashion than v7) CalEPD is mostly for SPI and when I tried parallel it used epdiy as a component. |
A new board from Lilygo published.
It uses ESP32S3(N16R8) as controller,and uses ED047TC1(Soft ver.) as display.
I try to make a patch to my own code,but arduino IDE only throws a lot of(99+) error to me.
When I simply compile code from your example,IDE throws errors again,and throws the same errors.
So I write the issue.
The code from Xinyuan-LilyGO works normal and fully functional,but they hasn't update their code such as update mode,they just update the pinmap and I2S Sources.
(Hint:Select S3 branch to get S3 version driver from lilyGo)
Most errors contains declaration error.
Please notice me if you need further information about this problem.
The text was updated successfully, but these errors were encountered: