What is the Max Input Frequency supported by J41 header GPIO pins?

I am using Pin 12 from J41 header. (tried Pin 18 also)

My Setup:

  1. I have one external board that is able to generate PWM signal from 1 Hz to 1000Hz.
  2. Giving PWM signal to Pin 12(input mode) of Jetson Nano.

Taking Code Reference From -->( https://github.com/NVIDIA/jetson-gpio/blob/master/samples/button_interrupt.py)

Problem:
Pin 12 is able to detect signal upto ~150Hz, but When i tried with 200Hz signal, it is not able to detect rising edge.

Question:
What is the max frequency GPIOs can handle(sampling rate of pad)?

There’s a difference between “what can the physical hardware and a proper device driver written in C do,” and “what can I do with a simple polling Python script.”
The limitation in your example is the Python script/interpreter, not the GPIO pin.

The maximum sampling rate of GPIO pin is about 50Khz.

We are trying to access GPIO using register level interface.

#include<stdio.h>
#include<stdlib.h>

#define GPIO_CNF_ 	0x6000d100
#define GPIO_OE_  	0x6000d000+0x110 //* / GPIO_MSK_OE_* Output Enable
#define GPIO_OUT_  	0x6000d000+0x120 //* / GPIO_MSK_OUT_* GPIO Output Value
#define GPIO_IN_  	0x6000d000+0x130 //* GPIO Input Value (Read Only)
#define GPIO_INT_STA_ 	0x6000d000+0x140 //* / GPIO_MSK_INT_STA_* GPIO Interrupt Status
#define GPIO_INT_ENB_ 	0x6000d000+0x150 //* / GPIO_MSK_INT_ENB_* Interrupt Enable
#define GPIO_INT_LVL_  	0x6000d000+0x160 //* / GPIO_MSK_INT_LVL_* Interrupt Selection (Edge/Level)
#define GPIO_INT_CLR_  	0x6000d000+0x170 //* Interrupt Flag Set-to-Clear

int main(void)
{
	*(int *)(GPIO_CNF_) = 0x00ff; 
	*(int *)(GPIO_OE_)  = 0xff ;
	*(int *)(GPIO_OUT_) = 0xff ;
	*(int *)(GPIO_IN_) = 0x00 ;
	*(int *)(GPIO_INT_STA_) = 0x00;
	*(int *)(GPIO_INT_ENB_) = 0x00;
 	*(int *)(GPIO_INT_LVL_) = 0x000000;

	return 0 ;
}

Error I am getting:

Program received signal SIGSEGV, Segmentation fault

Questions:

  1. Can we access those GPIO registers through this above address or not?

  2. Is there any other way to access GPIO registers through register level interface?

Hi @Trumany,

50khz sampling rate is at default configuration or require some configuration for that?

You cant’t access memory map registers in that simple way you need to nmap the memory space. If nmap is possible or not is a different story as the gpio pins mostly likely are available through the kernel GPIO Sysfs Interface.

I presume you mean “mmap()” because “nmap” is a network mapping tool.

I tried to post some sample code for how to do this, but got some annoying “blocked because of security” error.
How are we supposed to talk about code if we can’t post about code?

I threw together a quick github repository with code to show how to use the memory map access method:

https://github.com/jwatte/jetson-gpio-example

Here’s a picture of the security warning:

Hi snarky,

Not sure why there was this error code pop-up, can this problem still be reproduced at your end?
If yes, could you send the code to us through private message? then we can do the investigate further.

Thanks

Yes, it still happens.
I just copy the code from the github repository above, and wrap it in ‘code’ tags, and I get that error.

https://raw.githubusercontent.com/jwatte/jetson-gpio-example/master/gpiomem.cpp

what about output?