cariboulabs / cariboulite

CaribouLite turns any 40-pin Raspberry-Pi into a Tx/Rx 6GHz SDR
1.06k stars 96 forks source link

first probe fails to initialize the device, second one makes it work #167

Open great9 opened 6 months ago

great9 commented 6 months ago

changed fifo to 2 in /etc/modprobe.d/smi_stream_mod_cariboulite.conf and ran modprobe smi_stream_dev

[2122501.219834] smi_stream_dev: loading out-of-tree module taints kernel.
[2122501.228047] smi-stream-dev: smi_stream_dev_probe (fifo_mtu_multiplier=2, addr_dir_offset=2, addr_ch_offset=3)
[2122501.228286] smi-stream-dev: creating a device and registering it with sysfs
[2122501.228747] smi-stream-dev soc:smi_dev: initialised

then ran

theuser@host:~/cariboulite$ sudo SoapySDRUtil -probe

######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Probe device 
[INFO] SoapyCaribouliteSession, sessionCount: 0
12-20 22:24:34.660 1081624 1081624 I FPGA caribou_fpga_program_to_fpga@caribou_fpga.c:209 FPGA already operational - not programming (use 'force_prog=true' to force update)
12-20 22:24:34.682 1081624 1081624 E CARIBOU_SMI caribou_smi_init@caribou_smi.c:537 couldn't open smi driver file '/dev/smi' (Cannot allocate memory)
12-20 22:24:34.682 1081624 1081624 E CARIBOULITE Setup cariboulite_init_submodules@cariboulite_setup.c:288 Error setting up smi submodule
12-20 22:24:34.684 1081624 1081624 I CARIBOU_PROG caribou_prog_release@caribou_prog.c:122 device release completed
12-20 22:24:34.685 1081624 1081624 E FPGA caribou_fpga_close@caribou_fpga.c:246 caribou_fpga_close: dev not initialized
[ERROR] cariboulite_init_driver() failed
Printing 'findCariboulite' Request:
[INFO] Initializing DeviceID: 0, Label: CaribouLite S1G[9e02dae0], ChannelType: S1G
soapy_sighandler caught SIGSEGV
[INFO] soapy_sighandler killing soapy_cariboulite (cariboulite_release_driver)
12-20 22:24:34.887 1081624 1081624 E FPGA caribou_fpga_close@caribou_fpga.c:246 caribou_fpga_close: dev not initialized
12-20 22:24:34.887 1081624 1081624 E CARIBOULITE Setup cariboulite_release_submodules@cariboulite_setup.c:465 FPGA communication release failed (-1)
12-20 22:24:34.887 1081624 1081624 E IO_UTILS_SPI io_utils_spi_close@io_utils_spi.c:340 closing uninitialized device
CaribouLite: Signal [11] received from pid=[968]
Signal [11] caught, with the following information: 
   signal errno = 0
   signal process pid = 968
   signal process uid = 0
   signal status = 0
   signal errno / SIGSEGV / the process access invalid region of memory
SIGSEGV: memory access violation

so I ran it again...

theuser@hot:~/cariboulite$ sudo SoapySDRUtil -probe
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Probe device 
[INFO] SoapyCaribouliteSession, sessionCount: 0
12-20 22:24:36.054 1081637 1081637 I FPGA caribou_fpga_program_to_fpga@caribou_fpga.c:209 FPGA already operational - not programming (use 'force_prog=true' to force update)
Printing 'findCariboulite' Request:
[INFO] Initializing DeviceID: 0, Label: CaribouLite S1G[9e02dae0], ChannelType: S1G
[INFO] Creating SampleQueue MTU: 131072 I/Q samples (524288 bytes)
[INFO] Entering Reader Thread

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=Cariboulite
  hardware=Cariboulite Rev2.8
  device_id=0
  fpga_revision=1
  hardware_revision=0x0001
  product_name=CaribouLite RPI Hat
  serial_number=1325493616
  vendor_name=CaribouLabs LTD

----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 1 Rx, 1 Tx
  Timestamps: NO

