Tool/software:
Hi, TI expert,
I want to modify some pins definition to main_gpio0 for our customization board, these pins will be control camera for power sequence by vision app.
Please help me to check how do I control these gpios and checking the setting is correct or not, thanks.
Firstly, I add gpios defintion to k3-am68-sk-base-board.dts
rpi_header_gpio0_pins_default: rpi-header-gpio0-default-pins { pinctrl-single,pins = < ... J721S2_IOPAD(0x068, PIN_INPUT, 7) /* (U28) MCAN0_RX.GPIO0_26, Camera0_RST, for cam 0 start */ J721S2_IOPAD(0x06c, PIN_INPUT, 7) /* (V26) MCAN1_TX.GPIO0_27, Camera0_COMREADY */ J721S2_IOPAD(0x070, PIN_INPUT, 7) /* (R27) MCAN1_RX.GPIO0_28, Camera0_ERRO */ J721S2_IOPAD(0x074, PIN_INPUT, 7) /* (R28) MCAN2_TX.GPIO0_29, Camera0_TRIGGER */ J721S2_IOPAD(0x0d8, PIN_INPUT, 7) /* (AG26) SPI0_D0.GPIO0_54, CAM_PWR_EN, */ J721S2_IOPAD(0x0dc, PIN_INPUT, 7) /* (AH26) SPI0_D1.GPIO0_55, CAM1_LS_EN, for cam 0 end */ >; };
Second, I add gpios definition to J721S2_pinmux_data.c
static pinmuxPerCfg_t gGpio0PinCfg[] = { /* MyGPIO0 -> GPIO0_26 -> U28, Camera0_RST, for cam 0 start */ { PIN_MCAN0_RX, PIN_MODE(7) | \ ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) }, /* MyGPIO0 -> GPIO0_27 -> V26, Camera0_COMREADY */ { PIN_MCAN1_TX, PIN_MODE(7) | \ ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) }, /* MyGPIO0 -> GPIO0_28 -> R27, Camera0_ERRO */ { PIN_MCAN1_RX, PIN_MODE(7) | \ ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) }, /* MyGPIO0 -> GPIO0_29 -> R28, Camera0_TRIGGER */ { PIN_MCAN2_TX, PIN_MODE(7) | \ ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) }, /* MyGPIO0 -> GPIO0_54 -> AG26, CAM_PWR_EN */ { PIN_SPI0_D0, PIN_MODE(7) | \ ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) }, /* MyGPIO0 -> GPIO0_55 -> AH26, CAM1_LS_EN, for cam 0 end */ { PIN_SPI0_D1, PIN_MODE(7) | \ ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) }, {PINMUX_END} };
Third, check main_gpio0 status in k3-j721s2-common-proc-board.dts
&main_gpio0 { status = "okay"; };
Forth, I want to control these pin for camera power on in run_app_single_cam.sh.
1. (AG26) SPI0_D0.GPIO0_54 needs to high
2. (AH26) SPI0_D1.GPIO0_55 needs to low
3. (U28) MCAN0_RX.GPIO0_26 needs to high
4. (R28) MCAN2_TX.GPIO0_29 needs to high
5. (V26) MCAN1_TX.GPIO0_27 needs to high
6. (R27) MCAN1_RX.GPIO0_28 needs to high
How do I implement to control gpios, please help me to point out how do I do, thanks.