RVR RaspberryPi 4 model B, Python 3.75, keyboard-control problem

Hello, Newbie here. I am using a Raspberry Pi 4 model B with Python 3.75 on my RVR. All setup completed successfully, I believe. Attempted to run the project keyboard_control and received what you see below. What is wrong? Help deeply appreciated. How do I figure it out?

Thanks, wmwinkle1

(sphero-sdk-raspberrypi-python) pi@raspberrypi:~/sphero-sdk-raspberrypi-python/projects/keyboard_control $ python drive_with_wasd_keys.py

Checking RVR firmware versions…

Traceback (most recent call last):

File “drive_with_wasd_keys.py”, line 22, in

loop

File “/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/toys/sphero_rvr_async.py”, line 36, in init

self._check_rvr_fw()

File “/usr/lib/python3.7/asyncio/base_events.py”, line 584, in run_until_complete

return future.result()

File “/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/firmware/rvr_fw_check_async.py”, line 26, in _check_rvr_fw

rvr_nordic_version = await self.__rvr.get_main_application_version(target=SpheroRvrTargets.primary.value, timeout=3)

File “/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/toys/sphero_rvr_async.py”, line 87, in get_main_application_version

return await self._dal.send_command(**command_dict)

File “/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/dal/serial_async_dal.py”, line 78, in send_command

timeout=timeout

File “/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/server/handler/api_sphero_handler.py”, line 191, in send_command

await asyncio.shield(asyncio.wait_for(future, timeout=timeout))

File “/usr/lib/python3.7/asyncio/tasks.py”, line 423, in wait_for

raise futures.TimeoutError()

concurrent.futures._base.TimeoutError

(

The futures.TimeoutError() exception being raised indicates RVR did not respond to the command to check firmware versions. Make sure that you have RX, TX, and GND connected properly between RVR and your Raspberry Pi. You’ll also need to make sure your UART is properly configured on the Pi.

Instructions can be found here. They’re not specific to the Pi 4, so there may be some additional configuration for the Pi UART and ensure that the scripts are using the correct TTY if it needs to be something other than the default. (This is set in the constructor of SerialAsyncDal and defaults to port_id='/dev/ttyS0')

Jim

Jim,

Thanks for your help. I have confirmed the wiring is correct from the Raspberry Pi to the RVR. Pi GPIO pin 8 txd to RVR rxd, and GPIO pin 10 rxd to RVR txd, pin14 - gnd to RVR gnd see photo attached.

I have enabled the serial communications from the Pi by:

  1. SSH into Pi
  2. enter sudo raspi-config
  3. select option 5 -interfacing
  4. select option P6-serial
    5 when asked,“Would you like a login shell to be accessible over serial?” -answered NO
  5. when asked," would you like the serial port hardware to be enabled?" -answered Yes
  6. Exit and reboot

On reboot enabled VM via pipenv shell successfully. Proceeded as below. Again your help appreciated

(sphero-sdk-raspberrypi-python) pi@raspberrypi:~/sphero-sdk-raspberrypi-python/projects/keyboard_control **python drive_with_wasd_keys.py** *Checking RVR firmware versions...* *Traceback (most recent call last):* *File "drive_with_wasd_keys.py", line 22, in <module>* *loop* *File "/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/toys/sphero_rvr_async.py", line 36, in __init__* *self._check_rvr_fw()* *File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete* *return future.result()* *File "/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/firmware/rvr_fw_check_async.py", line 26, in _check_rvr_fw* *rvr_nordic_version = await self.__rvr.get_main_application_version(target=SpheroRvrTargets.primary.value, timeout=3)* *File "/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/toys/sphero_rvr_async.py", line 87, in get_main_application_version* <i>return await self._dal.send_command(**command_dict)</i> *File "/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/client/dal/serial_async_dal.py", line 78, in send_command* *timeout=timeout* *File "/home/pi/sphero-sdk-raspberrypi-python/sphero_sdk/asyncio/server/handler/api_sphero_handler.py", line 191, in send_command* *await asyncio.shield(asyncio.wait_for(future, timeout=timeout))* *File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for* *raise futures.TimeoutError()* *concurrent.futures._base.TimeoutError* *(sphero-sdk-raspberrypi-python) pi@raspberrypi:~/sphero-sdk-raspberrypi-python/projects/keyboard_control *

Hello, I have checked the resistance of the jumper wires and they are not open.

Is there any configuration settings on the RVR I should check to troubleshoot why serial communication continues to fail?

Hi @wmwinkle, I’m sorry I lost track of this thread. One detail I missed before is it sounds like you may have just gotten your RVR. Have you updated the firmware? The factory firmware has the UART disabled, so you need to connect it to the EDU app on Android or iOS to update to the latest firmware for it to communicate. Have you done that yet?

Jim

I connected to the RVR w/ the Android app and it updated. Is there a way verify it has been updated? One factor I have noticed is that the instructions say Rev2. I was an original supporter pre production and I assume I received the original rev 1 RVR. Does that make a difference? I was unable to work on the RVR until much later.

There’s actually only 1 hardware revision of RVR that shipped to customers, regardless of preorder status, so your hardware is all up to date. Where did you see a reference to Rev1 and Rev 2?

To check your firmware versions after updating, tap on the connect button again after connecting with the EDU app, and look for the firmware versions shown below:

Have you rechecked your wiring since performing the update? That’s always the first thing to check. Looking again at your photo, it’s hard for me to tell for sure since the UART port on RVR is a bit out of focus, but it looks like you have +5V, GND, and TX connected in that photo, instead of GND, TX, RX.

If you’re still having trouble, I would suggest the following:

  1. Start digging into the nuts and bolts of UART configuration on the Pi 4.
    https://www.raspberrypi.org/documentation/configuration/uart.md
  2. Check for UART traffic with a logic analyzer if you have one, otherwise…
  3. You could also connect a 3.3V USB to UART adapter between the Pi and a computer to make sure that there’s actually some UART activity when you run a RVR script.

Finally, for any testing I’d recommend running `getting_started/asyncio/api_and_shell/echo.py for the simplest test that won’t have RVR driving off a table as soon as you get things straightened out.

Jim

SPHERO Email Marketing -