Giter Site home page Giter Site logo

Comments (22)

pysco68 avatar pysco68 commented on September 3, 2024

Hi Lukas,

The STM32 and GD32 behave a tad differently when it comes to I2C. In fact the STM32s I2C peripheral can be called "weird" - and that's a nice term.

I don't have a device to hand to tell you exactly what to modify; but here's the app note from ST concerning the errata: http://www.st.com/content/ccc/resource/technical/document/application_note/5d/ae/a3/6f/08/69/4e/9b/CD00209826.pdf/files/CD00209826.pdf/jcr:content/translations/en.CD00209826.pdf

Here's a bit of code that I know to work:
https://github.com/geoffreymbrown/STM32-Template/blob/master/Library/i2c.c

You'll see that part with 1 byte, 2 bytes and N bytes being transferred, including the irq handling and (STOP) signal generation stuff going on in between.

from waveshare-hid.

pysco68 avatar pysco68 commented on September 3, 2024

Hi Lukas,

did you manage anything on this issue?

Btw. what screen is it exactly? It's weird to have the original STM32 on the Chinese' screen. It costs nearly twice as much as the GD32F1 in 1k quantities.

from waveshare-hid.

lukas2511 avatar lukas2511 commented on September 3, 2024

Hey,

I didn't really find the time to experiment some more, but thanks for your reply, will try to get it working soon.

This seems to be a genuine "7inch HDMI LCD (B)" (rev1.1) by Waveshare, got it via Amazon, here are some pictures of the PCB:


Also on my board the readout-protect bits weren't set, I got a full firmware dump: original_firmware.zip

from waveshare-hid.

lukas2511 avatar lukas2511 commented on September 3, 2024

I tried a few more things (including copying code 1:1 from other repos) but I just can't get the I2C to work, always hangs at sending the address, not sure what's going on...

Since other people seem to have I2C working with the chip maybe it's a problem with my version of libopencm3 or with my compiler or whatever, don't really want to test all that, I already wasted way too many hours trying to get this touchscreen to work...

I'm hoping that maybe somebody else will get this to work and share their solution.

from waveshare-hid.

pysco68 avatar pysco68 commented on September 3, 2024

Hello Lukas,

sad to hear you didn't find a way through this. I think we should keep the issue open. Eventually somebody will contribute ;)

Thank you for your efforts nonetheless!

from waveshare-hid.

ReanimatorRX avatar ReanimatorRX commented on September 3, 2024

Hi
I tried to get this running on my display, but did not work out
img_6266s
My display seems to be similar to yours but has an original STM32 controller instead of the GD32

from waveshare-hid.

pysco68 avatar pysco68 commented on September 3, 2024

Hi @ReanimatorRX on first sight your display looks fairly similar (although I can't see the SWD port anywhere). As I told Lukas, the issue is to be found within the I2C routine(s), as per the errata sheet. If you feel courageous enough, give it a try. There's not much you can do that's really wrong ;) (in the way that if you don't change the IO pin mapping or do some crazy stuff I don't think you can damage any of the chips).

It would be awesome if someone manages to get that running ;)

from waveshare-hid.

ReanimatorRX avatar ReanimatorRX commented on September 3, 2024

swd #
image

from waveshare-hid.

pysco68 avatar pysco68 commented on September 3, 2024

Hi @ReanimatorRX did you have any success so far?

from waveshare-hid.

ramb0t avatar ramb0t commented on September 3, 2024

@pysco68 @ReanimatorRX
I have the same board and issue. Close inspection shows the GT811 to be connected to I2C1 and not I2C2. I tried changing the code but no luck (no clock on the SCL pin... ) My first experience with ARM / STM32 so I am still learning about the peripheral setup.
However the pin mapping is weird!
It seems
GT811 INT > PB7 I2C1_SDA
GT811 SDA > PB6 I2C1_SCL (with 10k pullup)
GT811 SCL > PB5 I2C1_SMBAI (with 10k pullup)

What is I2C1_SMBAI ?! I can't find much reference... and why this wiring scheme?

I may try a hardware mod to connect to I2C2 just to check the code is working...

from waveshare-hid.

ReanimatorRX avatar ReanimatorRX commented on September 3, 2024

Hi
Can you make and send me already compiled file please (bin file)?

from waveshare-hid.

pysco68 avatar pysco68 commented on September 3, 2024

