Comments (10)
@sskorol Thank you for your committing the issue. we have done a workaround to fix it.
from opencat.
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.
Ok, thanks, I'll test it today.
from opencat.
@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.
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.
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.
@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:
Please have a try again and feel free to contact us. Thanks a lot.
from opencat.
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, 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: 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.
@sskorol, thank you for your advice. We'll fix it in a better way.
from opencat.
Related Issues (20)
- Running the Firmware Uploader on a Raspberry PI does not work HOT 1
- Changing the speed of "Walk" HOT 1
- MU Camera using arduino IDE error HOT 2
- Can I make a deb package for OpenCat UI app? HOT 1
- wrong-path-for-interpreter /opt/anaconda3/envs/petoi/bin/python3
- very-long-line-length-in-source-file > 512 HOT 3
- Unable to upload code after bluetooth connection failed HOT 10
- Wrong
- compatible with "azure openai api"
- Adding to siri, but not work in siri. HOT 2
- Can you configure a standard Python package format for setup.py?
- opencat app bug : Team: 网络连接已中断。 HOT 2
- After uploading the code of OpenCat.ino Robot will not accept any new code. HOT 3
- Sketch too big for NyBoard V0_2 HOT 2
- Petoi Bluetooth Adapter not compatible with NyBoard_V02 ? HOT 2
- pyUI/commonVar.py uses wrong paths for Linux HOT 2
- Is there a way to disable the beep sound? HOT 1
- Getting data from IMU data (such as YRP and Accelerators) on the main source HOT 9
- Add support for Mistral HOT 1
- ardSerial.py suggestion HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencat.