c0d5aa283837bdb4fd7ab6c6e51b170277d02b4a
modbusmaster
Disable Bluetooth on RPi3
Add at the end of /boot/config
:
dtoverlay=pi3-disable-bt
Remove mentions of serial0
from /boot/cmdline
.
Enable rs485 mode
Use the submodule rpirtscts to enable to alternate functions of the related pins at the RPi MCU. It is submoduled here, can be found directly at https://github.com/mholling/rpirtscts
cd rpirtscts
gcc -o rpirtscts rpirtscts.c
sudo ./rpirtscts on
This needs to be done at every boot.
Kudos to danjperron, cmp. (https://www.raspberrypi.org/forums/viewtopic.php?f=98&t=224533&hilit=rs+485#p1383709)
Python snippet to test
import serial.rs485
ser=serial.rs485.RS485(port='/dev/ttyAMA0',baudrate=9600)
ser.rs485_mode = serial.rs485.RS485Settings(False,True)
ser.write('a test'.encode('utf-8'))
Description
Languages
Python
100%