Hi @ReanimatorRX I'm currently on vacation. I don't have access to my dev machine, so I can't send you anything. Do you have issues getting the stuff compiled on your own?

from waveshare-hid.

promzona1 avatar promzona1 commented on September 3, 2024

Hi ReanimatorRX !
This is compiled *.elf :
main.zip

This is compiled *.bin :
main-bin.zip

from waveshare-hid.

promzona1 avatar promzona1 commented on September 3, 2024

To pysco68:
You are a genius ! )
I flashed v 1.1 (Waveshare 7 LCD (B))
Previously, the touch did not work in Raspberry Pi. Now works without drivers.
Excellent !
Huge gratitude !
It remains to understand how to invert the coordinates of x. The mouse moves in the opposite direction from the finger. ))

from waveshare-hid.

promzona1 avatar promzona1 commented on September 3, 2024

How invert x coordinates moves, please ?

from waveshare-hid.

ReanimatorRX avatar ReanimatorRX commented on September 3, 2024

Hi promzona1
I flashed main-bin
I'm not seeing a usb device
main.zip
my elf file

from waveshare-hid.

ReanimatorRX avatar ReanimatorRX commented on September 3, 2024

How did you compile the bin file?

from waveshare-hid.

promzona1 avatar promzona1 commented on September 3, 2024

for Windows:
download toolkit:
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
compiler command:
arm-none-eabi-objcopy.exe -O binary main.elf main.bin

and flashed *.bin from Windows STM32 tool:
stm32 windows

from waveshare-hid.

promzona1 avatar promzona1 commented on September 3, 2024

Compiled *.bin from your *.elf :
main.zip

from waveshare-hid.

promzona1 avatar promzona1 commented on September 3, 2024

Hi pysco68 !
How inverted X coordinates in you gt811.c ?
After the flashing, my X coordinates are inverted and the pointer is displayed and moves in a mirror.
Y coordinates is OK.

UPD:
I do not understand anything in C, but I did it by analogy with "inverted_y".
Strangely enough, but it works correctly )))

            // NOTE: apparently the waveshare touch digitizer was mounted
            // mirrored in both directions, this means we "flip" X <-> Y
            // coordinates AND we have to mirror the Y axis

            x_value =  data[offsetData + 5] + (data[offsetData + 4] << 8);
	inverted_x = 800 - x_value;

	// byte[4] X coordinate LSB                
	hid_report->report[4] = inverted_x & 0xFF;
            
            // byte[5] X coordinate MSB 
            hid_report->report[5] = (inverted_x & 0xFF00) >> 8;

from waveshare-hid.

ReanimatorRX avatar ReanimatorRX commented on September 3, 2024

https://adelectronics.ru/2017/02/01/%D0%BA%D0%BB%D0%BE%D0%BD-%D0%B4%D0%B8%D1%81%D0%BF%D0%BB%D0%B5%D1%8F-7inch-%D0%BE%D1%82-waveshare/

https://adelectronics.ru/2017/05/05/%D0%BF%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D0%B0-%D0%BA%D0%BB%D0%BE%D0%BD%D0%B0-%D0%B4%D0%B8%D1%81%D0%BF%D0%BB%D0%B5%D1%8F-7inch-%D0%BE%D1%82-waveshare/#more-2274

from waveshare-hid.

GarageTech avatar GarageTech commented on September 3, 2024

viber_image_2021-12-15_18-41-08-406
viber_image_2021-12-15_18-41-07-539

Thanks all for help!
I successfully flashed Waveshare 7inch HDMI LCD (B) 800x480 v1.1.
I took .bin file from promzona1 post and flashed with ST-link V2 under Windows.
Chip on my board is GD32F103.
I using display in 1024x600 mode with RaspberryPi.
/boot/config.txt

disable_overscan=1
overscan_right=225 // these may be different
overscan_bottom=105 // these may be different
framebuffer_width=1024
framebuffer_height=600
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=87
max_usb_current=1
hdmi_cvt 1024 600 60 0 0 0 0
hdmi_drive=1

At this point you get well adjusted screen but X for the touch was swapped. I not try recompile firmware.
Install evdev.

sudo apt-get install xserver-xorg-input-evdev
sudo mv /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf

edit /usr/share/X11/xorg.conf.d/45-evdev.conf

Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "InvertX" "true"
EndSection

Reboot.

Now all work fine!!!

from waveshare-hid.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.