r-cute / rcute-cozmars-server

firmware for Cozmars robot
45 stars 19 forks source link

Not starting up #17

Closed GaWr26 closed 3 years ago

GaWr26 commented 3 years ago

Hey,

first of all thank you so much for this great project! I'm currently building it with my son.

We have all parts printed and today we started setting up the electronics. The Service is running on the Raspberry Pi but I do not get the Webserver to load nor do I see any output on the screen. I have the camera, screen, servo driver, microphone and motor driver connected. I see the backlight on the display is on but nothing more. Do you have any idea where I could check? I have a feeling the display is not wired correctly. Somehow I get confused with the fritzing diagram. Could you please tell me which pins the display needs to be connected to on the Raspberry?

In conf.json I only find this:

"screen": {
    "cs": 7,
    "dc": 6,
    "rst": 5
  },

Thanks a million!

hyansuper commented 3 years ago

Did you enable spi from sudo raspi-config? Pins written in conf.json can be changed, but screen also need to connect pin 10 and 11, which are of spi bus and can not change.

sudo systemctl stop cozmars.service and sudo python3 -m rcute_cozmars_server and see if it outputs any error

GaWr26 commented 3 years ago

Thanks for getting back so quickly! spi is enabled in config. When manually starting the server I get the following error:

sudo python3 -m rcute_cozmars_server
[2020-12-19 16:28:27 +0000] [657] [INFO] Goin' Fast @ http://0.0.0.0:80
[2020-12-19 16:28:27 +0000] [657] [ERROR] Experienced exception while trying to serve
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 172, in __probe_for_device
    self.i2c.writeto(self.device_address, b"")
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 116, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 308, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 178, in __probe_for_device
    self.i2c.readfrom_into(self.device_address, result)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 106, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 56, in readfrom_into
    readin = self._i2c_bus.read_bytes(address, end - start)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 179, in read_bytes
    return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/sanic/app.py", line 1130, in run
    serve(**server_settings)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 888, in serve
    trigger_events(before_start, loop)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 696, in trigger_events
    loop.run_until_complete(result)
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/__main__.py", line 51, in before_server_start
    cozmars_rpc_server = CozmarsServer()
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/cozmars_server.py", line 81, in __init__
    self.servokit = ServoKit(channels=16, freq=self.conf['servo']['freq'])
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/rcute_servokit.py", line 13, in __init__
    i2c, address=address, reference_clock_speed=reference_clock_speed
  File "/usr/local/lib/python3.7/dist-packages/adafruit_pca9685.py", line 137, in __init__
    self.i2c_device = i2c_device.I2CDevice(i2c_bus, address)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 68, in __init__
    self.__probe_for_device()
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 180, in __probe_for_device
    raise ValueError("No I2C device at address: %x" % self.device_address)
ValueError: No I2C device at address: 40
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 172, in __probe_for_device
    self.i2c.writeto(self.device_address, b"")
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 116, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 308, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 178, in __probe_for_device
    self.i2c.readfrom_into(self.device_address, result)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 106, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 56, in readfrom_into
    readin = self._i2c_bus.read_bytes(address, end - start)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 179, in read_bytes
    return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/__main__.py", line 178, in <module>
    app.run(host="0.0.0.0", port=80, debug=False)
  File "/usr/local/lib/python3.7/dist-packages/sanic/app.py", line 1130, in run
    serve(**server_settings)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 888, in serve
    trigger_events(before_start, loop)
  File "/usr/local/lib/python3.7/dist-packages/sanic/server.py", line 696, in trigger_events
    loop.run_until_complete(result)
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/__main__.py", line 51, in before_server_start
    cozmars_rpc_server = CozmarsServer()
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/cozmars_server.py", line 81, in __init__
    self.servokit = ServoKit(channels=16, freq=self.conf['servo']['freq'])
  File "/usr/local/lib/python3.7/dist-packages/rcute_cozmars_server/rcute_servokit.py", line 13, in __init__
    i2c, address=address, reference_clock_speed=reference_clock_speed
  File "/usr/local/lib/python3.7/dist-packages/adafruit_pca9685.py", line 137, in __init__
    self.i2c_device = i2c_device.I2CDevice(i2c_bus, address)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 68, in __init__
    self.__probe_for_device()
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 180, in __probe_for_device
    raise ValueError("No I2C device at address: %x" % self.device_address)
ValueError: No I2C device at address: 40
sys:1: RuntimeWarning: coroutine 'Loop.create_server' was never awaited
GaWr26 commented 3 years ago

Hey man, I figured I had the SDA and SCL switched for the servo driver. My Bad!

It's all up and running now! Thanks for your help!