----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
  Full-duplex: NO
  Supports AGC: YES
  Stream formats: CS16, CS8, CF32, CF64
  Native format: CS16 [full-scale=4095]
  Antennas: TX/RX Sub1GHz
  Full gain range: [0, 69] dB
    Modem AGC gain range: [0, 69] dB
  Full freq range: [389.5, 510], [779, 1020] MHz
    RF freq range: [389.5, 510], [779, 1020] MHz
  Sample rates: 4, 2, 1.333, 1, 0.8, 0.666, 0.5, 0.4 MSps
  Filter bandwidths: 0.02, 0.05, 0.1, 0.2, 0.25, 1, 1.25, 1.5625, 2, 2.5 MHz
  Sensors: RSSI, ENERGY, PLL_LOCK_MODEM
     * RSSI (RX RSSI):[-127, 4] 0.000000
        Modem level RSSI measurment
     * ENERGY (RX ENERGY):[-127, 4] 0.000000
        Modem level ENERGY (EDC) measurment
     * PLL_LOCK_MODEM (PLL Lock Modem): 1.000000
        Modem PLL locking indication

----------------------------------------------------
-- TX Channel 0
----------------------------------------------------
  Full-duplex: NO
  Supports AGC: NO
  Stream formats: CS16, CS8, CF32, CF64
  Native format: CS16 [full-scale=4095]
  Antennas: TX/RX Sub1GHz
  Full gain range: [0, 31] dB
    Modem PA gain range: [0, 31] dB
  Full freq range: [389.5, 510], [779, 1020] MHz
    RF freq range: [389.5, 510], [779, 1020] MHz
  Sample rates: 4, 2, 1.333, 1, 0.8, 0.666, 0.5, 0.4 MSps
  Filter bandwidths: 0.08, 0.1, 0.125, 0.16, 0.2, 0.4, 0.5, 0.625, 0.8, 1 MHz
  Sensors: PLL_LOCK_MODEM
     * PLL_LOCK_MODEM (PLL Lock Modem): 1.000000
        Modem PLL locking indication

[INFO] Leaving Reader Thread
great9 commented 6 months ago

after that I wanted to test rtl_433 over tcp so I ran sudo SoapySDRServer --bind=192.168.0.1:1234 on the rpi3b

and ./rtl_433 -d "driver=remote,remote=tcp://192.168.0.1:1234,channel=HiF,device_id=1" on the client computer which spewed out this as rtl_433 was trying to listen actual RF.

reader thread failed to read SMI!
12-20 22:28:09.296 1082110 1082137 E CARIBOULITE Radio cariboulite_radio_read_samples@cariboulite_radio.c:1232 SMI reading operation failed

the dmesg was more interesting...

[2122507.922590] SoapySDRUtil: page allocation failure: order:8, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
[2122507.922648] CPU: 1 PID: 1081624 Comm: SoapySDRUtil Tainted: G         C OE     5.4.0-1098-raspi #110-Ubuntu
[2122507.922655] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
[2122507.922661] Call trace:
[2122507.922681]  dump_backtrace+0x0/0x1e0
[2122507.922691]  show_stack+0x28/0x38
[2122507.922704]  dump_stack+0xd8/0x134
[2122507.922718]  warn_alloc+0x110/0x180
[2122507.922730]  __alloc_pages_slowpath+0xbd4/0xc00
[2122507.922744]  __alloc_pages_nodemask+0x2b4/0x330
[2122507.922756]  kmalloc_order+0x34/0x80
[2122507.922768]  kmalloc_order_trace+0x40/0x120
[2122507.922781]  __kmalloc+0x358/0x398
[2122507.922793]  __kfifo_alloc+0x5c/0xa8
[2122507.922817]  smi_stream_open+0x5c/0x1e0 [smi_stream_dev]
[2122507.922831]  chrdev_open+0xac/0x1a8
[2122507.922844]  do_dentry_open+0x11c/0x390
[2122507.922856]  vfs_open+0x3c/0x48
[2122507.922871]  do_last+0x17c/0x8c8
[2122507.922880]  path_openat+0x88/0x260
[2122507.922890]  do_filp_open+0x88/0x110
[2122507.922902]  do_sys_open+0x188/0x2f0
[2122507.922913]  __arm64_sys_openat+0x30/0x40
[2122507.922924]  el0_svc_common.constprop.0+0x84/0x230
[2122507.922933]  el0_svc_handler+0x38/0xa0
[2122507.922944]  el0_svc+0x10/0x140
[2122507.922953] Mem-Info:
[2122507.922986] active_anon:4976 inactive_anon:25205 isolated_anon:0
                  active_file:61761 inactive_file:21284 isolated_file:22
                  unevictable:4205 dirty:1085 writeback:50 unstable:0
                  slab_reclaimable:12269 slab_unreclaimable:12362
                  mapped:11145 shmem:10366 pagetables:687 bounce:0
                  free:82682 free_pcp:403 free_cma:9454
