I’m trying to read GPIO pin 33 on the 40 pin connector. According to the TRM/pinmux this is GPIO pin 248 on the AON PAA.0 from what I can tell this shoudl be at 0x0c2f0000 + 0x1000. When I look at gpio-tegra186.cpp and tegra194-gpio.h thitegra_AON_GPIO_PORTAA is 0 but looking at TEGRA_AON_GPIO_PORT_INFO the reg_offset is cind* 0x200 where cind is 6.
When I map /dev/mem to 0xc2f1000 if I ignore reg_offset I’m able to read the Input (at offset 0x30) but it never changes. If I try to add the reg_offset of 0xc00 I get a segmentation fault.
I’ve seen examples for different versions of the jetson but not for Xavier AGX.
Any help in figuring out the correct address would be appreciated.
the quickest way for checking the address of the GPIO pin were refer to the board’s pinmux configuration file.
for example, tegra186-mb1-bct-pinmux-quill-p3310-1000-c03.cfg
Thanks Jerry,
I’ve used the pinmux to find that it is PAA.0 and I know from using SYSFS interface that its GPIO 248 , but this hasn’t help to get the correct physical address for the correct memory mapped GPIO address.
SYSFS works fine but it’s too slow for our purposes and the kernel transition is undesirable. We are reading at about 80 khz and can’t afford a missed transition
From Xavier TRM we get the base address:
AON_GPIO_0 0x0c2f0000 0x0c2fffff SYSTEM
So now things get hazy… I see most people using a register offset of 0x1000. Reading IN (offset 0x30) from base register 0xc2f0000 gives an access violation.
If instead I read from 0xc2f1000 at offset 0x30 I can read a value but it doesn’t match what I read through SYSFS.
If I add the reg_offset of 0xC00 I get an access violation.
There seem to be a number of github examples for other jetson configurations but none for Xavier AGX.
Jerry, is there documentation of the AON GPIO controller? It seems like it may have a different gpio controller/layout. One of my colleagues remembers reading that it had a different stride between ports.
This finds an address of c303000 but that address always reads back 0xc055 (the value shown in the file.
If I use sysfs to change it from an input to an output I read back 0xc005. So it seems related to the GPIO configuration but not the gpio controller itself.
/sys/kernel/debug/gpio has the line
gpiochip1: GPIOs 248-287 platform/c2f000-gpio/tegra-gpio-aon
This matches what I expect the gpio pin 248 should be in the AON gpio controller. None the less I can’t find the working controller to read back the correct value of pin 33 (gpio 248)
I really need the AON memory map for the Xavier AGX but I can’t seem to find it in any documentation. Doesn’t Nvidia expect us to use the GPIO? Really the jetson doesn’t seem adequately supported to do embedded development.
my meant you should check header file, tegra194-gpio.h for Jetson AGX Xavier series configurations.
it’s Xavier Series SoC Technical Reference Manual for the documentation, please check chapter-8.5 [Multi-Purpose I/O Pins and Pin Multiplexing (PinMux)] for reference.
thanks
I verified the base address of the pin (pin 33 on the 40 pin connector) is GPIO 248
I verified the base address of the AON with the GPIO (and the address of the padctrl) from the TRM:
AON_GPIO_0 0x0c2f0000 0x0c2fffff SYSTEM
PADCTL_A15 0x0c303000 0x0c303fff SYSTEM
From the pinmux spread-sheet this is defined as PAA.0
From kernel source code (tegra194-gpio.h and gpio-tegra186.cpp) I get:
struct tegra_gpio_port_soc_info tegra194_aon_gpio_cinfo = {
TEGRA194_AON_GPIO_PORT_INFO(AA, 0, 3, 8),
which defines the reg_offset as 0x600
And of course the IN offset is 0x30.
I’ve been using SYSFS to set the direction of the pin and then trying to read a high value from the pin.
It appears to me that the the GPIO controller starts at offset 0x1000 from the base address.
The most pressing question is what is the offset from the base address to read this pin?
Hi dgolick,
You can refer cpp definitions to get gpio controller address and tegra194-gpio.h to get final gpio number.
For PAA.0:
From gpio-tegra186.cpp, you can see
static struct tegra_gpio_port_soc_info tegra194_aon_gpio_cinfo = {
TEGRA194_AON_GPIO_PORT_INFO(AA, 0, 3, 8),
…
and #define TEGRA194_AON_GPIO_PORT_INFO(port, cid, cind, npins)
[TEGRA194_AON_GPIO_PORT_##port] = {
.port_name = #port,
.cont_id = cid,
.port_index = cind,
.valid_pins = npins,
.reg_index = 1,
.scr_offset = cind * 0x40,
.reg_offset = cind * 0x200,
means reg_offset = 3x200=600
add it with base: 0x0c2f1000+600=0x0c2f1600.
I see you have mentioned TEGRA_AON_GPIO_PORT_INFO(AA, 0, 6, 8),
which is wrong.
Please refer tegra194_aon_gpio_cinfo structure in the driver.
Let me know if you need more info.