Serial Receiving from Arduino to Raspberry Pi with PySerial stops after a while

后端 未结 5 834
小蘑菇
小蘑菇 2021-01-04 19:09

I\'m working on a project in which I have to receive some 25 character data at a time in order to process it in Raspberry Pi. Here is the example code that generates some da

5条回答
  •  萌比男神i
    2021-01-04 19:36

    I had to struggle with this when reading gps data in raspberry pi. The output would stop after about 10seconds and report

     device reports readiness to read but returned no data (device disconnected?)
    

    The solutions given in almost all forums are for raspberry pi 2 with wheezy. I finally managed to get continuous gps streaming in my raspberry pi3 with jessie by doing the following:

    1. set enable_uart=1 and add dtoverlay=pi3-disable-bt in /boot/config.txt. then reboot
    2. I had to change my /boot/cmdline.txt to

      dwc_otg.lpm_enable=0 console=tty1 console=serial0,9600 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

      then reboot

    3. stop getty: sudo systemctl stop serial-getty@ttyAMA0.service

      to disable: sudo systemctl stop serial-getty@ttyAMA0.service

    You need to be careful with the /boot/cmdline.txt. Any mistake in the file may make your raspberry pi to not boot. It is better keep a backup of the file before editing. Also set the baud rate properly. In my case, it was 9600. Hope this helps!

提交回复
热议问题