[2122507.923078] Node 0 active_anon:19904kB inactive_anon:100820kB active_file:247044kB inactive_file:85136kB unevictable:16820kB isolated(anon):0kB isolated(file):236kB mapped:44580kB dirty:4340kB writeback:200kB shmem:41464kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
[2122507.923108] DMA free:330728kB min:22528kB low:28160kB high:33792kB active_anon:19804kB inactive_anon:100972kB active_file:247428kB inactive_file:84972kB unevictable:16820kB writepending:4340kB present:970752kB managed:927896kB mlocked:16820kB kernel_stack:3600kB pagetables:2748kB bounce:0kB free_pcp:1620kB local_pcp:12kB free_cma:37816kB
[2122507.923119] lowmem_reserve[]: 0 0 0 0
[2122507.923158] DMA: 23535*4kB (UMEC) 14770*8kB (UMEC) 3511*16kB (UMEC) 796*32kB (UMEC) 174*64kB (UMEC) 49*128kB (UEC) 42*256kB (C) 10*512kB (C) 4*1024kB (C) 0*2048kB 0*4096kB = 331324kB
[2122507.923295] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
[2122507.923310] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=32768kB
[2122507.923328] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
[2122507.923344] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=64kB
[2122507.923357] 95765 total pagecache pages
[2122507.923377] 803 pages in swap cache
[2122507.923391] Swap cache stats: add 44951, delete 44148, find 5881513/5886300
[2122507.923403] Free swap  = 2035452kB
[2122507.923415] Total swap = 2097148kB
[2122507.923427] 242688 pages RAM
[2122507.923438] 0 pages HighMem/MovableOnly
[2122507.923450] 10714 pages reserved
[2122507.923462] 16384 pages cma reserved
[2122507.923478] smi-stream-dev: error rx kfifo_alloc
[2122509.299886] smi-stream-dev soc:smi_dev: Enterred reader thread
[2122509.299892] smi-stream-dev soc:smi_dev: Enterred writer thread
[2122509.299923] smi-stream-dev soc:smi_dev: Reading SMI settings to user.
[2122509.299957] smi-stream-dev soc:smi_dev: Reading native buffer size information
[2122509.299982] smi-stream-dev soc:smi_dev: Setting user's SMI settings.
[2122509.300016] smi-stream-dev soc:smi_dev: Setting address direction indication offset to 2
[2122509.300037] smi-stream-dev soc:smi_dev: Setting address channel indication offset to 3
[2122509.513426] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 1, cur_addr = 4
[2122509.514965] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 0, cur_addr = 4
[2122509.518844] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 2, cur_addr = 12
[2122509.520294] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 0, cur_addr = 12
[2122509.733888] smi-stream-dev soc:smi_dev: smi_stream_release: closing device: 0
[2122509.744724] smi-stream-dev soc:smi_dev: Left reader thread
[2122509.744876] smi-stream-dev soc:smi_dev: Left writer thread
[2122707.223941] smi-stream-dev soc:smi_dev: Enterred reader thread
[2122707.223946] smi-stream-dev soc:smi_dev: Enterred writer thread
[2122707.223951] smi-stream-dev soc:smi_dev: Reading SMI settings to user.
[2122707.223984] smi-stream-dev soc:smi_dev: Reading native buffer size information
[2122707.224010] smi-stream-dev soc:smi_dev: Setting user's SMI settings.
[2122707.224042] smi-stream-dev soc:smi_dev: Setting address direction indication offset to 2
[2122707.224063] smi-stream-dev soc:smi_dev: Setting address channel indication offset to 3
[2122707.436333] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 1, cur_addr = 4
[2122707.437753] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 0, cur_addr = 4
[2122707.441638] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 2, cur_addr = 12
[2122707.443847] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 0, cur_addr = 12
[2122707.493667] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 2, cur_addr = 12
[2122725.644935] smi-stream-dev soc:smi_dev: Set STREAMING_STATUS = 0, cur_addr = 12
[2122725.855654] smi-bcm2835 3f600000.smi: smi_init_programmed_read returned -2
[2122725.856006] smi-stream-dev soc:smi_dev: stream_smi_user_dma returned illegal count = 0, buff_num = 0
[2122762.086713] smi-stream-dev soc:smi_dev: smi_stream_release: closing device: 0
[2122762.095376] smi-stream-dev soc:smi_dev: Left reader thread
[2122762.095531] smi-stream-dev soc:smi_dev: Left writer thread