Open Mikefly123 opened 1 month ago
This new implementation available on the circuit-python-cleanup branch that splits all of the initializations into separate try/except statements.
"""
Intializing Communication Buses
"""
try:
self.i2c0 = busio.I2C(board.I2C0_SCL, board.I2C0_SDA)
self.hardware["I2C0"] = True
except Exception as e:
self.error_print(
"ERROR INITIALIZING I2C0: " + "".join(traceback.format_exception(e))
)
try:
self.spi0 = busio.SPI(board.SPI0_SCK, board.SPI0_MOSI, board.SPI0_MISO)
self.hardware["SPI0"] = True
except Exception as e:
self.error_print(
"ERROR INITIALIZING SPI0: " + "".join(traceback.format_exception(e))
)
try:
self.i2c1 = busio.I2C(board.I2C1_SCL, board.I2C1_SDA, frequency=100000)
self.hardware["I2C1"] = True
except Exception as e:
self.error_print(
"ERROR INITIALIZING I2C1: " + "".join(traceback.format_exception(e))
)
try:
self.uart = busio.UART(board.TX, board.RX, baudrate=self.urate)
self.hardware["UART"] = True
except Exception as e:
self.error_print(
"ERROR INITIALIZING UART: " + "".join(traceback.format_exception(e))
)
Potential Issue
In the legacy configuration of the code all of the communication buses initialized in a single try / except statement. See the example from the as flown flight software on Pleiades - Squared:
The problem with this scheme is that if an error is thrown during the
self.i2c0
initialization it will block all subsequent initializations from taking place. The SPI0 bus is a critical part of the satellite because that is the only way the microcontroller communicates with the radio. On Yearling-2 and Pleiades - Squared we had both the PCA Face Power Driver and TCA I2C Multiplexer on I2C0, if either of these devices suffered a latch up that bricked that bus it is possible that it would block the initialization of the SPI bus that communicates with the radio.Test Case
I think we should have someone go and short the I2C0 SDA and SCL lines together and to GND to see if that kind of failure would actually stop an orderly initialization of the satellite buses.