Giter Site home page Giter Site logo

Comments (10)

JasonWong08 avatar JasonWong08 commented on August 18, 2024

@sskorol Thank you for your committing the issue. we have done a workaround to fix it.

from opencat.

borntoleave avatar borntoleave commented on August 18, 2024

We have added a logic to automatically select the Pi's port when it's connected directly through the 2x5 socket (not through USB). You can still manually define the port if the automatic logic doesn't work in your case.

We tested the script on Raspian. We didn't observe other problems you mentioned in your issue. The script can keep taking serial commands until you enter "q" or "quit".

Please let us know if you have more problems, or is it ok to close this issue.

from opencat.

sskorol avatar sskorol commented on August 18, 2024

Ok, thanks, I'll test it today.

from opencat.

sskorol avatar sskorol commented on August 18, 2024

@borntoleave @JasonWong08 I tested the new code and still see the same issues. I recorded the video with mostly all of them: https://youtu.be/v-gfkdAKLus

from opencat.

sskorol avatar sskorol commented on August 18, 2024

I have a quick update. Just googled issues with RPi serial port. Found the following thread: https://raspberrypi.stackexchange.com/questions/114366/rpi4-serial-port-not-working-on-either-raspberry-os-or-ubuntu

I followed all the steps from the answer and now the serial port works as expected. I tried different commands. There are no hangings or weird movements anymore. Most likely there were some serial interruptions with integrated BT, as I noticed a dtoverlay in my boot config + there was a python-serial installed via apt.

Anyway, it's worth copy-pasting the following instructions to your official docs for all the users that may face similar issues with RPi hats:

  • add enable_uart=1 to /boot/config.txt
  • remove console=serial0,115200 from /boot/firmware/cmdline.txt on Ubuntu and /boot/cmdline.txt on Raspberry Pi OS
  • disable the serial console: sudo systemctl stop [email protected] && sudo systemctl disable [email protected]
  • make sure you have pyserial installed if you're using the python serial library, not python-serial from apt.
  • create the following udev file (I created /etc/udev/rules.d/50-tty.rules):
KERNEL=="ttyS0", SYMLINK+="serial0" GROUP="tty" MODE="0660"
KERNEL=="ttyAMA0", SYMLINK+="serial1" GROUP="tty" MODE="0660"
  • reload your udev rules: sudo udevadm control --reload-rules && sudo udevadm trigger
  • change the group of the new serial devices:
sudo chgrp -h tty /dev/serial0
sudo chgrp -h tty /dev/serial1
  • The devices are now under the tty group. Need to add the user to the tty group and dialout group:
sudo adduser $USER tty
sudo adduser $USER dialout
  • update the permissions for group read on the devices:
sudo chmod g+r /dev/ttyS0
sudo chmod g+r /dev/ttyAMA0
  • reboot

Or just create a script that will do this automatically.

P.S. ttyS0 still doesn't seem to be detected automatically. + There's no exceptions handling.

from opencat.

sskorol avatar sskorol commented on August 18, 2024

BTW, here's what I get from platfrom.uname() in Python on RPi / Ubuntu:

uname_result(system='Linux', node='rpi', release='5.4.0-1047-raspi', version='#52-Ubuntu SMP PREEMPT Wed Nov 24 08:16:38 UTC 2021', machine='aarch64', processor='aarch64')

from opencat.

JasonWong08 avatar JasonWong08 commented on August 18, 2024

@sskorol, Great! You got the key! you can refer to my post on OpenCat Forum about how to solve this issue (https://www.petoi.camp/forum/software/fixed-the-issue-on-github-new-serial-code-doesn-t-work-with-rpi-hat-16).
actually we use the serial port - /dev/ttyS0
So on your side, you can modify the script simply like this:
fix-issue
Please have a try again and feel free to contact us. Thanks a lot.

from opencat.

JasonWong08 avatar JasonWong08 commented on August 18, 2024

For raspberry Pi hardware, if you plug it in Nyboard, We actually use /dev/ttyS0. No matter what operating system you installed (Ubuntu or Raspbian etc.), you should enable it at first.
If you installed Raspbian, you can refer to the Section 4.4.1. (Config Raspberry Pi serial port) in the user manual
https://bittle.petoi.com/4-configuration

If you installed Ubuntu, you can refer to @sskorol 's comment above.

from opencat.

sskorol avatar sskorol commented on August 18, 2024

@sskorol, Great! You got the key! you can refer to my post on OpenCat Forum about how to solve this issue (https://www.petoi.camp/forum/software/fixed-the-issue-on-github-new-serial-code-doesn-t-work-with-rpi-hat-16). actually we use the serial port - /dev/ttyS0 So on your side, you can modify the script simply like this: fix-issue Please have a try again and feel free to contact us. Thanks a lot.

@JasonWong08 @borntoleave if you take a look at the above comments and video, you'll notice that there was no problem for me to change a port in a code. The issue I highlighted is about the actual fact that platform.uname()[1] == 'raspberrypi' you use for automatic ttyS0 assignment in a script doesn't work on Ubuntu/RPi (see the output of a #16 (comment)).

And all the other issues probably appeared due to Serial conflicts affected by a combination of hardware and software. You can take a look deeply at the video to see what happens with Bittle in case of serial port issues, even if you manually set ttyS0 in code.

P.S. I noticed you've already added the above instruction from #16 (comment) to docs. That's great! So the only thing left here is to fix the code.

from opencat.

JasonWong08 avatar JasonWong08 commented on August 18, 2024

@sskorol, thank you for your advice. We'll fix it in a better way.

from opencat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.