diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..95bf7f4 --- /dev/null +++ b/readme.md @@ -0,0 +1,26 @@ +## Disable the serial console, disable bluetooth and disable the hciuart service: + +https://www.raspberrypi.org/documentation/configuration/uart.md +https://www.raspberrypi.org/forums/viewtopic.php?t=178071 + + +### Disable hciuart and other bluetooth related services: +* `systemctl disable hciuart` +* `systemctl disable bluealsa` +* `systemctl disable bluetooth` + +### Disable serial console: +* Check `/boot/cmdline.txt` +* Comment line `console=serial0,115200` or `console=ttyAMA0,115200` or similar + +### Disable bluetooth +* Add `dtoverlay=pi3-disable-bt` to `/boot/config.txt` + + + +## Serial port configuration in Python: + +https://pythonhosted.org/pyserial/shortintro.html#opening-serial-ports + +Consider a timeout! + diff --git a/snippets/snippet1.py b/snippets/snippet1.py index 59255bf..a37bf3a 100644 --- a/snippets/snippet1.py +++ b/snippets/snippet1.py @@ -114,6 +114,8 @@ class MeterbusSerial(object): self.port.write(msg) + # FIXME: Attention, the actual write time of the interface is not considered. + # This is a measured value. sleep(0.030) frontendHold() @@ -130,6 +132,7 @@ class MeterbusSerial(object): expectedUserDataOctets = 0 state = MeterbusResponseStates.START1 while (state not in [MeterbusResponseStates.DONE, MeterbusResponseStates.ERROR]): + print("Waiting for input ... ") c = self.port.read() print("State {}, Octet {}".format(state, c))