No ttysWK device files

Type: Self-Compiled Firmware
SDK Package Name: ??
Modification Content: ??
Log: log.zip

Edit:

So we have two problems:
(1) my local bench assembles update.img without support of these sWK files - why? What should I do?
(2) I see nothing in the scope output when writing to any of these files with standard buildroot image running. Is device faulty?

More info:

I compiled this T-Firefly / rk3308-linux · GitLab (howver the source code was downloaded approximately a year ago) and I do not see RS485 device files in the list.

RS485_1: /dev/ttysWK0
RS485_2: /dev/ttysWK1
RS485_3: /dev/ttysWK2
RS232  : /dev/ttysWK3

How to identify which device file corresponds to each RS485 serial port?

/ # cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:unknown port:00000000 irq:0
1: uart:unknown port:00000000 irq:0
2: uart:unknown port:00000000 irq:0
3: uart:unknown port:00000000 irq:0
4: uart:unknown port:00000000 irq:0
/ # echo "aaa" > /dev/ttyS0
sh: write error: Input/output error
/ # echo "aaa" > /dev/ttyS1
sh: write error: Input/output error
/ # echo "aaa" > /dev/ttyS2
sh: write error: Input/output error
/ # echo "aaa" > /dev/ttyS3
sh: write error: Input/output error
/ # echo "aaa" > /dev/ttyS4
sh: write error: Input/output error

Executable file spi-wk2xxx has the following

 :con_wk2xxx_subport bad iobase %d
 1: bad iobase %d
 wk2xxx-%d %s cannot create workqueue
 wk2xxxspi cannot allocate irq %d
 ttySWK ttysWK 

but I do not see source for it.

/proc/tty # cat drivers
/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaster
rfcomm               /dev/rfcomm   216 0-255 serial
usbserial            /dev/ttyUSB   188 0-511 serial
serial               /dev/ttyS       4 64-68 serial
pty_slave            /dev/pts      136 0-1048575 pty:slave
pty_master           /dev/ptm      128 0-1048575 pty:master
unknown              /dev/tty        4 1-63 console
fiq-debugger         /dev/ttyFIQ   254       0 serial

Now I am comparing behavior of IHC3308GW-Buildroot-20211221.img (original) with mehavior of my compiled image:
original

[    1.120580] pwm-regulator vdd-core: lookup for GPIO enable failed
[    1.121418] Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
[    1.124688] [drm] Initialized drm 1.1.0 20060810
[    1.124846] random: nonblocking pool is initialized
[    1.127942] Unable to detect cache hierarchy for CPU 0
[    1.135358] loop: module loaded
[    1.135600] SCSI Media Changer driver v0.25
*******************************************
[    1.136809] rockchip-spi ff120000.spi: Failed to request TX DMA channel
[    1.136851] rockchip-spi ff120000.spi: Failed to request RX DMA channel
[    1.139473] 11wk2xxx_probe: setup mode 0, 8 bits/w, 10000000 Hz max
[    1.139557] of_get_named_gpiod_flags: parsed 'power-gpio' property of node '/spi@ff120000/spi_wk2xxx@00[0]' - status (0)
[    1.139629] of_get_named_gpiod_flags: parsed 'reset-gpio' property of node '/spi@ff120000/spi_wk2xxx@00[0]' - status (0)
[    1.309710] of_get_named_gpiod_flags: parsed 'irq-gpio' property of node '/spi@ff120000/spi_wk2xxx@00[0]' - status (0)
[    1.309760] of_get_named_gpiod_flags: parsed 'cs-gpio' property of node '/spi@ff120000/spi_wk2xxx@00[0]' - status (0)
[    1.309957] wk2xxx_serial_init()
[    1.309981] wk2xxx_request_port
[    1.310001] ttysWK0 at I/O 0x1 (irq = 87, base_baud = 460800) is a wk2xxx
[    1.310404] uart_add_one_port success for line i:= 0 with right 0
[    1.310429] wk2xxx_request_port
[    1.310445] ttysWK1 at I/O 0x2 (irq = 87, base_baud = 460800) is a wk2xxx
[    1.310733] uart_add_one_port success for line i:= 1 with right 0
[    1.310754] wk2xxx_request_port
[    1.310770] ttysWK2 at I/O 0x3 (irq = 87, base_baud = 460800) is a wk2xxx
[    1.311037] uart_add_one_port success for line i:= 2 with right 0
[    1.311060] wk2xxx_request_port
[    1.311076] ttysWK3 at I/O 0x4 (irq = 87, base_baud = 460800) is a wk2xxx
[    1.311392] uart_add_one_port success for line i:= 3 with right 0
[    1.311412] uart_add_one_port = 0x0
*******************************************
[    1.311468] register spi return v = :0
[    1.311538] lora1276 register spi return v = :0
[    1.311585] CAN device driver interface
[    1.324486] rk_gmac-dwmac ff4e0000.ethernet: clock input or output? (input).
[    1.324542] rk_gmac-dwmac ff4e0000.ethernet: Can not read property: tx_delay.
[    1.324561] rk_gmac-dwmac ff4e0000.ethernet: set tx_delay to 0x30
[    1.324577] rk_gmac-dwmac ff4e0000.ethernet: Can not read property: rx_delay.
[    1.324594] rk_gmac-dwmac ff4e0000.ethernet: set rx_delay to 0x10
[    1.324619] rk_gmac-dwmac ff4e0000.ethernet: integrated PHY? (no).
[    1.324896] rk_gmac-dwmac ff4e0000.ethernet: clock input from PHY
[    1.329934] rk_gmac-dwmac ff4e0000.ethernet: init for RMII
[    1.330088] stmmac - user ID: 0x10, Synopsys ID: 0x35

