@mitch.kremm, and any forum hardware guru:
I am looking for a way to reset the GoPiGo3 board when it fails to properly handle I2C traffic. (Currently must perform hard shutdown to clear the issue.)
GrovePi+ user @Dimu has posted a method of resetting the GrovePi+ by cycling GPIO 8
On the GoPiGo3 schematic, I see that GPIO18 labeled RPI_RESET passes through a level shifter “2L” and exits as “2H” labeled AT_RESET which is connected to the ATSAMC20J RESET line with a 5v pull-up.
Will cycling the RaspberryPi GPIO18 (RPI GPIO Header pin 12) briefly low using user @Dimu 's method reset the GoPiGo3 board?
Does the EasyGoPiGo3() or GoPiGo3() class do any board initialization that would need to be repeated after a GoPiGo3-board-only reset?
Here is what I am thinking of running if I cannot detect the DistanceSensor on I2C 0x2A:
#!/usr/bin/env python3
import RPi.GPIO as GPIO
import time
# add Carl's Python library to import path
import sys
sys.path.insert(1,"/home/pi/Carl/plib")
import lifeLog
import runLog
BOARD_PIN_12=12 # Physical Board Pin 12 in GPIO.BOARD mode (GPIO18 in GPIO.BCM mode)
# is GoPiGo3 RPI_RESET connects through level shifter to AT_RESET
@runLog.logRun
def fixI2Cjam():
lifeLog.logger.info("Forcing GoPiGo3 Board Reset Via GPIO18 To Clear I2C Failure")
GPIO.setmode(GPIO.BOARD) # use physical pin numbers
GPIO.setup(BOARD_PIN_12,GPIO.OUT, pull_up_down=GPIO.PUD_UP))
time.sleep(0.5) # allow time for setup to complete
GPIO.output(BOARD_PIN_12,GPIO.LOW) # Yank the AT_RESET chain
time.sleep(1) # Keep it low to ensure reset
GPIO.output(BOARD_PIN_12,GPIO.HIGH) # Let GoPiGo3 run again
time.sleep(0.5)
runLog.entry("GoPiGo3 Board Reset to Clear I2C Failure Complete"
if __name__ == '__main__': fixI2Cjam()