CH382L, M.2 to PCIe adapter on SBC not recognised by Linuxcnc

More
02 Mar 2024 16:33 #294921 by arda
Hi,

I have installed Linuxcnc 2.9.2 on a 64-bit x86 SBC (LattePanda Delta) and I am trying to access LPT with a WCH382L chip through PCIe. PCIe socket of the card is connected to M.2 socket of SBC using an adapter. After powering the addon card with the necessary 12V, I am able to read 3.2V or 0v from random pins but there is no sign of detection of the parallel port on the system. Commands like lspci and dmesg doesn't return any information about a parallel port. Please correct me if I am wrong but as I understood while reading forum posts a supported chip should be recognized by the system automatically. I have seen some posts about people were able to use an addon card with CH382L, but information about M.2 to PCIe adapters for Linuxcnc is limited. I did some tests reading values from pins while running the parallel port tester program with various recommended hex addresses but it wasn't successful. By the way, I am able to use this addon card connected to PCIe slot of a motherboard that is running Windows 7 successfully. 

So what could the issue be? Is it the notorious CH382L, M.2 to PCIe adapter, or am I supposed to do something for the system to recognize the card? Your help is greatly appreciated.

Thanks.

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 17:19 #294923 by tommylight
First you have to make sure your M.2 slot is actually PCI-E as the same slot can also be SATA and this will not work.
Some PC's have the option to choose what the slot does in BIOS, some do that automatically, and some do nothing at all as they have only one of the options.
Another thing to change in BIOS is to lower the PCI-E speed/generation to the lowest possible, as those adapter cables are pretty bad so most will not do gen3 or gen4 at all.

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 18:20 #294928 by arda
Thanks for your suggestions. I checked M.2 port again and it is a PCIe slot. PCIe speed setting on BIOS was on auto, other options were Gen1 and Gen2. I chose Gen1 and checked with lspci -v again and still no sign of a serial, parallel port or chip name.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 19:12 - 02 Mar 2024 19:35 #294931 by Mecanix
$ lsmod
How does your kernel drive it?



Tried that?
loadrt hal_parport cfg="0x3050 out"
Last edit: 02 Mar 2024 19:35 by Mecanix.

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 19:21 #294933 by Mecanix
Let's have a look at your $lspci and $lsmod

#define VENDOR_ID_WCH_PCIE  0x1C00
#define SUB_VENDOR_ID_WCH_PCIE  0x1C00
... ...
#define DEVICE_ID_WCH_CH382_2S           0x3253
#define SUB_DEVICE_ID_WCH_CH382_2S     0x3253
#define DEVICE_ID_WCH_CH382_2S1P       0x3250
#define SUB_DEVICE_ID_WCH_CH382_2S1P   0x3250
 

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 19:34 #294935 by arda
Thanks for your suggestions. lsmod outputs "parport 73728 3 parport_pc, lp, ppdev" in one of its lines if that was you were suggesting me to check.

As far as I read from the forum addon card should be detected automatically but there is no sign of detection, so I am not sure how the kernel is supposed to drive it. I tried "make Makefile" on driver from manufacturer but it outputs errors and I have seen a few people mentioned the same errors on this forum. But unlike my situation their card appeared on lspci -v and they fixed the problem with some workarounds. Please correct me if I'm wrong in any of these.

I tried loadrt hal_parport cfg="0 out". 0xe000, 0xe100, 0xe010 too.

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 19:47 #294936 by Mecanix
See edit two up (addy 0x3050)

$ cat /proc/ioports | grep parport
Should output 0000-0000 : parport0 if present. Output nothing if not.

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 20:00 - 02 Mar 2024 20:01 #294938 by arda
0x3050 also didn't work. Says "No parport registered at 0x3050." and no change at pin voltages when I toggle pins on test software.

$ cat /proc/ioports | grep parport outputs nothing.

lspci:

