-
Notifications
You must be signed in to change notification settings - Fork 226
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
Introduce RGB/DPI driver #2415
Introduce RGB/DPI driver #2415
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this PR, I was considering working on this need.
I've tested this on a 7" with an EK9716 display controller, and it appears to be working. Board used: https://www.aliexpress.com/item/1005005560920555.html I've not done any kind of exhaustive tests - just run the lcd_dpi.rs from the example directories (with pins modified for the above board). The example code results in the screen going through various colors. On my device, it appears to flicker fairly intensely. Changing the clock to 40 & 50 Mhz seems to help with the flicker a bit. Using 33 Mhz results in interesting artifacts on 2/3 of the display. In any case, this MR has my vote! Getting this into main would be a tremendous step forward! |
Curious, in addition to the pins, did you also update the frame timings? |
please forgive the horrible video and my silly commentary (also, apologies for using YouTube) - https://www.youtube.com/shorts/tHPwoWvb11o Also, I had to turn on the backlight to actually see the screen. The flicker could be from the backlight, or not using ledc to dim it... or, or or ... I confess, I'm so new to rust, I'm still fighting with the borrow checker, but I am excited as can be to get this working! |
I suppose it can't be helped for this example since every single frame is a different color. Trying to see it on video was a lost cause to begin with haha. Would need a different example, one that alternates between two colors once a second.
This is where I need to write some documentation.
I'm glad this helped! Just to be sure about the flickering, try changing the example to only draw on color and see if it still flickers. dpi.send(false, dma_buf).map_err(|e| e.0).unwrap(); to this dpi.send(true, dma_buf).map_err(|e| e.0).unwrap(); |
I can add to the review that I've tried this on the 4.3" cheap yellow board, at 800x480, and it looks wonderful. The 4.3" uses a ST7262. The "flicker" i'd reported is definitely not flicker, but the backlight being a bit over-powered. |
590b5fa
to
e4a9fa8
Compare
e4a9fa8
to
f7c9e3f
Compare
@MabezDev as requested, the example now runs on the official devkit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for porting the example to the official devkit ❤️, unfortunately the devkit we have in the office is an older rev and the example isn't working.
I think we can still merge this as is for now, given that you have it tested, and we'll get a new rev of the board for testing later down the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the comment regarding #[non_exhaustive]
on the Config
struct, but otherwise changes LGTM I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@Dominaezzz I can't find the example any longer in the latest examples folder, did it move?
@jgtaylor I also want to use ST7262, does the example work as is or did it require any changes? |
It was moved. https://github.com/esp-rs/esp-hal/blob/main/qa-test/src/bin/lcd_dpi.rs Also, note that I changed the example after jgtaylor's comment. So you'll need to update the |
I received the board I want to use, it is 5", based on ST7262, 800x480. I don't understand what the These are the pins descriptions they provide: <style> </style>
This is from an Arduino example included, some values are available here I see:
|
Some displays require initialisation via SPI, before the DPI interfaced can be used. With regards to what pins to use, the pin names mostly match what the |
So all those INIT_ CMDS are not relevant? (since I'm commenting out most of the code, want to verify) |
This part is unfortunately a bit confusing because the names don't quite mean what you think. I know it's probably not the quick answer you're looking for but I recommend taking a look a this resource that explains the protocol. The LCD_CAM is able to infer the some of the timings so you won't find every single LCD timing parameter in the
Probably not. If your display doesn't have SPI then it's not relevant. |
Thanks! It's working. I used some of the values from the Arduino code for the the timing, I see on the right most vertical line some glitches but I guess by playing a bit with the numbers it will be resolved. Now need to move on to make it produce some graphics. Expect questions on DMA soon 😄 If I understand correctly your demo then its a 16u16 dma buffer and when the code does |
Try increasing the DMA buffer size.
Yup!
I'm excited to see where this goes. Just be aware that esp-hal is currently lacking #2083, which limits your options. |
Oh ... When is that planned to be resolved? |
The latter mostly but of course, it depends on the frequency of all the moving parts.
It is practical, yes. Just means the FPS would be on the lower side of the spectrum.
This is probably fine. Any issues arising from PSRAM bandwidth, would manifest in the image being rendered, the rest of your application would run just fine.
The last time I brought it up in a community meeting, it wasn't accepted for prioritisation. (Perhaps lack of demand at the time didn't help) Are you planning on using Slint on this as well? Or embedded-graphics? Or? |
Yes, for Slint. How can that not be prioritized? There are so many esp32 boards with RGB displays (3.5" is the largest I found without) that can't be used w/o this (or at risk of failing at some point). IMO this is so much more important than so many other changes made, that have their value, but they don't increase the reach of esp-hal to additional applications and use cases. And it doesn't seem like something the community would be able to take care of, this looks like hard-core esp32 internals. You can bring my vote in favor of this. I guess the reason for this not being voted is because people who want to do graphics on esp32, check out what's available, and eventually dump rust and esp-hal in favor of C (lvgl, etc.) because it looks so challenging to get something working (and it really is). This could make rust the easiest language to develop ESP32 applications with UI if you ask me. |
With Slint you may be able to implement bounce buffers (see esp-idf docs for explanation) and avoid PSRAM altogether. Yeah there's also other benefits to that feature but oh well. Another problem is none of the Rust devs know how it works, they'd have to do some additional research. Put your +1/vote on the issue at least. 🙂 |
That would mean pretty heavy load on the CPU, won't it? full time rendering. With complex UI it's not cheap.
I'm sure you can do it 😄
Done! + wrote the justification. |
yhh, trade offs |
I just remembered, the CPU load could be minimised by using DMA memcpy. It'll need some tuning to get right. |
By 'bounce buffers' do you mean to render using slint at real time as the display is being fed with data using a small memory area of only several lines? |
Bounce buffers work for both. The former would be ideal but I'm not sure if Slint will actually draw the screen fast enough to keep up with the LCD_CAM. Maybe with a bit of a head start it could work. Code execution will impact the DMA from PSRAM to internal RAM, but if the bounce buffer is large enough, any slow downs should be absorbed by the buffer. I did get this to work with on the idf side, so it's certainly feasible. esp-hal is currently not exposing the DMA interrupts yet so you'll need the PAC to do this rn. |
Oh boy, that sounds complex... |
It is complex indeed.
@ MabezDev is the team lead, he's the one that needs convincing. |
I've been working on trying to implement a My latest effort has been to look into how it's done in the Sadly, unless I become a Rust expert very soon (improbable), I will merely continue to bang my head on my keyboard as I very, very, slowly get good 😀 |
Given the tremendous amount of work we have ahead of us trying to get a stable release out, I would not get your hopes up. This is completely outside the scope of our current focus. Will probably be faster for you to implement it yourself and submit a PR. |
@jessebraham thanks for the update and setting expectations.
I wish I knew how to implement something like this. #2083 looks like way beyond my understanding of esp32. I'm more on the application programming side.
Can we ask for it to be considered for next release then? As I stated on the issue, it opens up large set of applications that are currently blocked from esp-hal. I think there's a strong justification for implementing it. |
The esp-idf code snippet that bjeorn posted looks like it would do the trick. |
When we have published the Right now, we need to focus on creating a product that paying customers are able to use so that we can continue to justify an entire team of engineers being paid to work on this project. We have been discussing and planning this release for months already, so we need to focus on the scope of work which we have already committed to. Realistically, our current plans will likely take us until late spring or early summer to complete. The community is welcome to contribute unstable drivers in the meantime and we will of course be happy to review them. |
Great to hear 1.0.0 is on the horizon! I wasn't aware of that. Speaking of paying customers, I believe there's a significant commercial opportunity in GUI based embedded systems, and with Slint available (looks like they are building their revenue stream mostly around that) Rust seems to have the potential to become the easiest language for developing such applications. Anyway, I'll try sometime soon to take a stab at implementing this myself, maybe I'll be able to get something working. Thanks! |
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
Add a driver for the RGB mode of the LCD_CAM peripheral. Closes #2081.
I've called it
Dpi
sinceRgb
is a generic name (though I don't mind renaming it if anyone insists). TheI8080
driver has similar opinionated name.I've opened this early as a formal request for one of the maintainers to acquire a devkit that can run the example.Makerfabs MaTouch_ESP32-S3 Parallel TFT with Touch 4.3"
(I tried using the espressif devkit linked in the issue but the initialization code is buried deep in esp-bsp and it would complicate the example with bitbanging SPI over an I2C gpio expander)The example runs on the official espressif devkit ESP32-S3-LCD-EV-Board.
Testing
HIL test and example