Accessing P9-pins via devmem2?

Hello all,

I’m currently trying to access the P9-pins which are part of the simple default cape-design. These are part of the FPGA-design and located in CAPE/P9_GPIO_0. I put in identify as the on-chip debugger to see the transfers as I do not get the data written into the GPIO-core.

What I do is:

  • sudo devmem2 0x41200000 h a
  • trigger for the APB_BIF_sel-signal in identify

What I see is that the second slave is selected (CoreAPB3_CAPE_0_APBmslave2_PSELx going to 1), however the PWRITE-signal is staying at 0. The data-value would be present on PWDATA, however as the PWRITE-signal is not asserted, nothing changes.

Any idea why the write-signal is not asserted?

Cheers
Moadl

Hello @moadl,
I haven’t used devmem2. I just looked at its code and it’s similar to my blinky.c program that can write/read the CAPE over APB.

It’s strange that you see pselx but you don’t see pwrite. From the devmem2.c code I just looked at, it does a read followed by a write. I suspect Identify is triggering on the read and missing the following write. Can you change your trigger from pselx to pwrite?

Other thoughts:
Can you change access type from ‘h’ to ‘w’? It shouldn’t make a difference but the APB bus is 32-bits.
Can you provide the url to your gitlab repo? I can poke around with Libero to see what we can see.

Can you download the artifacts from my repo and compile/run the blinky.c program (in the top directory of repo), to check if identify sees pwrite?

Here is my repo and a youtube video of how I did it.

Hi @moadl,
Can you try the following commands:

$ gpioinfo 

This should give you something looking like this (among other GPIOs):

gpiochip3 - 21 lines:
        line   0:      unnamed       unused  output  active-high 
        line   1:      "P9_12"       unused  output  active-high 
        line   2:      unnamed       unused  output  active-high 
        line   3:      unnamed       unused  output  active-high 
        line   4:      "P9_15"       unused  output  active-high 
        line   5:      unnamed       unused  output  active-high 
        line   6:      unnamed       unused  output  active-high 
        line   7:      unnamed       unused  output  active-high 
        line   8:      unnamed       unused  output  active-high 
        line   9:      unnamed       unused  output  active-high 
        line  10:      "P9_23"       unused  output  active-high 
        line  11:      unnamed       unused  output  active-high 
        line  12:      "P9_25"       unused  output  active-high 
        line  13:      unnamed       unused  output  active-high 
        line  14:      "P9_27"       unused  output  active-high 
        line  15:      unnamed       unused  output  active-high 
        line  16:      unnamed       unused  output  active-high 
        line  17:      "P9_30"       unused  output  active-high 
        line  18:      unnamed       unused  output  active-high 
        line  19:      "P9_41"       unused  output  active-high 
        line  20:      unnamed       unused  output  active-high 

This allows to find out with GPIO controller and IO pins are connected to the P8 and P9 connectors.

Now try to toggle P9_41 using the following two commands:

$ gpioset gpiochip3 19=1
$ gpioset gpiochip3 19=0

This should toggle pin 41 to connector P9. Does that work for you?

Hi @Vauban , @BustedWing1 ,

the issue was actually exctly the topic that BustedWing suggested, having triggered incorrectly. devmem2 seems to do some reads before it does any writes and my buffer was just a small one. When triggering on the pwrite I see that write-commands.
Thanks for the mental nudge. ;o)

Cheers
Moadl

Nice!