00:00.0 Host bridge: Intel Corporation Gemini Lake Host Bridge (rev 06)
00:00.1 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Dynamic Platform and Thermal Framework Processor Participant (rev 06)
00:02.0 VGA compatible controller: Intel Corporation GeminiLake [UHD Graphics 600] (rev 06)
00:0c.0 Network controller: Intel Corporation Gemini Lake PCH CNVi WiFi (rev 06)
00:0e.0 Audio device: Intel Corporation Celeron/Pentium Silver Processor High Definition Audio (rev 06)
00:0f.0 Communication controller: Intel Corporation Celeron/Pentium Silver Processor Trusted Execution Engine Interface (rev 06)
00:12.0 SATA controller: Intel Corporation Celeron/Pentium Silver Processor SATA Controller (rev 06)
00:13.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:14.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6)
00:15.0 USB controller: Intel Corporation Celeron/Pentium Silver Processor USB 3.0 xHCI Controller (rev 06)
00:17.0 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor I2C 4 (rev 06)
00:17.1 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor I2C 5 (rev 06)
00:17.2 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor I2C 6 (rev 06)
00:18.0 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Serial IO UART Host Controller (rev 06)
00:18.1 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Serial IO UART Host Controller (rev 06)
00:18.2 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Serial IO UART Host Controller (rev 06)
00:18.3 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Serial IO UART Host Controller (rev 06)
00:19.0 Signal processing controller: Intel Corporation Celeron/Pentium Silver Processor Serial IO SPI Host Controller (rev 06)
00:1c.0 SD Host controller: Intel Corporation Celeron/Pentium Silver Processor SDA Standard Compliant SD Host Controller (rev 06)
00:1e.0 SD Host controller: Intel Corporation Device 31d0 (rev 06)
00:1f.0 ISA bridge: Intel Corporation Celeron/Pentium Silver Processor LPC Controller (rev 06)
00:1f.1 SMBus: Intel Corporation Celeron/Pentium Silver Processor Gaussian Mixture Model (rev 06)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

lsmod:

