Unable to get SCC with CUL detected on Raspberry Pi

Begonnen von mortenbm, 14 Januar 2024, 10:33:04

Vorheriges Thema - Nächstes Thema

mortenbm

Hi,
I have purchased a SCC from https://shop.busware.de/product_info.php/manufacturers_id/10/products_id/97 hoping to read some wireless M-bus values, but I am stuck getting the hareware recognized by the raspberry, I believe.

I have followed hints from https://www.busware.de/tiki-index.php?page=SCC_Installation and https://wiki.fhem.de/wiki/Raspberry_Pi

I get the following in fhem's log:

2024.01.13 21:52:16 1: Including fhem.cfg
2024.01.13 21:52:17 3: WEB: port 8083 opened
2024.01.13 21:52:17 2: eventTypes: loaded 0 lines from ./log/eventTypes.txt
2024.01.13 21:52:17 3: Opening CUL1 device /dev/ttyACM0
2024.01.13 21:52:17 1: CUL1: Can't open /dev/ttyACM0: No such file or directory
2024.01.13 21:52:17 1: Including ./log/fhem.save
2024.01.13 21:52:17 1: Messages collected while initializing FHEM:SecurityCheck:
  WEB is not password protected

Protect this FHEM installation by defining an allowed device with define allowed allowed
You can disable this message with attr global motd none

2024.01.13 21:52:17 1: usb create starting
2024.01.13 21:52:17 3: Probing ZWDongle device /dev/serial0
2024.01.13 21:52:17 3: Probing ZWDongle device /dev/serial1
2024.01.13 21:52:17 3: Probing CUL device /dev/ttyAMA0
2024.01.13 21:52:17 3: Probing TCM_ESP3 device /dev/ttyAMA0
2024.01.13 21:52:17 3: Probing ZWDongle device /dev/ttyAMA0
2024.01.13 21:52:18 3: Probing SIGNALDuino device /dev/ttyAMA0
2024.01.13 21:52:18 3: Probing MYSENSORS device /dev/ttyAMA0
2024.01.13 21:52:18 3: Probing ArduCounter device /dev/ttyAMA0
2024.01.13 21:52:18 3: Probing ElsnerWS device /dev/ttyAMA0
2024.01.13 21:52:19 3: Probing FRM device /dev/ttyAMA0
2024.01.13 21:52:24 3: Probing CUL device /dev/ttyS0
2024.01.13 21:52:25 1: usb create end
2024.01.13 21:52:25 0: Featurelevel: 6.2
2024.01.13 21:52:25 0: Server started with 7 defined entities (fhem.pl:28227/2023-11-29 perl:5.032001 os:linux user:fhem pid:680)


