amescon / raspicomm-module

raspicomm kernel module with tty driver support for rs485 (raspicommrs485.ko)
12 stars 14 forks source link

Compile error on 4.14.30-v7+ #10

Open Itatsi opened 6 years ago

Itatsi commented 6 years ago

Hy, I've got problems to make the raspicomm driver for kernel 4.14 for use with PI3B+ Because I was unable to compile the module against the Kernel Header i've tried to compile it with current Raspberry Pi Kernel Source and ended with this.

LC_ALL=C make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C ../linux/linux-raspberrypi-kernel_1.20180328-1/ -j 4 M=$(pwd) modules

make: Entering directory '/home/user/git/raspberrypi/linux/linux-raspberrypi-kernel_1.20180328-1'
  CC [M]  /home/user/git/raspberrypi/raspicomm-module/module.o
In file included from /home/user/git/raspberrypi/raspicomm-module/module.c:16:0:
/home/user/git/raspberrypi/raspicomm-module/platform.h:1:100: fatal error: mach/platform.h: Datei oder Verzeichnis nicht gefunden (translate: File or Directory not found)
 #include <mach/platform.h> /* included for BCM2709 & BCM2708 definitions, e.g. BCM2708_PERI_BASE */
                                                                                                    ^
compilation terminated.
scripts/Makefile.build:328: die Regel für Ziel „/home/user/git/raspberrypi/raspicomm-module/module.o“ scheiterte  (translate: recipe for target ... failed)
make[1]: *** [/home/user/git/raspberrypi/raspicomm-module/module.o] Fehler 1
Makefile:1519: recipe for target '_module_/home/user/git/raspberrypi/raspicomm-module' failed
make: *** [_module_/home/user/git/raspberrypi/raspicomm-module] Error 2
make: Leaving directory '/home/user/git/raspberrypi/linux/linux-raspberrypi-kernel_1.20180328-1'

As far as I found out (raspberrypi/linux#1844) the problem have to do something with the constraint to use devicetree.

Martin-Furter commented 6 years ago

I am running kernel 4.9.59-v7+ on a raspberry pi 2 B+. I created a fork since I had the same problem. It is more or less a complete rewrite since so many things changed in the kernel. You can find it here if you want to give it a try: https://github.com/Martin-Furter/raspicomm-module

Itatsi commented 6 years ago

@Martin-Furter is this compatible with Pi 3B (Kernel 4.14)?

Martin-Furter commented 6 years ago

I compiled it for kernel 4.14.34-v7+ and uploaded the binary module. Seems to work fine here on a Pi2B. I think it should also work on a Pi3B but i can't test it.

Martin-Furter commented 6 years ago

@Runenprister: My module made some troubles, i got deadlocks and SPI errors. But version 1.0.1 seems to fix both. Could you please give it a try?

Itatsi commented 6 years ago

@Martin-Furter ok... the driver is working but it seams like I only get garbage :/ What ive done so far:

echo "dtparam=spi=on
dtoverlay=spi0-hw-cs" >> /boot/config.txt
echo "raspicommrs485" >> /etc/modules
echo "blacklist spi-bcm2835
blacklist spidev
blacklist spi-bcm2835aux" > /etc/modprobe.d/raspi-blacklist.conf
cp binaries/4.14.34-v7+/raspicommrs485.ko /lib/modules/4.14.34-v7+/kernel/drivers/tty/serial
cp binaries/spi0devdis.dtbo /boot/overlays/spi0devdis.dtbo
depmod -a
modprobe raspicommrs485

after a reboot the module is loaded^^

stty -F /dev/ttyRPC0 9600 raw -echo
echo "Hallo Welt" > /dev/ttyRPC0

I can see with an LED that something is send, but im unable to receive even broken chars with my PC

(PS.: connected with RS485 to RS232 converter) (PPS.: Same setup is working with PI2 and old driver)

Itatsi commented 6 years ago

@Martin-Furter in the same constellation (same SD-Card, RS486 to 232 Converter, new Driver,... ) it is working with an PI3B. The Problem only occurs on PI3B+.

Itatsi commented 6 years ago

@Martin-Furter have you got any idea what I can do to solve the problem with PI3B+ or help you to debug it?

Martin-Furter commented 6 years ago

@Runenprister: Sorry for the late reply.

Edit version.txt and set it to "mf-1.0.1pre1", them "make clean" and "make", and you have a version which should produce debug output, use "dmesg -w" to follow it.

It will output lines looking like this, showing the SPI communication, and some other debug messages: WrDat 8041 TE=0 RTS=0 P=0 D=41 -- 0000 R=0 T=0 RA/FE=0 CTS=0 P=0 D=00 WrCfg CC0B FEN=0 SHDN=0 TM=1 RM=1 PM=0 RAM=0 IR=0 ST=0 PE=0 L=0 BR=B -- 0000 R=0 T=0 RdDat 0000 -- 0000 R=0 T=0 RA/FE=0 CTS=0 P=0 D=00

bbinet commented 5 years ago

@Itatsi FYI, I've also fixed this compilation issue you mention, while keeping the original raspicommrs485 kernel module implementation from Amescon. See: https://github.com/helioslite/raspicomm-module And the small patch is here: https://github.com/helioslite/raspicomm-module/commit/f92113be50bf1d314693668ddd2e9f3030054089

martinriemer commented 4 years ago

I would like to use the raspicomm on rpi-1 4.19.57+. Is there a change to compile it on an up to date PI? I like the HW so would be a waste to dump it.

Martin-Furter commented 4 years ago

I use it with PI2B+ and a little bit older kernel. As Itatsi reports above it should run on PI3B, but PI3B+ makes trouble. I don't have anything newer than PI2B+ so I can't test it. But if you have an older PI you should try my version, there are good chances that it works.