Module Size Used by
qrtr 49152 4
snd_sof_pci_intel_apl 16384 0
snd_sof_intel_hda_common 188416 1 snd_sof_pci_intel_apl
soundwire_intel 49152 1 snd_sof_intel_hda_common
soundwire_generic_allocation 16384 1 soundwire_intel
soundwire_cadence 40960 1 soundwire_intel
snd_sof_intel_hda 20480 1 snd_sof_intel_hda_common
snd_sof_pci 24576 2 snd_sof_intel_hda_common,snd_sof_pci_intel_apl
snd_sof_xtensa_dsp 16384 1 snd_sof_intel_hda_common
binfmt_misc 24576 1
snd_sof 278528 2 snd_sof_pci,snd_sof_intel_hda_common
snd_sof_utils 20480 1 snd_sof
x86_pkg_temp_thermal 20480 0
soundwire_bus 102400 3 soundwire_intel,soundwire_generic_allocation,soundwire_cadence
intel_powerclamp 20480 0
coretemp 20480 0
snd_soc_skl 184320 0
kvm_intel 376832 0
snd_soc_hdac_hda 24576 2 snd_sof_intel_hda_common,snd_soc_skl
nls_ascii 16384 1
snd_hda_ext_core 40960 3 snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_skl
btusb 69632 0
snd_hda_codec_hdmi 81920 1
btrtl 28672 1 btusb
nls_cp437 20480 1
snd_soc_sst_ipc 20480 1 snd_soc_skl
kvm 1146880 1 kvm_intel
btbcm 24576 1 btusb
iwlmvm 389120 0
snd_soc_sst_dsp 40960 1 snd_soc_skl
btintel 45056 1 btusb
vfat 24576 1
snd_soc_acpi_intel_match 81920 3 snd_sof_intel_hda_common,snd_soc_skl,snd_sof_pci_intel_apl
btmtk 16384 1 btusb
fat 90112 1 vfat
irqbypass 16384 1 kvm
snd_hda_codec_realtek 172032 1
snd_soc_acpi 16384 3 snd_soc_acpi_intel_match,snd_sof_intel_hda_common,snd_soc_skl
bluetooth 958464 6 btrtl,btmtk,btintel,btbcm,btusb
mac80211 1191936 1 iwlmvm
snd_hda_codec_generic 98304 1 snd_hda_codec_realtek
ghash_clmulni_intel 16384 0
snd_soc_core 352256 5 soundwire_intel,snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_skl
ledtrig_audio 16384 1 snd_hda_codec_generic
snd_compress 28672 1 snd_soc_core
sha256_ssse3 36864 0
sha1_ssse3 32768 0
snd_hda_intel 57344 3
libarc4 16384 1 mac80211
snd_intel_dspcfg 36864 4 snd_hda_intel,snd_sof,snd_sof_intel_hda_common,snd_soc_skl
snd_intel_sdw_acpi 20480 2 snd_sof_intel_hda_common,snd_intel_dspcfg
snd_hda_codec 188416 7 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek,snd_soc_hdac_hda,snd_soc_skl,snd_sof_intel_hda
jitterentropy_rng 16384 1
iwlwifi 360448 1 iwlmvm
snd_hda_core 122880 10 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_hda_codec_realtek,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_skl,snd_sof_intel_hda
snd_hwdep 16384 1 snd_hda_codec
sha512_ssse3 49152 1
snd_pcm 159744 11 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,soundwire_intel,snd_sof,snd_sof_intel_hda_common,snd_compress,snd_soc_core,snd_sof_utils,snd_soc_skl,snd_hda_core
aesni_intel 393216 0
sha512_generic 16384 1 sha512_ssse3
crypto_simd 16384 1 aesni_intel
mei_hdcp 24576 0
processor_thermal_device_pci_legacy 16384 0
ctr 16384 0
intel_rapl_msr 20480 0
snd_timer 45056 1 snd_pcm
processor_thermal_device 20480 1 processor_thermal_device_pci_legacy
drbg 45056 1
xr_serial 24576 0
processor_thermal_rfim 16384 1 processor_thermal_device
wdat_wdt 20480 0
cryptd 28672 2 crypto_simd,ghash_clmulni_intel
ansi_cprng 16384 0
processor_thermal_mbox 16384 2 processor_thermal_rfim,processor_thermal_device
processor_thermal_rapl 20480 1 processor_thermal_device
rapl 20480 0
cfg80211 1159168 3 iwlmvm,iwlwifi,mac80211
intel_cstate 20480 0
watchdog 45056 1 wdat_wdt
usbserial 65536 1 xr_serial
pcspkr 16384 0
rtsx_usb_ms 24576 0
mei_me 49152 1
intel_rapl_common 32768 2 intel_rapl_msr,processor_thermal_rapl
ecdh_generic 16384 1 bluetooth
snd 126976 17 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_sof,snd_timer,snd_compress,snd_soc_core,snd_pcm
int340x_thermal_zone 20480 1 processor_thermal_device
ecc 40960 1 ecdh_generic
memstick 24576 1 rtsx_usb_ms
int3400_thermal 20480 0
mei 159744 3 mei_hdcp,mei_me
cdc_acm 45056 0
soundcore 16384 1 snd
rfkill 36864 6 iwlmvm,bluetooth,cfg80211
intel_soc_dts_iosf 20480 1 processor_thermal_device_pci_legacy
goodix_ts 36864 0
ac 20480 0
soc_button_array 24576 0
acpi_thermal_rel 16384 1 int3400_thermal
intel_pmc_core 53248 0
intel_hid 28672 0
sparse_keymap 16384 1 intel_hid
evdev 28672 15
serio_raw 20480 0
parport_pc 40960 0
ppdev 24576 0
lp 20480 0
parport 73728 3 parport_pc,lp,ppdev
fuse 176128 3
loop 32768 0
efi_pstore 16384 0
configfs 57344 1
ip_tables 36864 0
x_tables 61440 1 ip_tables
autofs4 53248 2
ext4 991232 1
crc16 16384 2 bluetooth,ext4
mbcache 16384 1 ext4
jbd2 167936 1 ext4
raid10 65536 0
raid456 180224 0
async_raid6_recov 24576 1 raid456
async_memcpy 20480 2 raid456,async_raid6_recov
async_pq 20480 2 raid456,async_raid6_recov
async_xor 20480 3 async_pq,raid456,async_raid6_recov
async_tx 20480 5 async_pq,async_memcpy,async_xor,raid456,async_raid6_recov
xor 24576 1 async_xor
raid6_pq 122880 3 async_pq,raid456,async_raid6_recov
libcrc32c 16384 1 raid456
crc32c_generic 16384 0
raid1 53248 0
raid0 24576 0
multipath 20480 0
linear 20480 0
md_mod 192512 6 raid1,raid10,raid0,linear,raid456,multipath
dm_mirror 28672 0
dm_region_hash 24576 1 dm_mirror
dm_log 20480 2 dm_region_hash,dm_mirror
dm_mod 184320 2 dm_log,dm_mirror
rtsx_usb_sdmmc 32768 0
rtsx_usb 32768 2 rtsx_usb_sdmmc,rtsx_usb_ms
hid_generic 16384 0
usbhid 65536 0
i915 2936832 12
drm_buddy 20480 1 i915
i2c_algo_bit 16384 1 i915
drm_display_helper 184320 1 i915
cec 61440 2 drm_display_helper,i915
xhci_pci 24576 0
mmc_block 57344 4
ahci 49152 0
rc_core 69632 1 cec
xhci_hcd 319488 1 xhci_pci
spi_pxa2xx_platform 36864 0
libahci 49152 1 ahci
ttm 94208 1 i915
dw_dmac 16384 0
sdhci_pci 77824 0
dw_dmac_core 36864 1 dw_dmac
r8169 94208 0
cqhci 32768 1 sdhci_pci
crct10dif_pclmul 16384 0
crct10dif_common 16384 1 crct10dif_pclmul
intel_lpss_pci 28672 2
realtek 36864 1
drm_kms_helper 204800 2 drm_display_helper,i915
crc32_pclmul 16384 0
libata 405504 2 libahci,ahci
sdhci 81920 1 sdhci_pci
usbcore 348160 8 usbserial,xhci_hcd,usbhid,cdc_acm,rtsx_usb,btusb,xhci_pci,xr_serial
mdio_devres 16384 1 r8169
crc32c_intel 24576 3
i2c_i801 36864 0
i2c_hid_acpi 16384 0
intel_lpss 16384 1 intel_lpss_pci
mmc_core 212992 5 sdhci,rtsx_usb_sdmmc,cqhci,mmc_block,sdhci_pci
i2c_smbus 20480 1 i2c_i801
i2c_hid 32768 1 i2c_hid_acpi
libphy 180224 3 r8169,mdio_devres,realtek
drm 614400 12 drm_kms_helper,drm_display_helper,drm_buddy,i915,ttm
usb_common 16384 2 xhci_hcd,usbcore
scsi_mod 286720 1 libata
video 65536 1 i915
idma64 20480 0
scsi_common 16384 2 scsi_mod,libata
fan 20480 0
hid 159744 3 i2c_hid,usbhid,hid_generic
button 24576 0
wmi 36864 1 video

