Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
paulh002 committed Apr 17, 2022
1 parent feab044 commit 0c57c9f
Show file tree
Hide file tree
Showing 10 changed files with 975 additions and 0 deletions.
18 changes: 18 additions & 0 deletions driver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
KERNEL_HEADERS=/lib/modules/$(shell uname -r)/build

obj-m := radioberry.o

radioberry.ko:
@$(MAKE) -C $(KERNEL_HEADERS) M=$(PWD) modules

clean:
@$(MAKE) -C $(KERNEL_HEADERS) M=$(PWD) clean

install: radioberry.ko
cp radioberry_ioctl.h /usr/local/include
sudo insmod radioberry.ko
sudo chmod 666 /dev/radioberry

uninstall:
sudo rmmod radioberry.ko

141 changes: 141 additions & 0 deletions driver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
## Radioberry Device Driver


This device driver is a special for the RPI-4.

I have learned that making a device driver on your local rpi is something
different than deploying on the different rpi's running different kernel versions.

This means, for now, that you need to build the driver yourself. Which is not that complex.


Build step:

First get the linux headers:

sudo apt-get install raspberrypi-kernel-headers

Second you need to start the build process:

use in a command window, in the folder driver (which contains the Makefile) : make

This will results in a radioberry.ko file.



Hereby a step by step setup:


Step -1-

CL025 FPGA Radioberry users:
Copy the gateware radioberry.rbf into the folder /lib/firmware

CL016 FPGA Radioberry users:
Rename your radioberry-10CL016.rbf gateware to radioberry.rbf
Copy the gateware radioberry.rbf into the folder /lib/firmware

Loading the device driver will also load the gateware (content of the rbf file) into the FPGA



Step -2-

Make a module folder in the driver area of your running kernel, and install the driver called radioberry.ko in this folder.

cd /lib/modules/$(uname -r)/kernel/drivers

sudo mkdir sdr

copy the radioberry.ko to /lib/modules/$(uname -r)/kernel/drivers/sdr



Step -3-

run the command: sudo depmod

Check: use the command: modinfo radioberry
Gives you detailed info about the radioberry device driver.



Step -4-

load the device driver

run the command: sudo modprobe radioberry

In the folder /dev the radioberry must be present using the ls command.
Also possible to check by the command: lsmod |grep radioberry


Step -5-

Optional step.

Execute: dtc -@ -I dts -O dtb -o radioberry.dtbo radioberry.dts

This results in an overlay fiel radioberry.dtbo

cp this radioberry.dtbo into /boot/overlays

add the following line in config.txt:

dtoverlay=radioberry

This loads the kernel module during boot.


Alternative step:

If you like to load the device driver during boot, execute the following:

/etc/modules-load.d/modules.conf

add the device driver in this file, see content example:

\# /etc/modules: kernel modules to load at boot time.

\#

\# This file contains the names of kernel modules that should be loaded

\# at boot time, one per line. Lines beginning with "#" are ignored.

i2c-dev

snd-mixer-oss

snd-pcm-oss

radioberry



Step -6-

Optional step.

sudo chmod 666 /dev/radioberry

Makes it possible to run the radioberry firmware version for the device driver, running as the logged in user:



Step -7-

Run using the command ./radioberry firmware or sudo ./radioberry



Step -8-
Start a SDR program!


Have fun listening to your Radioberry using the radioberry device driver.

73 Johan
PA3GSB


5 changes: 5 additions & 0 deletions driver/driver.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
unloading kernel driver: sudo modprobe -r radioberry
loading kernel driver: sudo modprobe radioberry (during start the gateware is loaded)
sudo chmod
show driver messages
dmesg -wH &
Loading

0 comments on commit 0c57c9f

Please sign in to comment.