GPIO direct register access using mmap not working

Ive been working on a library for direct register access to the Jetson nano GPIO (and in the future maybe other peripherals) and I can’t quite seem to get it to work and I’m pulling my hair out at this point. It seems that the registers are getting set to enable the GPIO, set it to the GPIO not SPIO, and set the output to high, and the other things, but nothing shows up on the scope and my LED doesn’t light up.

I have been following the examples set by @valentis and @snarky. I cloned both and ran the led example from @valentis, but that doesn’t even work on my board. I have also been following raspberry pi direct register access examples because I think the 40 pin header was set up to be similar.

My code is on my github linked here GitHub - mdhardenburgh/jetsonNanoRegisterAccess at jetsonNanoWork

It’s under the branch jetsonNanoWork.

I’m thinking maybe my Jetson is borked at this point and I did an ESD and killed the GPIOs some how. Any help would be appreciated. Thank you.

Hi,
Please check if you can follow this guidance to do some experiments:
Jetson Nano Fast GPIO C++ Example with Direct Memory Access (DMA) - #11 by shgarg
To make sure the Jetson Nano hardware board is good.

Hi @DaneLLL,

I ran some shell commands on Jetson hacks

//Header pin 15 , Module pin name GPIO12, Module pin #218, tegra pin name, LCD_TE, default setting GPIO, gpio port PY.02
//GPIO 194 corresponds to header pin 15
echo 194 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio194/direction
echo 1 > /sys/class/gpio/gpio194/value echo 0 > /sys/class/gpio/gpio194/value

The pin seems to work, I’m able to light an LED using an npn transistor. However the pin isn’t outputting 3.3V, about 3V ish, and and there is a 5MHz noise on the line. That’s something electrical I’ll have to figure out later. Also, I was expecting 3.3V, but maybe the Jetson puts out another voltage from the pin?

My code doesn’t cause the LED to light, so in that domain, I have a feeling its my code that I’m not setting a register or something. I’m not sure what register I’m forgetting to set. The following is an excerpt of the registers I’m using.

myPinMuxController.setRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, 0, PINMUX_AUX_LCD_TE_0::PM_bit, PINMUX_AUX_LCD_TE_0::PM_bitWidth);                                                     
myPinMuxController.setRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, 0, PINMUX_AUX_LCD_TE_0::PUPD_bit, PINMUX_AUX_LCD_TE_0::PUPD_bitWidth);                                                 
myPinMuxController.setRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, 0, PINMUX_AUX_LCD_TE_0::TRISTATE_bit, PINMUX_AUX_LCD_TE_0::TRISTATE_bitWidth);                                         
myPinMuxController.setRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, 0, PINMUX_AUX_LCD_TE_0::PARK_bit, PINMUX_AUX_LCD_TE_0::PARK_bitWidth);                                                 
myPinMuxController.setRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, 0, PINMUX_AUX_LCD_TE_0::E_INPUT_bit, PINMUX_AUX_LCD_TE_0::E_INPUT_bitWidth);                                           
                                                                                                                                                                                               
uint32_t readPM = myPinMuxController.getRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, PINMUX_AUX_LCD_TE_0::PM_bit, PINMUX_AUX_LCD_TE_0::PM_bitWidth);                                      
uint32_t readPUPD = myPinMuxController.getRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, PINMUX_AUX_LCD_TE_0::PUPD_bit, PINMUX_AUX_LCD_TE_0::PUPD_bitWidth);                                
uint32_t readTRI = myPinMuxController.getRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, PINMUX_AUX_LCD_TE_0::TRISTATE_bit, PINMUX_AUX_LCD_TE_0::TRISTATE_bitWidth);                         
uint32_t readPARK = myPinMuxController.getRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, PINMUX_AUX_LCD_TE_0::PARK_bit, PINMUX_AUX_LCD_TE_0::PARK_bitWidth);                                
uint32_t readINPUT = myPinMuxController.getRegisterField(PINMUX_AUX_LCD_TE_0::addressOffset, PINMUX_AUX_LCD_TE_0::E_INPUT_bit, PINMUX_AUX_LCD_TE_0::E_INPUT_bitWidth);                         
                                                                                                                                                                                               
std::cout<<"pinmux PM bit: "<<readPM<<std::endl;                                                                                                                                               
std::cout<<"pinmux PUPD bit: "<<readPUPD<<std::endl;                                                                                                                                           
std::cout<<"pinmux TRISTATE bit: "<<readTRI<<std::endl;                                                                                                                                        
std::cout<<"pinmux PARK bit: "<<readPARK<<std::endl;                                                                                                                                           
std::cout<<"pinmux INPUT bit: "<<readINPUT<<std::endl;                                                                                                                                         
                                                                                                                                                                                               
// port Y is the zeroth port gpio controller 4 grouping                                                                                                                                        
myGpioController.setRegisterField(GPIO_CNF_0_RMW::addressOffset, gpioController::LOCK_BIT_DISABLE, GPIO_CNF_0_RMW::LOCK_2_baseBit, GPIO_CNF_0_RMW::LOCK_2_bitWidth);
myGpioController.setRegisterField(GPIO_CNF_0_RMW::addressOffset, gpioController::BIT_N_GPIO, GPIO_CNF_0_RMW::BIT_2_baseBit, GPIO_CNF_0_RMW::BIT_2_bitWidth);
myGpioController.setRegisterField(GPIO_OE_0_RMW::addressOffset, gpioController::BIT_N_DRIVEN, GPIO_OE_0_RMW::BIT_2_baseBit, GPIO_OE_0_RMW::BIT_2_bitWidth);
myGpioController.setRegisterField(GPIO_INT_ENB_0::addressOffset, gpioController::BIT_N_DISABLE, GPIO_INT_ENB_0::BIT_2_baseBit, GPIO_INT_ENB_0::BIT_2_bitWidth);                                
myGpioController.setRegisterField(GPIO_OUT_0_RMW::addressOffset, gpioPinState, GPIO_OUT_0_RMW::BIT_2_baseBit, GPIO_OUT_0_RMW::BIT_2_bitWidth);