Also, there are two M.2 PCIe slots on the SBC and I disabled the one I am not using (E-keyed) from BIOS so there is no confusion. Result wasn't different than before disabling though. Here are also lspci -v only PCIe part:

00:13.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation Gemini Lake PCI Express Root Port
Flags: bus master, fast devsel, latency 0, IRQ 122, IOMMU group 6
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
I/O behind bridge: [disabled] [16-bit]
Memory behind bridge: [disabled] [32-bit]
Prefetchable memory behind bridge: [disabled] [64-bit]
Capabilities: <access denied>
Kernel driver in use: pcieport

00:14.0 PCI bridge: Intel Corporation Gemini Lake PCI Express Root Port (rev f6) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation Gemini Lake PCI Express Root Port
Flags: bus master, fast devsel, latency 0, IRQ 123, IOMMU group 7
Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
I/O behind bridge: e000-efff =4K% [16-bit]
Memory behind bridge: a1100000-a11fffff =1M% [32-bit]
Prefetchable memory behind bridge: [disabled] [64-bit]
Capabilities: <access denied>
Kernel driver in use: pcieport
Last edit: 02 Mar 2024 20:01 by arda. Reason: misplaced " symbol

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 20:14 - 02 Mar 2024 20:16 #294939 by Mecanix
Interesting (not really). See if it does anything more interesting if you throw in the driver. Not sure what 'few people mentioned the same errors on this forum' meant, but they lied to you. WCH's stuff always works....

$ sudo apt update
$ sudo apt install linux-headers-$(uname -r) build-essential git
$ git clone https://github.com/WCHSoftGroup/ch35_38x_linux.git
$ cd ch35_38x_linux/driver_main/
$ make
$ make install
$ sudo shutdown now

Last edit: 02 Mar 2024 20:16 by Mecanix.

Please Log in or Create an account to join the conversation.

More
02 Mar 2024 23:04 #294957 by arda
I encountered multiple issues while installing.

I was getting "Raspi-firmware: missing /boot/firmware, did you forget to mount it? error" then as suggested by someone "sudo dpkg --purge raspi-firmware" apparently fixed it.

Then while "make" stage I was getting "Skipping BTF generation xxx. due to unavailability of vmlinux" then as suggested by someone;

apt install dwarves
cp /sys/kernel/btf/vmlinux /usr/lib/modules/`uname -r`/build/

seemed to fix that issue, but now this issue is happening during "make" stage:

make -C /lib/modules/6.1.0-16-rt-amd64/build M=/home/ardacaner/drvyuk/ch35_38x_linux/driver_main modules
make[1]: Entering directory '/usr/src/linux-headers-6.1.0-16-rt-amd64'
CC [M] /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch_devtable.o
CC [M] /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch_serial.o
CC [M] /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch_main.o
LD [M] /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch.o
MODPOST /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/Module.symvers
CC [M] /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch.mod.o
LD [M] /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch.ko
BTF [M] /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch.ko
/bin/sh: 1: ./tools/bpf/resolve_btfids/resolve_btfids: not found
make[2]: *** [/usr/src/linux-headers-6.1.0-16-common-rt/scripts/Makefile.modfinal:63: /home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch.ko] Error 127
make[2]: *** Deleting file '/home/ardacaner/drvyuk/ch35_38x_linux/driver_main/wch.ko'
make[1]: *** [/usr/src/linux-headers-6.1.0-16-common-rt/Makefile:1954: modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-16-rt-amd64'
make: *** [Makefile:12: modules] Error 2

As I read threads about this btfids issue, the solution to that doesn't seem straightforward. I will keep looking into this later as it is getting very late here. Suggestions are appreciated as always. Thank you.

Please Log in or Create an account to join the conversation.

Time to create page: 0.224 seconds
Powered by Kunena Forum