Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions target/ast10x0/BOARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ GPIO connections should be as follows:

| Raspberry Pi Pin | Target Device | Target Pin |
|------------------|---------------|----------------|
| 23 | A | SRST (PIN1) |
| 27 | A | SRST (PIN1) |
| 18 | A | FWSPICK (PIN2) |
| 25 | B | SRST (PIN1) |
| 17 | B | SRST (PIN1) |
| 24 | B | FWSPICK (PIN2) |

For I2C communication, connect pins 1 and 2 of J15. This links I2C2 between the devices.
Expand Down
4 changes: 2 additions & 2 deletions target/ast10x0/harness/evb_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# SPDX-License-Identifier: Apache-2.0

[gpio]
srst_pin = 23
srst_pin = 27
fwspick_pin = 18

[uart]
serial_port = "/dev/ttyUSB0"
baudrate = 115200

[device_b]
srst_pin = 25
srst_pin = 17
fwspick_pin = 24
serial_port = "/dev/ttyUSB1"
6 changes: 5 additions & 1 deletion target/ast10x0/harness/pi_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def _gpio_set(pin: int, state: str) -> None:
subprocess.run(["pinctrl", "set", str(pin), "op"] + state.split(), check=True)


def _gpio_set_input(pin: int, pull: str) -> None:
subprocess.run(["pinctrl", "set", str(pin), "ip", pull], check=True)


def _sequence_to_fwspick_mode(
srst_pin: int, fwspick_pin: int, port: serial.Serial
) -> None:
Expand All @@ -41,7 +45,7 @@ def _sequence_to_fwspick_mode(
port.read(4096)
_gpio_set(fwspick_pin, "pn dh")
time.sleep(1)
_gpio_set(srst_pin, "dh")
_gpio_set_input(srst_pin, "pn")
time.sleep(1)


Expand Down
32 changes: 26 additions & 6 deletions target/ast10x0/harness/uart_test_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,28 @@ def gpio_set(self, pin: int, state: str):
except Exception as e:
raise RuntimeError(f"Failed to set GPIO {pin} to {state}: {e}")

def gpio_set_input(self, pin: int, pull: str):
"""Set GPIO pin to input with the given pull using pinctrl."""
cmd = ["pinctrl", "set", str(pin), "ip", pull]
self.log(f"GPIO {pin}: input ({pull})")

if self.args.dry_run:
self.log(f"DRY RUN: {' '.join(cmd)}")
return

try:
self.run_command(cmd)
except Exception as e:
raise RuntimeError(f"Failed to set GPIO {pin} to input ({pull}): {e}")

def toggle_srst(self, state: str):
"""Toggle SRST pin (dl=low, dh=high)."""
"""Drive SRST pin low (state='dl')."""
self.gpio_set(self.args.srst_pin, state)

def release_srst(self):
"""Release SRST pin to input, floating (no pull)."""
self.gpio_set_input(self.args.srst_pin, "pn")

def toggle_fwspick(self, state: str):
"""Toggle FWSPICK pin (dh=high, dl=low)."""
if state == "dh":
Expand Down Expand Up @@ -148,7 +166,7 @@ def sequence_to_fwspick_mode(self):
time.sleep(0.1)
self.toggle_fwspick("dh") # FWSPICK high
time.sleep(1)
self.toggle_srst("dh") # SRST high
self.release_srst()
time.sleep(1)
self.log("FWSPICK mode sequence complete")

Expand All @@ -159,7 +177,7 @@ def sequence_to_normal_mode(self):
time.sleep(0.1)
self.toggle_srst("dl") # SRST low
time.sleep(0.5)
self.toggle_srst("dh") # SRST high
self.release_srst()
time.sleep(2)
self.log("Normal boot mode sequence complete")

Expand Down Expand Up @@ -439,7 +457,7 @@ def main():

# GPIO control
parser.add_argument(
"--srst-pin", type=int, default=23, help="SRST GPIO pin number (default: 23)"
"--srst-pin", type=int, default=27, help="SRST GPIO pin number (default: 27)"
)
parser.add_argument(
"--fwspick-pin",
Expand Down Expand Up @@ -551,8 +569,10 @@ def main():
try:
# Handle manual GPIO operations
if args.manual_srst:
state = "dl" if args.manual_srst in ["low", "dl"] else "dh"
executor.toggle_srst(state)
if args.manual_srst in ["low", "dl"]:
executor.toggle_srst("dl")
else:
executor.release_srst()
return 0

if args.manual_fwspick:
Expand Down
4 changes: 2 additions & 2 deletions target/ast10x0/tests/mctp/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ GPIO pin assignments and serial port paths are defined in

```toml
[gpio]
srst_pin = 23 # BCM pin connected to board A SRST
srst_pin = 27 # BCM pin connected to board A SRST
fwspick_pin = 18 # BCM pin connected to board A FWSPICK

[uart]
serial_port = "/dev/ttyUSB0" # Board A serial port
baudrate = 115200

[device_b]
srst_pin = 25 # BCM pin connected to board B SRST
srst_pin = 17 # BCM pin connected to board B SRST
fwspick_pin = 24 # BCM pin connected to board B FWSPICK
serial_port = "/dev/ttyUSB1" # Board B serial port
```
Expand Down
Loading