Hello everyone.
I've been lurking here and googling around looking for answers but found no one doing what I'm trying.
My main objective is to be able to use 16 pins as PRU inputs, on a single PRU, without board modification or additional hardware.
PRU1 has most of the pins available and there are two that are really good candidates for reassigning: PR1_PRU1_PRU_R31_14 and PR1_PRU1_PRU_R31_15, which go out on pins E15 and E16.
The pins E15 and E16, named UART0_TXD and UART0_RXD respectively, are by default assigned to a uart0 device with parts of its definition in two files: am33xx.dtsi and am335x-bone-common.dtsi.
I currently set dtb=am335x-boneblack-emmc-overlay.dtb inside uEnv.txt and do not know what is the default DTB used when nothing is set there. I guess it is am335x-boneblack.dts, but both include the above mentioned DTSIs, so that should not matter.
I'm guessing that removing the uart0 device inside the ocp (am33xx.dtsi) and the phandle (am335x-bone-common.dtsi), then changing the mux settings for the pins from this:
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
>;
};
To something like this:
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x970, PIN_INPUT_PULLDOWN | MUX_MODE6) /* uart0_rxd.uart0_rxd */
AM33XX_IOPAD(0x974, PIN_INPUT_PULLDOWN | MUX_MODE6) /* uart0_txd.uart0_txd */
>;
};
...would do the trick.
I'm aware that there is a SN74LVC2G241 and a pulldown in the way, but they seem harmless for what I'm trying to achieve.
Now the questions:
- Will that work?
- Besides losing that serial port, what other side effects I will have by doing that?
- Is that SN74LVC2G241 a problem?
- Is there a way to disable uart0 (the driver, device, etc), change the mux and use it on the PRU after booting to linux? The idea here is to retain as much functionality as possible and still get to use the pin as PRU input when needed.
- Any other alternatives?
Bonus question: What is the default DTB and where is it set?
Thanks for your time,