AGX SPI2 mmap with /dev/mem

Hi all,

I want to use spi2_sck_pcc0 and spi2_mosi_pcc2 to do SPI bit-banging(Only output, no need for input).
I can control the two GPIO by SYSFS, but the frequency of the clock(spi2_sck_pcc0) is too low which is only 10 ~ 20kHz.
So I reference this topic(GPIO-bit_bang, MMAP_sample, Address_offset) and use the following command to check the memory mapped is ok:

  1. sudo busybox devmem 0x0c302048 w 0x03
  2. sudo busybox devmem 0x0c302054 w 0x00
  3. sudo busybox devmem 0x0c302058 w 0x01


  • Use cat /sys/kernel/debug/tegra_pinctrl_reg | grep spi2 to get address of spi2_sck_pcc0 and spi2_mosi_pcc2, like the below

  • step 1 set it to GPIO, step 2 set it to output, and step 3 set it to HIGH.

But my AGX always reboot by using step 3.
Why the command will let the device reboot? Am I doing something wrong?

many thanks

Those addresses are for pins function configure instead of GPIO control.
The GPIO base should be 0x2200000 and c2f0000

        gpio@2200000 {
                compatible = "nvidia,tegra194-gpio";
        gpio@c2f0000 {
                compatible = "nvidia,tegra194-gpio-aon";
1 Like

@ShaneCCC Thank you for your answer, I got your point.
And I can use mmap to control GPIO(Reference toMMAP_EXAMPLE)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.