Closed Kinvert closed 4 years ago
With the lates version of the SDK, you should be able to replace the SpheroRvrObserver()
call with SpheroRvrObserver(serial_port='/dev/serial0')
in your code.
We'd like to leave the default as '/dev/ttyS0' since we primarily advertise support for the Pi 3B, 3B+, and Pi Zero, which have it available. A fix allowing the customization of the Observer serial port is now available, which can be used to set a different port address.
@Kinvert There's been a change to the way we open up the customization of the serial port. In order to change the default serial port for SpheroRvrObserver
an instance of SerialObserverDal
with the new port address must be assigned to the dal parameter, like so:
rvr = SpheroRvrObserver(
dal=SerialObserverDal(
port_id='/dev/ttyAMA0'
)
)
We did this In order to keep instantiation of SpheroRvrAsync
and SpheroRvrObserver
consistent.
I was getting serial.serialutil.SerialException could not open port /dev/ttyS0 when running code.
In Raspberry Pi, I checked /boot/config.txt and saw that enable_uart=1 was indeed set.
I checked /dev/ and found no ttyS0 but instead did see ttyAMA0.
I went in to the observer client and changed the port to serial0 instead of ttyS0. This worked for me.
Here is the change I made to fix this issue.
https://github.com/Kinvert/sphero-sdk-raspberrypi-python/commit/9f641e2db2d52e65aa40964fc53d10de26201c12
Not sure if my problem is a common one or if it was specific to me. I was under the impression that generally when setting enable_uart=1 that ttyS0 should show up. I do have a new Raspbian install.