I must be related to ttyACM0 not exisiting, and this could be because the SCC is using other pins (16+17 according to https://www.busware.de/tiki-index.php?page=SCC) than is used on the pi:

wmreader@wmbusgw:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT
GPIO 1: level=1 fsel=0 func=INPUT
GPIO 2: level=1 fsel=0 func=INPUT
GPIO 3: level=1 fsel=0 func=INPUT
GPIO 4: level=1 fsel=0 func=INPUT
GPIO 5: level=1 fsel=0 func=INPUT
GPIO 6: level=1 fsel=0 func=INPUT
GPIO 7: level=1 fsel=0 func=INPUT
GPIO 8: level=1 fsel=0 func=INPUT
GPIO 9: level=0 fsel=0 func=INPUT
GPIO 10: level=0 fsel=0 func=INPUT
GPIO 11: level=0 fsel=0 func=INPUT
GPIO 12: level=0 fsel=0 func=INPUT
GPIO 13: level=0 fsel=0 func=INPUT
GPIO 14: level=1 fsel=4 alt=0 func=TXD0
GPIO 15: level=1 fsel=4 alt=0 func=RXD0
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
GPIO 19: level=0 fsel=0 func=INPUT
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=0 fsel=0 func=INPUT
GPIO 24: level=0 fsel=0 func=INPUT
GPIO 25: level=0 fsel=0 func=INPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT
BANK1 (GPIO 28 to 45):
GPIO 28: level=0 fsel=0 func=INPUT
GPIO 29: level=1 fsel=0 func=INPUT
GPIO 30: level=0 fsel=0 func=INPUT
GPIO 31: level=0 fsel=1 func=OUTPUT
GPIO 32: level=1 fsel=2 alt=5 func=TXD1
GPIO 33: level=1 fsel=2 alt=5 func=RXD1
GPIO 34: level=0 fsel=7 alt=3 func=SD1_CLK
GPIO 35: level=1 fsel=7 alt=3 func=SD1_CMD
GPIO 36: level=1 fsel=7 alt=3 func=SD1_DAT0
GPIO 37: level=1 fsel=7 alt=3 func=SD1_DAT1
GPIO 38: level=1 fsel=7 alt=3 func=SD1_DAT2
GPIO 39: level=1 fsel=7 alt=3 func=SD1_DAT3
GPIO 40: level=0 fsel=4 alt=0 func=PWM0
GPIO 41: level=0 fsel=4 alt=0 func=PWM1
GPIO 42: level=1 fsel=4 alt=0 func=GPCLK1
GPIO 43: level=1 fsel=4 alt=0 func=GPCLK2
GPIO 44: level=1 fsel=0 func=INPUT
GPIO 45: level=1 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
wmreader@wmbusgw:~ $

Additional information:
End of /boot/config.txt looks like this:
[all]
enable_uart=1
dtoverlay=miniuart-bt
core_freq=250

wmreader@wmbusgw:~ $ cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=46f67d8d-02 rootfstype=ext4 fsck.repair=yes rootwait


How do I change the uart to use pins 17+18, or is this not my problem at all?
 

rudolfkoenig

Zitatdtoverlay=miniuart-bt
The instructions for assigning the serial line to the SCC (or Razberry, etc) depends on the version of the RPi you are using, see e.g. https://wiki.fhem.de/wiki/Raspberry_Pi_3:_GPIO-Port_Module_und_Bluetooth

I am not an expert on this, just noticed the related discussions in this forum.


mortenbm

I am using a Raspberry Pi 3B, so that description is spot on.
I do think, however, the serial are okay, just not using the correct gpio-pins.
From Step 6 in https://wiki.fhem.de/wiki/Raspberry_Pi_3:_GPIO-Port_Module_und_Bluetooth I have:

wmreader@wmbusgw:~ $ cat /lib/systemd/system/hciuart.service
[Unit]
Description=Configure Bluetooth Modems connected by UART
ConditionFileNotEmpty=/proc/device-tree/soc/gpio@7e200000/bt_pins/brcm,pins
After=dev-serial1.device

[Service]
Type=forking
ExecStart=/usr/bin/btuart

[Install]
WantedBy=dev-serial1.device
wmreader@wmbusgw:~ $ ls -l /dev/serial1
lrwxrwxrwx 1 root root 5 Jan 14 10:38 /dev/serial1 -> ttyS0
wmreader@wmbusgw:~ $ ls -l /dev/ttyS0


My boot-log says:
wmreader@wmbusgw:~ $ dmesg | grep -e "tty\|serial"
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_hdmi=0 8250.nr_uarts=1 video=Composite-1:720x480@60i vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=46f67d8d-02 rootfstype=ext4 fsck.repair=yes rootwait
[    0.001013] printk: console [tty1] enabled
[    3.285496] uart-pl011 3f201000.serial: there is not valid maps for state default
[    3.287945] uart-pl011 3f201000.serial: cts_event_workaround enabled
[    3.290176] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2
[    3.296370] 3f215040.serial: ttyS0 at MMIO 0x3f215040 (irq = 86, base_baud = 31250000) is a 16550
[    5.715313] systemd[1]: Created slice system-getty.slice.
[   13.854391] uart-pl011 3f201000.serial: no DMA platform data

I have tried - from https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/configuration/uart.adoc - to add to /boot/config.txt
dtoverlay=uart1,txd1_pin=17,rxd1_pin=18

That changes
wmreader@wmbusgw:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
[...]
GPIO 14: level=1 fsel=4 alt=0 func=TXD0
GPIO 15: level=1 fsel=4 alt=0 func=RXD0
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
to
wmreader@wmbusgw:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
[...]
GPIO 14: level=1 fsel=4 alt=0 func=TXD0
GPIO 15: level=1 fsel=4 alt=0 func=RXD0
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=1 fsel=2 alt=5 func=RTS1
GPIO 18: level=0 fsel=2 alt=5 func=PWM0

What can I do to make the pins become 'normal' uart pins?

Otto123

#3
Zitat von: mortenbm am 14 Januar 2024, 10:33:04How do I change the uart to use pins 17+18, or is this not my problem at all?
Sorry I had no SCC, but I understand: SCC is using normal UART AND two pins only to control the modul.
You have to switch the modul on at system level on behalf of the PIN 17
See this link https://forum.fhem.de/index.php/topic,106060.msg1003767.html#msg1003767
Sorry it's in german but the code is language independent ;)

See also the original document from manufacturer https://www.busware.de/tiki-index.php?page=SCC_Installation
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

mortenbm

You are right.
I was reading it as the two pins were used for the UART.
Let me reconsider and try a few things - thank you very much for taking time to help me out!