-
Notifications
You must be signed in to change notification settings - Fork 1k
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
C Setup with UC1608 on STM32 #179
Comments
U8g2 works nicely without C++/Arduino. And yes, it is right, i never found time to document this. Some startingpoint could be this: Then there was a similar question some time back: #117 As mentioned, your first step should be a new delay & GPIO procedure. Once you have this procedure, you can at least display something. Further speed improvements can be done, by writing a byte communication procedure. Taking your setup: void u8g2_Setup_uc1608_240x128_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb) First argument is an empty fresh pointer to a u8g2 structure u8g2_t u8g2; Second argument is the rotation callback. void u8g2_Setup_uc1608_240x128_f(&u8g2, U8G2_R0, ...) Third argument is the byte procedure. Suggestion is to use one of the existing "bitbanging" procedure. Once your display works, you can decide to replace this by a custom procedure (and add your own DMA support). void u8g2_Setup_uc1608_240x128_f(&u8g2, U8G2_R0, u8x8_byte_4wire_sw_spi, ...) Finally you need the mentioned delay and GPIO procedure, but i guess this is described in the referenced documents. Let me know if you have further questions. |
One more point: You do not need to deal with buffers. This is handled by u8g2. The typical setup (taken from the arm project mentioned in #117) looks like this:
|
I did some updates here also: |
Thank you very much! This is exactly what I needed to know :)
but I had small problem with defining buffer for full frame. Default function is
but with static array declaration it just go crazy and eat all of the RAM memory (I am using System Workbench from ac6 tools) and have no idea why it is doing this. The RAM size is 32 kB and compiler said, that it will need another ~57kB of RAM. So I declared the buf[1920] as global variable in the main.c and it works now (allocate only 1920 bytes).
Is there some kind of limitation (for example drawing on two halfs of the display) or did I missed something? |
Remarks:
|
Thank you! I successfully managed to implement these changes and everything works great! |
Hi! I've been trying to use u8g2 lib with my STM32 and i can't do it work.
In the main(), i've configured the display as you explain in the the wiki, using:
Finally in the loop, i've tryed to draw a line with the code,
but it doesnt print nothing in the display, help please |
Is CS connected to Pin 6? If yes, shouldn't it be inverted? |
Yes, i was inverted. Now i've solved this problem but when I try to draw something, the display prints it
|
U8g2 itself is optimized for speed, but you may change your interface code:
Instead i think the following should be faster:
Additionally I saw same user posts that HAL_SPI_Transmit for STM32 is slow. But because I do not know anything on the HAL_SPI_Transmit I can not support here. |
Ok, got it!!! Thanks!!!! |
Hi, I have put code on: https:/nikola-v/u8g2_template_stm32f103c8t6 |
I have added your project to the STM related U8g2 links: https:/olikraus/u8g2/wiki/Porting-to-new-MCU-platform#stm32 |
The request from EEJerry is discussed here: #2240 |
Hello,
I was using u8glib (it is really great!) on AVR few years, but now I am working with STM32L1xx. I decided to go with new version (u8g2) with C, not C++. But there is no C Setup example or introduction (only for C++) so I started to implement my code (no Arduino, not a fan).
Basically I wrote SPI communication layer with UC1608 using DMA and all I need is to have working drawing functions to frame buffer, which I will then send to the display (240x120 px, ERC240120FS-1).
Because there is no documentation for u8g2_Setup_uc1608_240x128_f, I was unable to use it. But for drawing functions are only important dimensions of the display, buffer size/address and screen rotation, right?
The initialization above was rewrited to
Then I tried to draw line with u8g2_DrawLine(&u8g2Instance, 30, 30, 60, 60); but nothing happened in the frame buffer. Communication with the display is working.
May I get some help with implementing this library in C without using arduino?
Thank you in advance!
The text was updated successfully, but these errors were encountered: