Skip to content

Conversation

@ptb99
Copy link

@ptb99 ptb99 commented Jan 22, 2023

I am working with this display board and the Raspberry Pi Pico:
https://www.waveshare.com/wiki/Pico-ResTouch-LCD-3.5

I tried your driver from the main branch in Github, but it didn't work for me. The main problem was that writing command parameters with SPI.write() only works if I write a single byte per write() call. I don't have a clear explanation for this, but looping one write() call per byte seems to be a safe workaround.

In addition, I found a bunch of opcodes that carried over from the source driver for ILI93xx chips but do not appear in the ILI9488 data sheet. I updated these codes based on the data sheet (although I didn't include everything in the data sheet). Similarly, the initialization code contained commands or parameters that didn't make sense based on the ILI9488 data sheet. I reduced these to a fairly minimal set that works OK for me.

Finally, I found that the code for draw_text8x8() had a bug with foreground and background colors. It turns out that any code using Micropython's FrameBuffer and the block() method to copy the FB's backing buffer to the ILI9488 is problematic. This is because FrameBuffers store the 16-bit colors in native byte-order (which is little-endian) while the ILI9488 expects colors to be big-endian. I couldn't find any code or hooks in FrameBuffer to deal with this, so I added code to the driver for byte-swapping and then flip the color value before writing into the FrameBuffer.

I don't know how much you are actively maintaining/supporting your driver, but I might as well send you these fixes if you want to use them. I'm fine with using my private version for my purposes, so no urgency to merge this from my end.

Thanks,

Tom Pavel

* First working version

- remove ili9341-based init commands (that are not supported or not needed
  on the ili9488 based on the datasheet)
- switch SPI data writes to 1 byte/call (unsure why this is needed on Pico)
- add picotest.py version of main.py (with additional graphics)
- add .gitignore

* Clean up code and fix color issues.

- Remove leftover ILI93xx opcodes that aren't in the ILI9488 data sheet
- Adjust sleep values based on ILI9488 data sheet
- Add a byte-swap function for colors if CPU is little-endian
- Fix color handling in draw_text8x8() to use bswap16() on colors
- revise picotest.py to add 3 additional test patterns
- one of these (test_4) compares native and FrameBuffer drawing routines
@QiaoTuCodes
Copy link
Owner

I am working with this display board and the Raspberry Pi Pico: https://www.waveshare.com/wiki/Pico-ResTouch-LCD-3.5

I tried your driver from the main branch in Github, but it didn't work for me. The main problem was that writing command parameters with SPI.write() only works if I write a single byte per write() call. I don't have a clear explanation for this, but looping one write() call per byte seems to be a safe workaround.

In addition, I found a bunch of opcodes that carried over from the source driver for ILI93xx chips but do not appear in the ILI9488 data sheet. I updated these codes based on the data sheet (although I didn't include everything in the data sheet). Similarly, the initialization code contained commands or parameters that didn't make sense based on the ILI9488 data sheet. I reduced these to a fairly minimal set that works OK for me.

Finally, I found that the code for draw_text8x8() had a bug with foreground and background colors. It turns out that any code using Micropython's FrameBuffer and the block() method to copy the FB's backing buffer to the ILI9488 is problematic. This is because FrameBuffers store the 16-bit colors in native byte-order (which is little-endian) while the ILI9488 expects colors to be big-endian. I couldn't find any code or hooks in FrameBuffer to deal with this, so I added code to the driver for byte-swapping and then flip the color value before writing into the FrameBuffer.

I don't know how much you are actively maintaining/supporting your driver, but I might as well send you these fixes if you want to use them. I'm fine with using my private version for my purposes, so no urgency to merge this from my end.

Thanks,

Tom Pavel

Thank you very much for your testing and updates. Indeed, this ILI9488 driver for MicroPython was my initial attempt at a test version, inspired by the integration and modifications from the ILI9341 driver. I didn't remove the relevant constant definitions from the original ILI9341 copy at that time. The idea was to eventually integrate multiple display drivers such as ILI93xx, ILI94xx, etc., into a super comprehensive library, so I kept the original constants for future integration. Due to recent minor family issues that have clearly constrained my ability to update and maintain my personal community and related technical discussions, I have briefly reviewed your post and code corrections. I appreciate your outstanding contributions; they look quite promising! A merge could be considered.

Thanks!,

Isaac.WeiRan

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.

2 participants