my:

[    1.115818] pwm-regulator vdd-core: lookup for GPIO enable failed
[    1.116614] Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
[    1.119964] [drm] Initialized drm 1.1.0 20060810
[    1.120073] random: nonblocking pool is initialized
[    1.122757] Unable to detect cache hierarchy for CPU 0
[    1.130107] loop: module loaded
[    1.130362] SCSI Media Changer driver v0.25
*******************************************
[    1.131067] register spi return v = :0
[    1.131143] lora1276 register spi return v = :0
[    1.131196] CAN device driver interface

original

/ # find . | grep wk2xxx
./sys/bus/spi/drivers/wk2xxxspi
./sys/bus/spi/drivers/wk2xxxspi/bind
./sys/bus/spi/drivers/wk2xxxspi/spi0.0
./sys/bus/spi/drivers/wk2xxxspi/uevent
./sys/bus/spi/drivers/wk2xxxspi/unbind
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/reg
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/name
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/cs-gpio
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/power-gpio
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/compatible
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/spi-max-frequency
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/irq-gpio
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/reset-gpio
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/status
./sys/firmware/devicetree/base/spi@ff120000/spi_wk2xxx@00/phandle
./sys/firmware/devicetree/base/__symbols__/spi_wk2xxx

my

/ # find . | grep wk2xxx
find: ./proc/880: No such file or directory
./sys/bus/spi/drivers/wk2xxxspi
./sys/bus/spi/drivers/wk2xxxspi/bind
./sys/bus/spi/drivers/wk2xxxspi/uevent
./sys/bus/spi/drivers/wk2xxxspi/unbind

Therefore device driver is present in my build, but it totally refuses to see the hardware.

Before this driver initialization in the kernel log, there’s something else missing in my build:

[    0.455758] of_get_named_gpiod_flags: parsed 'gpio' property of node '/vcc3v3-4g-power-regulator[0]' - status (0)
[    0.456329] of_get_named_gpiod_flags: parsed 'gpio' property of node '/vcc3v3-4g-reset-regulator[0]' - status (0)

tchip_askquestions
log.zip (155 Bytes)

So the device you’re using is iHC-3308GW?

Firefly Posted at 7/8/2023 09:36
So the device you’re using is iHC-3308GW?

Yes, and I have built clear firmware using https://gitlab.com/TeeFirefly/rk3308-linux, and sWK files do not appear. I am now following instruction at here https://wiki.t-firefly.com/en/Core-3308Y/linux_compile.html. This instruction has several issues:

  1. the following code assumes files were extracted in order 0 1 2 3 …
cat path/to/rk3308_linux_release_v1.5.0a_20221212_split_dir/*firefly_split* | tar -xzv

If they are not, execution fails.
2. The following must be performed within rk* directory, but there’s no cd command in the instruction

.repo/repo/repo sync -l

Update: confirmed that compiling from this distribution with application of those instructions produce working image with sWK* files.
Now second issue remains: why

echo "aaa" > /dev/ttyswK0

does not produce any waveform in the rs485_1 port.

Please send me log.

cat /proc/version

The kernel I compiled using this configuration file is no problem. Do you have ttysWk with buildroot now?

ll device/rockchip/.BoardConfig.mk
device/rockchip/.BoardConfig.mk -> rk3308/ihc-3308gw-ubuntu.mk

Yes, I have these device files now.

But I have another problem.

./build.sh script does not compile and include my application. “make menuconfig” does not work from the project root, it works from buildroot/, and I compile my package using make in buildroot/, but ./build.sh anyway does not include the package.
I have put my package into buildroot/package/, and into external/ with no difference.

How to properly install the custom package into the compilation of your buildroot image?
Edit: found instructions here https://wiki.t-firefly.com/en/Firefly-Linux-Guide/manual_buildroot.html in 11.2.

The ./build.sh script will use this firefly_rk3308_release config, so your “make menuconfig” is invalid, you can modify firefly_rk3308_release config or “make menuconfig”, and compile manually under buildroot.

Linux/3308/device/rockchip/rk3308$ cat BoardConfig_RK3308B_firefly.mk | grep RK_CFG_BUILDROOT
export RK_CFG_BUILDROOT=firefly_rk3308_release