Recommended Posts

Hey.

I have a beer-brewing machine which has software running on an olimex A13-SOM board, that has a capacitive touch panel attached to it.
The company (Brewie) did'nt survive, but I really like the machine, and the potential it has.
The board is running a very slimmed down linux system, so it's a bit difficult to sniff stuff out, and expand on it - so I want to install a more recent linux system on it, and try making new software for it as a shared project with other people using this machine.

I managed to make a functional image using github.com/olimex/build
I'm building it using:

./compile.sh BRANCH=next BOARD=olimex-som-a13 KERNEL_ONLY=no KERNEL_CONFIGURE=yes CLEAN_LEVEL="make,debs,alldebs,images" RELEASE=stretch BUILD_KSRC=no NO_APT_CACHER=yes BUILD_DESKTOP=no

The image seems to work just fine, but first issue is getting the capacitive touch panel to work. Display works, but I can't get the communication going with the touch panel, and I think the problem might be in how the device tree is set up.
The touch panel uses a Goodix gt911 chip, and I've enabled the driver as a module in the kernel.

The panel is using the i2c-2 port (pin PB17 as scl, PB18 as sda), and also pin PG12 for interrupt and PC3 for reset.

The old installation uses fex files, so I have to try to adapt the information to the dts tree.
As far as I can tell, I ought to get a /dev/input/event0 when it works, and should be able to make some reading using: cat /dev/input/event0 when I touch the screen.
But after a week of trying various stuff, I still can't get that event0 to show up.

So: my first question is about the setup in the dts file. 

When reading about the pinctrl, it seems that it wants 3 cells for the gpio configuration - bank number, pin number in bank and gpio-flags. However, specific details on these are sparse...
What number should I use for the bank?
I assume 12 for pin number?
And what about the gpio-flags? I can find no list of possibilities for those...

I'm attaching the current dts file I've made (sun5i-a13-olinuxino-micro.dts).
I've also attached the script.bin from the original installation converted to fex.
And also a printout of dmesg | grep i2c  and the config file showing the setup of the kernel.

Sorry it's a bit long description. Hope someone can help.

config-5.0.21-sunxi dmesg-i2c.txt my dts mods.txt script.fex sun5i-a13-olinuxino-micro.dts

Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?

23 minutes ago, arjepsen said:

What number should I use for the bank?

Banks are defined as A=0, B=1, ... and G=6, etc ...

24 minutes ago, arjepsen said:

I assume 12 for pin number?

Right !

24 minutes ago, arjepsen said:

what about the gpio-flags?

ACTIVE_LOW=1 and ACTIVE_HIGH=0, other flags can be seen in include/dt-bindings/gpio/gpio.h

 

BTW, are you sure that you need to use PG12 for Interrupt ? Because on the schematic, PG12 is used as output for USB0-DRV ...

Link to post
Share on other sites

Thanks for a quick answer! :)

Unfortunately, this is what I already tried in the dts file as you can see (f.ex. interrupts = <6 12 0>)

I've seen other people mentioning "IRQ_TYPE_EDGE_RISING" as a flag - do you know which number would equal this?

 

As for PG12 - I'm fairly certain. In the fex file I posted you can see this is what it's set up to use. This is from the old installation where the touch panel works.

 

Any other idea what I've done wrong with my configuration?

Link to post
Share on other sites
59 minutes ago, arjepsen said:

I've seen other people mentioning "IRQ_TYPE_EDGE_RISING" as a flag

In this case, defines are there : include/dt-bindings/interrupt-controller/irq.h

59 minutes ago, arjepsen said:

As for PG12 - I'm fairly certain.

Ah ! Ok ! I didn't look at A13-SOM schematic, but A13-OlinuXino-Micro one ...

59 minutes ago, arjepsen said:

Any other idea what I've done wrong with my configuration?

I don't know, IRQ_TYPE_EDGE_RISING=1, since your previous test with 0 was meaning IRQ_TYPE_NONE.

Link to post
Share on other sites

ok, thanks for the info so far!

Another question:

in the dts tree, under pinctrl@1c20800 the pin definitions include a property called "function".

I haven't been able to decipher whether this needs to be something specific, or whether it's more of a general label thing.

Particularly in my setup of PG12 and PC3, I've written "irq" and "reset" as their function respectivly.

Does this matter, or?

Link to post
Share on other sites
15 hours ago, arjepsen said:

Particularly in my setup of PG12 and PC3, I've written "irq" and "reset" as their function respectivly.

Does this matter, or?

No ! In your case, you should declare function parameter as either "gpio_in" or "gpio_out" as described here in drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c

Note that this driver doesn't mention alternate function for PG12, so simply use "gpio_in" ...

 

Link to post
Share on other sites

Ok, thanks, I'll try that.

a few more questions:

forgive my noobiness, I might be wrong here, but shouldn't I be looking at this file instead:

https://github.com/torvalds/linux/blob/master/drivers/pinctrl/sunxi/pinctrl-sun5i.c

?

 

Looking over the file you mention, I see the values listed like (0x1) etc. 

Looking over my dts file, I see a lot of values written like that too. 

Should I write the values like that instead, like:

interrupts = <0x6 0x1b 0x0>;

instead of

interrupts = <6 12 0> 

?

Also, I'm trying to figure out what is what in that file.

I think I located pin PG12, where it states:

SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),

SUNXI_FUNCTION(0x0, "gpio_in"),

SUNXI_FUNCTION(0x1, "gpio_out"),

SUNXI_FUNCTION(0x2, "spi1"), /* MISO */

SUNXI_FUNCTION(0x3, "uart3"), /* RTS */

SUNXI_FUNCTION_IRQ(0x6, 12)), /* EINT12 */

 

when it lists: (G, 12), is this how I should write, instead of <6, 12>?

Also, it mentions  an irq function at the bottom - does that mean I can desribe the pin function as (0x6, 12) or am I completely off there...?

 

(huge thanks for your help so far!)

 

 

Link to post
Share on other sites
3 hours ago, arjepsen said:

forgive my noobiness, I might be wrong here, but shouldn't I be looking at this file instead:

https://github.com/torvalds/linux/blob/master/drivers/pinctrl/sunxi/pinctrl-sun5i.c

Right ! (I was answering too quickly ...)

3 hours ago, arjepsen said:

Should I write the values like that instead, like:

interrupts = <0x6 0x1b 0x0>;

instead of

interrupts = <6 12 0> 

No, the 0x means hexadecimal, you can still use it but PG12 would be "interrupts = <0x6 0x0c 0x0>;", not 0x1b which means PG27 which doesn't even exist ...

 

3 hours ago, arjepsen said:

does that mean I can desribe the pin function as (0x6, 12) or am I completely off there...?

I'm not fluent with interrupts, but I would try "interrupts = <0x6 0x1b 0x2>;" where 0x2 means IRQ_TYPE_EDGE_FALLING

Link to post
Share on other sites

Again a big thanks for you help.

 

Unfortunately this one seems difficult to crack.

I've been looking over the boards, and it seems that the irq pin is connected to a small chip, that again - among other things - connect to pin PG2.

I also tried to trace pin PG12, and that actually didn't seem to go anywhere near the connector to the touchpanel....

So I tried using PG2 instead - but the only result was that now the usb wifi didn't work.

So it seems on the schematic of the board, that both PG2 and PG12 are doing something with usb. I find it very confusing because the script.fex file I attached which is from the old installation that works, clearly shows PG12 as being assigned for the irq connection. 

I'm at a loss here. Particularly since loading the driver module doesn't give any errors (or confirmations for that matter).

I've tried with both PG2 and PG12, but no difference.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...