GPIO not able to be written to (GPIOSPIConn.recv() returns 255 all the time)

Hey everyone,

I have installed a custom OS on my AutoPi device for my Master’s thesis and am having some problems setting it up. We thought to use AutoPi because of its wealth of hardware capabilities (GPS, LTE, Accelerometer, CAN, etc).

My AutoPi board gets disconnected after 10 minutes, something I traced by scouring this forum to the SPM on the board not receiving a heartbeat to keep it alive. I managed to create some Python scripts copied from the AutoPi-Core software to mimic the SPM Manager and send a heartbeat to the GPIO pins. My code is located here.

In my code, I have assumed that my SPM firmware is version 1, not 2. In all honesty, I am not really sure what version my SPM is. However, additional libraries would need to be installed on my Linux OS in order to make the code for SPM 2.0 work so I’m just hoping it is v1. Thus, I am using the GPIOSPIConn class to communicate with the GPIO pins.

In GPIOSPIConn.setup(), a 0 byte is sent to the MOSI pin and a 0 byte is expected back from the MISO pin. Currently, I am doing that but receiving a 255 byte back, all ones. In fact, all calls to GPIOSPIConn.recv() return 255.

I need to the MISO pin to return the proper Acks and I need the MOSI to send heartbeats!
Any help would be appreciated!

Problem-specific information:

The following is my environment:
Device: AutoPi Telematics Unit - 4G/LTE Edition
Board: Raspberry Pi 4 B+, 2GB
Operating system: Automotive Grade Linux (10.0.1)

This is the actual return:

Setting up GPIO SPI connection
TX: 0
RX: 255.0
Added delay of 0.00031211699991945353 second between last send and current receive
Unable to clear buffer - got unexpected value: 255.0
TX: 0
RX: 255.0
Added delay of 0.00038391900001261093 second between last send and current receive
Unable to clear buffer - got unexpected value: 255.0
TX: 0
RX: 255.0
Added delay of 0.0003906410000927281 second between last send and current receive
Unable to clear buffer - got unexpected value: 255.0
TX: 100
RX: 255.0
Added delay of 0.00042462499994871906 second between last send and current receive
Expected ack ‘200.000000’ but got ‘255.000000’
RX: 255.0
Expected ack ‘200.000000’ but got ‘255.000000’
RX: 255.0
Expected ack ‘200.000000’ but got ‘255.000000’
Unable to send noop: Expected ack ‘200.000000’ but got ‘255.000000’
TX: 100
RX: 255.0
Expected ack ‘200.000000’ but got ‘255.000000’
RX: 255.0
Expected ack ‘200.000000’ but got ‘255.000000’
RX: 255.0
Expected ack ‘200.000000’ but got ‘255.000000’
Unable to send noop: Expected ack ‘200.000000’ but got ‘255.000000’
TX: 100
RX: 255.0
Added delay of 0.00034876799999256037 second between last send and current receive
Expected ack ‘200.000000’ but got ‘255.000000’
RX: 255.0
Expected ack ‘200.000000’ but got ‘255.000000’
RX: 255.0
Expected ack ‘200.000000’ but got ‘255.000000’
Unable to send noop: Expected ack ‘200.000000’ but got ‘255.000000’
Failed to start SPM manager
Stopping SPM manager
Traceback (most recent call last):
File “spm_manager.py”, line 145, in
main()
File “spm_manager.py”, line 129, in main
heartbeat_handler()
File “spm_manager.py”, line 72, in heartbeat_handler
conn.heartbeat()
File “/home/0/autopi-spm-manager/spm_conn.py”, line 87, in heartbeat
self.noop()
File “/usr/lib/python3.8/site-packages/retrying.py”, line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File “/usr/lib/python3.8/site-packages/retrying.py”, line 212, in call
raise attempt.get()
File “/usr/lib/python3.8/site-packages/retrying.py”, line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File “/usr/lib/python3.8/site-packages/six.py”, line 703, in reraise
raise value
File “/usr/lib/python3.8/site-packages/retrying.py”, line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File “/home/0/autopi-spm-manager/spm_conn.py”, line 80, in noop
self.recv(ack=ACK_NOOP)
File “/usr/lib/python3.8/site-packages/retrying.py”, line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File “/usr/lib/python3.8/site-packages/retrying.py”, line 212, in call
raise attempt.get()
File “/usr/lib/python3.8/site-packages/retrying.py”, line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File “/usr/lib/python3.8/site-packages/six.py”, line 703, in reraise
raise value
File “/usr/lib/python3.8/site-packages/retrying.py”, line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File “/home/0/autopi-spm-manager/gpio_spi_conn.py”, line 110, in recv
raise Exception(msg)
Exception: Expected ack ‘200.000000’ but got ‘255.000000’

This topic was automatically closed 33 days after the last reply. New replies are no longer allowed.