preamp board support and new release strategy

pull/10/head
pa3gsb 2021-02-15 18:20:41 +01:00
rodzic c969108f80
commit 16c7d22503
23 zmienionych plików z 825 dodań i 23 usunięć

Wyświetl plik

@ -60,6 +60,8 @@ sudo cp radioberry.ko /lib/modules/$(uname -r)/kernel/drivers/sdr
#include "radioberry_gateware.h"
#include "radioberry_firmware.h"
#define VERSION "0.9"
static DEFINE_MUTEX(radioberry_mutex);
static wait_queue_head_t rx_sample_queue;
@ -200,6 +202,9 @@ static long radioberry_ioctl(struct file *fp, unsigned int cmd, unsigned long ar
rb_info_ret.major = data[4];
rb_info_ret.minor = data[5];
rb_info_ret.fpga = data[3] & 0x03;
rb_info_ret.version = 0.9;
if (copy_to_user((struct rb_info_arg_t *)arg, &rb_info_ret, sizeof(struct rb_info_arg_t))) return -EACCES;
break;
@ -352,4 +357,4 @@ MODULE_AUTHOR("Johan Maas - pa3gsb@gmail.com");
MODULE_DESCRIPTION("Radioberry SDR device driver. (rpi-4)");
MODULE_SUPPORTED_DEVICE("Radioberry SDR");
MODULE_LICENSE("GPL");
MODULE_VERSION("0.8");
MODULE_VERSION(VERSION);

Wyświetl plik

@ -12,6 +12,10 @@ struct rb_info_arg_t
{
int major, minor;
int fpga;
float version;
int rb_command;
int command;
int command_data;

Wyświetl plik

@ -10,16 +10,22 @@ COMPILE=$(CC) $(OPTIONS) $(INCLUDES)
PROGRAM=radioberry
SOURCES= \
measure.c \
bias.c \
register.c \
radioberry.c
HEADERS= \
measure.h \
bias.h \
radioberry.h \
radioberry_ioctl.h \
register.h
OBJS= \
register.o \
bias.o \
measure.o \
radioberry.o
all: prebuild $(PROGRAM) $(HEADERS) $(SOURCES)

Wyświetl plik

@ -0,0 +1,34 @@
#include "bias.h"
void init_I2C_bias() {
fd_i2c_bias = open("/dev/i2c-1", O_RDWR);
if (fd_i2c_bias < 0 ) {
fprintf(stderr, "Your SBC device is missing the following driver: '/dev/i2c-1' \n");
fprintf(stderr, "Change of Bias Setting is not possible\n");
return fd_i2c_bias;
}
i2c_bias_handler = ioctl(fd_i2c_bias, I2C_SLAVE, ADDR_BIAS);
if (i2c_bias_handler < 0) close(i2c_bias_handler);
}
void write_I2C_bias(uint8_t control, uint8_t data) {
uint8_t bias_data[2];
bias_data[0] = control;
bias_data[1] = data;
int result = write(fd_i2c_bias, bias_data, 2);
if (result == 2) fprintf(stderr, "Write I2C Bias command %02X value= %02X \n", control, bias_data[1]);
else fprintf(stderr, "Write I2C Bias command failed \n");
}
void close_I2C_bias() {
if (fd_i2c_bias != NULL) close(fd_i2c_bias);
}
//end of source

Wyświetl plik

@ -0,0 +1,39 @@
#ifndef __RADIOBERRY_BIAS_H__
#define __RADIOBERRY_BIAS_H__
/**
MCP4662 Dual digital potentiometer.
This device is used to set both bias settings for the Radioberry preAmp.
The setting can be made permanent (non volatile) by saving the bias values in the EEPROM of the device.
The bias is a specific setting stored and determined specific per preAmp board.
The setting can be done by QUISK or SparkSDR using the extended Protocol-1 for Hermes Lite
https://github.com/softerhardware/Hermes-Lite2/wiki/Protocol
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#define ADDR_BIAS 0x2C
int fd_i2c_bias;
int i2c_bias_handler;
void openI2C_bias(void);
void write_I2C_bias(uint8_t control, uint8_t data);
void close_I2C_bias(void);
#endif

Wyświetl plik

@ -0,0 +1,46 @@
#include "measure.h"
int config_I2C_measure(){
uint8_t measure_config[1];
measure_config[0] = 0x07;
int result = write(fd_i2c_measure, measure_config, 1);
if (result == 1) fprintf(stderr, "Write Config to MAX11613 a 4 Channel ADC\n");
else fprintf(stderr, "Radioberry amplifier config failed; only a problem if amplifier is installed. \n");
return result;
};
void openI2C_measure() {
i2c_measure_module_active = 0;
fd_i2c_measure = open("/dev/i2c-1", O_RDWR);
if (fd_i2c_measure < 0 ) {
fprintf(stderr, "Your SBC device is missing the following driver: '/dev/i2c-1' \n");
fprintf(stderr, "Measurement is not possible\n");
return fd_i2c_measure;
}
i2c_measure_handler = ioctl(fd_i2c_measure, I2C_SLAVE, ADDR_MEAS);
if (i2c_measure_handler >=0) if (config_I2C_measure()==1) i2c_measure_module_active = 1; else close(i2c_measure_handler);
};
void read_I2C_measure(int *current, int *temperature){
uint8_t measure_data[8] ={0};
int result = read(fd_i2c_measure, measure_data, 8);
*temperature = (int)(((measure_data[2] & 0x0F) <<8) | measure_data[3]);
*current = (int)(((measure_data[4] & 0x0F) <<8) | measure_data[5]);
};
void close_I2C_measure() {
if (fd_i2c_measure != NULL) close(fd_i2c_measure);
};
//end of source

Wyświetl plik

@ -0,0 +1,39 @@
#ifndef __RADIOBERRY_MEASURE_H__
#define __RADIOBERRY_MEASURE_H__
/**
MAX11613 4 channel ADC.
For the radioberry preAmp this devices does measure the following analog signals:
- Current of the radioberry preamp fets.
- Temperature of the radioberry preamp fets.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#define ADDR_MEAS 0x34
int i2c_measure_module_active;
int fd_i2c_measure;
int i2c_measure_handler;
void openI2C_measure(void);
void read_I2C_measure(int *current, int *temperature);
void close_I2C_measure(void);
#endif

Wyświetl plik

@ -56,6 +56,8 @@ For more information, please refer to <http://unlicense.org/>
#include "radioberry.h"
#include "filters.h"
#include "register.h"
#include "bias.h"
#include "measure.h"
int main(int argc, char **argv)
{
@ -74,6 +76,7 @@ int initRadioberry() {
sem_init(&tx_empty, 0, TX_MAX);
sem_init(&tx_full, 0, 0);
sem_init(&spi_msg, 0, 0);
sem_init(&i2c_meas, 0, 0);
gettimeofday(&t20, 0);
@ -93,23 +96,27 @@ int initRadioberry() {
}
gateware_major_version = rb_info.major;
gateware_minor_version = rb_info.minor;
fprintf(stderr, "Radioberry gateware version %d-%d.\n", rb_info.major, rb_info.minor);
fprintf(stderr, "Radioberry firmware initialisation succesfully executed.\n");
gateware_fpga_type = rb_info.fpga;
driver_version = rb_info.version;
//***********************************************
// Filters switching initialization
//***********************************************
initFilters();
//***********************************************
init_I2C_bias();
openI2C_measure();
pthread_t pid1, pid2;
pthread_create(&pid1, NULL, packetreader, NULL);
pthread_create(&pid2, NULL, txWriter, NULL);
start_rb_control_thread();
start_rb_measure_thread();
/* create a UDP socket */
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
@ -166,19 +173,15 @@ int initRadioberry() {
int flags = fcntl(sock_TCP_Server, F_GETFL, 0);
fcntl(sock_TCP_Server, F_SETFL, flags | O_NONBLOCK);
// the service waits till the network is active... but i need a sleep!
sleep(20);
sprintf(gatewareversion,"%d.%d", rb_info.major, rb_info.minor);
sprintf(firmwareversion,"%s", FIRMWAREVERSION);
sprintf(driverversion,"%s", "-"); //TODO
sprintf(fpgatype,"%s", "-"); //TODO
registerRadioberry();
start_rb_register_thread();
}
int closeRadioberry() {
if (fd_rb != 0) close(fd_rb);
if (sock_TCP_Client >= 0) close(sock_TCP_Client);
if (sock_TCP_Server >= 0) close(sock_TCP_Server);
close_I2C_bias();
close_I2C_measure();
return 0;
}
@ -301,6 +304,12 @@ void handlePacket(char* buffer){
void handleCommand(int base_index, char* buffer) {
command = buffer[base_index];
command_data=((buffer[base_index+1]&0xFF)<<24)+((buffer[base_index+2]&0xFF)<<16)+((buffer[base_index+3]&0xFF)<<8)+(buffer[base_index+4]&0xFF);
// switch off the attached power amplifier if the current and temp could not be measured.
if (((command >> 1)&0x09) == 0x09 ) if (!i2c_measure_module_active) command_data = command_data & 0xFFF7FFFF;
// pa bias setting
if (((command >> 1)&0x3D) == 0x3D) write_I2C_bias(((command_data>>8)&0xFF), command_data & 0xFF);
if (commands[command] != command_data) {
commands[command] = command_data;
@ -372,6 +381,7 @@ void read_temperature_raspberryPi() {
systemp = millideg / 1000;
//fprintf(stderr, "CPU temperature is %f degrees C\n",systemp);
sys_temp = (int) (4096/3.26) * ((systemp/ 100) + 0.5);
//fprintf(stderr, "CPU temperature in protocol has value %x\n",sys_temp);
fclose(thermal);
}
@ -407,11 +417,25 @@ void fillPacketToSend() {
}
}
// inform the SDR about the radioberry control status.
// https://github.com/softerhardware/Hermes-Lite2/wiki/Protocol
hpsdrdata[11 + coarse_pointer] = 0x08 | (rb_control & 0x07);
if ( last_sequence_number % 500 == 0) read_temperature_raspberryPi();
hpsdrdata[12 + coarse_pointer] = ((sys_temp >> 8) & 0xFF);
hpsdrdata[13 + coarse_pointer] = (sys_temp & 0xFF);
// https://github.com/softerhardware/Hermes-Lite2/wiki/Protocol
if ( !i2c_measure_module_active & last_sequence_number % 500 == 0) read_temperature_raspberryPi();
if ( last_sequence_number % 2 == 0) {
// if i2c_measure_module_active; the temperature of module is used, otherwise the RPI temp.
hpsdrdata[11 + coarse_pointer] = 0x08 | (rb_control & 0x07);
if (i2c_measure_module_active) {
hpsdrdata[12 + coarse_pointer] = ((pa_temp >> 8) & 0xFF);
hpsdrdata[13 + coarse_pointer] = (pa_temp & 0xFF);
} else {
hpsdrdata[12 + coarse_pointer] = ((sys_temp >> 8) & 0xFF);
hpsdrdata[13 + coarse_pointer] = (sys_temp & 0xFF);
}
} else {
hpsdrdata[11 + coarse_pointer] = 0x10 | (rb_control & 0x07);
hpsdrdata[14 + coarse_pointer] = ((pa_current >> 8) & 0xFF);
hpsdrdata[15 + coarse_pointer] = (pa_current & 0xFF);
}
}
}
@ -420,7 +444,10 @@ void send_control(unsigned char command) {
unsigned char data[6];
uint32_t command_data = commands[command];
rb_info.rb_command = (((CWX << 1) & 0x02) | (running & 0x01));
// if temperature could not be measured the pa is disabled
rb_info.rb_command = ( (pa_temp_ok ? 0x04 : 0x00) | ((CWX << 1) & 0x02) | (running & 0x01) );
rb_info.command = command;
rb_info.command_data = command_data;
@ -447,10 +474,53 @@ void start_rb_control_thread() {
pthread_create(&pid1, NULL, rb_control_thread, NULL);
}
static void *rb_measure_thread(void *arg) {
// temperature == (((T*.01)+.5)/3.26)*4096 if pa temperature > 50C (=1256) switch pa off! (pa_temp_ok)
int measured_temp_ok_count = 0;
while(1) {
sem_wait(&i2c_meas);
if (i2c_measure_module_active) read_I2C_measure(&pa_current, &pa_temp);
if (pa_temp_ok && (pa_temp >= 1256)) {
fprintf(stderr, "ALERT: temperature of PA is higher than 50ºC; PA will be switched off! \n");
pa_temp_ok = 0;
}
// PA recovery after high temperature; switch PA on again if PA temp is in range for 10 seconds.
if (!pa_temp_ok && (pa_temp < 1256)) measured_temp_ok_count++;
if (measured_temp_ok_count == 100) {
measured_temp_ok_count = 0;
pa_temp_ok = 1;
fprintf(stderr, "PA temperature is ok; PA can be used! \n");
}
}
fprintf(stderr,"rb_measure_thread: exiting\n");
return NULL;
}
void start_rb_measure_thread() {
pthread_t pid1;
pthread_create(&pid1, NULL, rb_measure_thread, NULL);
}
static void *rb_register_thread(void *arg) {
sleep(60);
sprintf(gatewareversion,"%d.%d", gateware_major_version, gateware_minor_version);
sprintf(firmwareversion,"%s", FIRMWAREVERSION);
sprintf(driverversion,"%.1f", driver_version);
gateware_fpga_type == 0 ? sprintf(fpgatype,"%s", "-") : gateware_fpga_type == 1 ? sprintf(fpgatype,"%s", "CL016") : sprintf(fpgatype,"%s", "CL025");
registerRadioberry();
return NULL;
}
void start_rb_register_thread() {
pthread_t pid1;
pthread_create(&pid1, NULL, rb_register_thread, NULL);
}
static void *timer_thread(void *arg) {
while(1) {
usleep(100000);
if (running) sem_post(&spi_msg);
if (running) sem_post(&i2c_meas);
}
fprintf(stderr,"timer_thread: exiting\n");
return NULL;

Wyświetl plik

@ -25,7 +25,9 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
#define FIRMWAREVERSION "2021.01.17"
//#define FIRMWAREVERSION "2021.01.29"
#define FIRMWAREVERSION "development"
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
@ -42,7 +44,11 @@ void printIntroScreen() {
fprintf(stderr, "====================================================================\n");
}
int sys_temp = 0;
int sys_temp = 0; //rpi-temperature.
int pa_temp = 0;
int pa_current = 0;
int pa_temp_ok = 1;
//ringbuffer for handling SPI commands.
#define CAPACITY 64
@ -105,6 +111,8 @@ int use_tx = 0;
int gateware_major_version = 0;
int gateware_minor_version = 0;
int gateware_fpga_type = 0;
float driver_version = 0.0;
char CWX = 0;
char MOX = 0;
@ -113,6 +121,7 @@ sem_t tx_empty;
sem_t tx_full;
sem_t mutex;
sem_t spi_msg;
sem_t i2c_meas;
int tx_count =0;
void rx_reader(unsigned char iqdata[]);
@ -128,12 +137,10 @@ int lnrx = 1;
#define SYNC 0x7F
uint32_t last_sequence_number = 0;
uint32_t last_seqnum=0xffffffff, seqnum;
#define FIRMWARE_VERSION 0x45
unsigned char hpsdrdata[1032];
uint8_t header_hpsdrdata[4] = { 0xef, 0xfe, 1, 6 };
uint8_t sync_hpsdrdata[8] = { SYNC, SYNC, SYNC, 0, 0, 0, 0, FIRMWARE_VERSION};
uint8_t sync_hpsdrdata[8] = { SYNC, SYNC, SYNC, 0, 0, 0, 0, 0};
unsigned char broadcastReply[60];
#define TIMEOUT_MS 100

Wyświetl plik

@ -12,6 +12,10 @@ struct rb_info_arg_t
{
int major, minor;
int fpga;
float version;
int rb_command;
int command;
int command_data;

Wyświetl plik

@ -138,6 +138,7 @@ void registerRadioberry() {
if (!getMacAddress()) return;
loadRadioberryProps();
postRadioberryConfiguration();
fprintf(stderr, "Your Radioberry is registered: http://www.pa3gsb.nl/radioberry/api/read.php\n");
}
//end of source

Wyświetl plik

@ -29,13 +29,14 @@ char driverversion[16];
char firmwareversion[16];
char fpgatype[16];
int getMacAddress(void);
void loadProperties(char* filename);
char* getProperty(char* name);
void loadRadioberryProps(void);
ssize_t process_http(int sockfd, char *host, char *page, char *poststr);
void postRadioberryConfiguration(void);
extern void registerRadioberry(void);
#endif

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,22 @@
## Radioberry software installation script
This is a developement release of versions of the Radioberry sofware.
Initialy it was a script where you could select the individual software components.
Nowadays people have to choose too much...hi, the whole software stack will be installed.
https://github.com/pa3gsb/Radioberry-2.x/wiki/Radioberry-Software-stack
This avoids possible problems by selecting the wrong set of software components.
Installation is easy:
Open a command window and executing the following commands:
cd /tmp
wget https://raw.githubusercontent.com/pa3gsb/Radioberry-2.x/master/SBC/rpi-4/releases/dev/radioberry_install.sh
sudo chmod +x radioberry_install.sh
./radioberry_install.sh

Wyświetl plik

@ -0,0 +1,143 @@
#!/bin/bash
echo ""
echo ""
echo "============================================"
echo "Radioberry software installation."
echo ""
echo "You will install the following versions: "
echo ""
echo " Gateware version 73.0"
echo " Driver version 0.9"
echo " Firmware version 2021.02.15"
echo "============================================"
echo ""
echo ""
fpgatype=2; #default
while true; do
read -p "Install CL016 or CL025 radioberry version: 1 = CL016 or 2 = CL025? " type
case $type in
[1]* ) fpgatype=1; break;;
[2]* ) fpgatype=2; break;;
* ) echo "Please answer 1 or 2 for the FPGA used in your radioberry.";
esac
done
function install_dependency {
echo "--- Installing dependency: $1"
sudo apt-get -y install $1
}
install_dependency raspberrypi-kernel-headers
install_dependency git
install_dependency device-tree-compiler
install_dependency pigpio
git clone --depth=1 https://github.com/pa3gsb/Radioberry-2.x
sudo systemctl stop radioberry
sudo systemctl disable radioberry
#-----------------------------------------------------------------------------
if [[ $fpgatype == 1 ]]; then
echo "Installing Radioberry gateware Cyclone 10 CL016..."
cd Radioberry-2.x/SBC/rpi-4/releases/stable/CL016
sudo cp ./radioberry.rbf /lib/firmware
cd ../../../../../..
echo ""
echo "Radioberry gateware Cyclone 10 CL016 installed."
fi
if [[ $fpgatype == 2 ]]; then
echo "Installing Radioberry gateware Cyclone 10 CL025..."
cd Radioberry-2.x/SBC/rpi-4/releases/stable/CL025
sudo cp ./radioberry.rbf /lib/firmware
cd ../../../../../..
echo ""
echo "Radioberry gateware Cyclone 10 CL025 installed."
fi
#-----------------------------------------------------------------------------
echo "Installing Radioberry driver..."
#unregister radioberry driver
sudo modprobe -r radioberry
if [ ! -d "/lib/modules/$(uname -r)/kernel/drivers/sdr" ]; then
sudo mkdir /lib/modules/$(uname -r)/kernel/drivers/sdr
fi
cd Radioberry-2.x/SBC/rpi-4/device_driver/driver
make
sudo cp radioberry.ko /lib/modules/$(uname -r)/kernel/drivers/sdr
sudo dtc -@ -I dts -O dtb -o radioberry.dtbo radioberry.dts
sudo cp radioberry.dtbo /boot/overlays
#add driver to config.txt
sudo grep -Fxq "dtoverlay=radioberry" /boot/config.txt || sudo sed -i '$ a dtoverlay=radioberry' /boot/config.txt
cd ../../../../..
sudo depmod
#register radioberry driver
sudo modprobe radioberry
sudo chmod 666 /dev/radioberry
#show radioberry driver info.
sudo modinfo radioberry
echo ""
echo "Radioberry driver installed."
#-----------------------------------------------------------------------------
echo "Installing Radioberry firmware..."
cd Radioberry-2.x/SBC/rpi-4/device_driver/firmware
sudo make
sudo cp radioberry /usr/local/bin
sudo chmod +x /usr/local/bin/radioberry
cd ../../../../..
echo ""
echo "Radioberry firmware installed."
#-----------------------------------------------------------------------------
echo "Installing radioberry service ..."
cd Radioberry-2.x/SBC/rpi-4/device_driver/systemd
sudo cp radioberry.service /etc/systemd/system/radioberry.service
sudo cp radioberryd /etc/init.d/radioberryd
sudo chmod +x /etc/init.d/radioberryd
cd ../../../../..
echo "Radioberry service installed."
#-----------------------------------------------------------------------------
rm -rf Radioberry-2.x
sudo systemctl start radioberry
echo ""
echo ""
echo "============================================"
echo "Radioberry software is installed!"
echo "Have fun using the SDR Radioberry"
echo ""
echo "73 Johan PA3GSB"
echo "============================================"
echo ""
echo ""

Wyświetl plik

@ -0,0 +1,23 @@
## pihpsdr software installation script
This is a stable release of versions of the Radioberry sofware.
Initialy it was a script where you could select the individual software components.
Nowadays people have to choose too much...hi, the whole software stack will be installed.
https://github.com/pa3gsb/Radioberry-2.x/wiki/Radioberry-Software-stack
This avoids possible problems by selecting the wrong set of software components.
Installation is easy:
Open a command window and executing the following commands:
cd /tmp
wget https://raw.githubusercontent.com/pa3gsb/Radioberry-2.x/master/SBC/rpi-4/releases/pihpsdr/pihpsdr_install.sh
sudo chmod +x pihpsdr_install.sh
./pihpsdr_install.sh

Wyświetl plik

@ -0,0 +1,106 @@
#!/bin/bash
echo "Installation wdsp or pihpsdr"
echo ""
echo "What do you like to install [wdsp/pihpsdr/reboot] ?"
read input
if [[ $input == "wdsp" ]]; then
echo ""
echo "Installing WDSP library..."
function install_dependency {
echo "--- Installing dependency: $1"
sudo apt-get -y install $1
}
install_dependency git
install_dependency libfftw3-dev
cd /tmp
git clone --depth=1 https://github.com/g0orx/wdsp
cd wdsp
make -j 4
sudo make install
cd ..
rm -rf wdsp
cd ~
echo ""
echo "WDSP installed."
elif [[ $input == "pihpsdr" ]]; then
echo ""
echo "Installing pihpsdr..."
echo ""
echo ""
localcw=0;
while true; do
read -p "Do you wish to install the local CW option: yes or no?" yn
case $yn in
[Yy]* ) localcw=1; break;;
[Nn]* ) break;;
* ) echo "Please answer yes (Y or y) or no (N or n).";;
esac
done
function install_dependency {
echo "--- Installing dependency: $1"
sudo apt-get -y install $1
}
install_dependency git
install_dependency libpulse-dev
install_dependency libgtk-3-dev
install_dependency libasound2-dev
install_dependency libcurl4-openssl-dev
install_dependency libusb-1.0-0-dev
install_dependency wiringpi
cd /tmp
git clone https://github.com/g0orx/pihpsdr.git
cd pihpsdr
#makefile modification; when 'on' switch it 'off' (adding '#').
sed -i '/^PURESIGNAL_INCLUDE=PURESIGNAL/c\#PURESIGNAL_INCLUDE=PURESIGNAL' ./Makefile
sed -i '/^#MIDI_INCLUDE=MIDI/c\MIDI_INCLUDE=MIDI' ./Makefile
sed -i '/^GPIO_INCLUDE=GPIO/c\#GPIO_INCLUDE=GPIO' ./Makefile;
if [ "$localcw" -eq "1" ]; then
sed -i '/^#GPIO_INCLUDE=GPIO/c\GPIO_INCLUDE=GPIO' ./Makefile;
sed -i '/^#LOCALCW_INCLUDE=LOCALCW/c\LOCALCW_INCLUDE=LOCALCW' ./Makefile;
fi
make -j 4
sudo make install
if [ ! -d "/home/pi/.pihpsdr" ]; then
mkdir /home/pi/.pihpsdr
fi
cp release/pihpsdr/hpsdr.png /home/pi/.pihpsdr
cd ..
rm -rf pihpsdr
rm /home/pi/Desktop/pihpsdr.desktop
file="/home/pi/Desktop/pihpsdr.desktop"
echo "[Desktop Entry]" >> $file
echo "Icon=/home/pi/.pihpsdr/hpsdr.png" >> $file
echo "Exec=/usr/local/bin/pihpsdr" >> $file
echo "Type=Application" >> $file
echo "Terminal=false" >> $file
echo "Path=/home/pi/.pihpsdr" >> $file
cat $file
echo ""
echo "pihpsdr installed"
elif [[ $input == "reboot" ]]; then
sudo reboot
else
echo "You did not make a selection; Nothing installed!"
echo "73!"
fi

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,30 @@
## Radioberry software installation script
This is a stable release of versions of the Radioberry sofware.
Initialy it was a script where you could select the individual software components.
Nowadays people have to choose too much...hi, the whole software stack will be installed.
https://github.com/pa3gsb/Radioberry-2.x/wiki/Radioberry-Software-stack
This avoids possible problems by selecting the wrong set of software components.
Installation is easy:
Open a command window and executing the following commands:
cd /tmp
wget https://raw.githubusercontent.com/pa3gsb/Radioberry-2.x/master/SBC/rpi-4/releases/stable/radioberry_install.sh
sudo chmod +x radioberry_install.sh
./radioberry_install.sh
Installation of SOAPY:
cd /tmp
wget https://raw.githubusercontent.com/pa3gsb/Radioberry-2.x/master/SBC/rpi-4/releases/stable/soapy_install.sh
sudo chmod +x soapy_install.sh
./soapy_install.sh

Wyświetl plik

@ -0,0 +1,146 @@
#!/bin/bash
echo ""
echo ""
echo "============================================"
echo "Radioberry software installation."
echo ""
echo "You will install the following versions: "
echo ""
echo " Gateware version 72.5"
echo " Driver version 0.8"
echo " Firmware version 2021.01.17"
echo "============================================"
echo ""
echo ""
fpgatype=2; #default
while true; do
read -p "Install CL016 or CL025 radioberry version: 1 = CL016 or 2 = CL025? " type
case $type in
[1]* ) fpgatype=1; break;;
[2]* ) fpgatype=2; break;;
* ) echo "Please answer 1 or 2 for the FPGA used in your radioberry.";
esac
done
function install_dependency {
echo "--- Installing dependency: $1"
sudo apt-get -y install $1
}
install_dependency raspberrypi-kernel-headers
install_dependency git
install_dependency device-tree-compiler
install_dependency pigpio
git clone --depth=1 https://github.com/pa3gsb/Radioberry-2.x
cd Radioberry-2.x
echo "checkout the stable git tag"
git checkout c969108f80cf4fa0b79d34ebd35b48bf243f51b4
cd ..
sudo systemctl stop radioberry
sudo systemctl disable radioberry
#-----------------------------------------------------------------------------
if [[ $fpgatype == 1 ]]; then
echo "Installing Radioberry gateware Cyclone 10 CL016..."
cd Radioberry-2.x/SBC/rpi-4/releases/stable/CL016
sudo cp ./radioberry.rbf /lib/firmware
cd ../../../../../..
echo ""
echo "Radioberry gateware Cyclone 10 CL016 installed."
fi
if [[ $fpgatype == 2 ]]; then
echo "Installing Radioberry gateware Cyclone 10 CL025..."
cd Radioberry-2.x/SBC/rpi-4/releases/stable/CL025
sudo cp ./radioberry.rbf /lib/firmware
cd ../../../../../..
echo ""
echo "Radioberry gateware Cyclone 10 CL025 installed."
fi
#-----------------------------------------------------------------------------
echo "Installing Radioberry driver..."
#unregister radioberry driver
sudo modprobe -r radioberry
if [ ! -d "/lib/modules/$(uname -r)/kernel/drivers/sdr" ]; then
sudo mkdir /lib/modules/$(uname -r)/kernel/drivers/sdr
fi
cd Radioberry-2.x/SBC/rpi-4/device_driver/driver
make
sudo cp radioberry.ko /lib/modules/$(uname -r)/kernel/drivers/sdr
sudo dtc -@ -I dts -O dtb -o radioberry.dtbo radioberry.dts
sudo cp radioberry.dtbo /boot/overlays
#add driver to config.txt
sudo grep -Fxq "dtoverlay=radioberry" /boot/config.txt || sudo sed -i '$ a dtoverlay=radioberry' /boot/config.txt
cd ../../../../..
sudo depmod
#register radioberry driver
sudo modprobe radioberry
sudo chmod 666 /dev/radioberry
#show radioberry driver info.
sudo modinfo radioberry
echo ""
echo "Radioberry driver installed."
#-----------------------------------------------------------------------------
echo "Installing Radioberry firmware..."
cd Radioberry-2.x/SBC/rpi-4/device_driver/firmware
sudo make
sudo cp radioberry /usr/local/bin
sudo chmod +x /usr/local/bin/radioberry
cd ../../../../..
echo ""
echo "Radioberry firmware installed."
#-----------------------------------------------------------------------------
echo "Installing radioberry service ..."
cd Radioberry-2.x/SBC/rpi-4/device_driver/systemd
sudo cp radioberry.service /etc/systemd/system/radioberry.service
sudo cp radioberryd /etc/init.d/radioberryd
sudo chmod +x /etc/init.d/radioberryd
cd ../../../../..
echo "Radioberry service installed."
#-----------------------------------------------------------------------------
rm -rf Radioberry-2.x
sudo systemctl start radioberry
echo ""
echo ""
echo "============================================"
echo "Radioberry software is installed!"
echo "Have fun using the SDR Radioberry"
echo ""
echo "73 Johan PA3GSB"
echo "============================================"
echo ""
echo ""

Wyświetl plik

@ -0,0 +1,76 @@
#!/bin/bash
echo "Installation of radioberry SOAPY SDR setup"
echo ""
echo "You need to install [SoapySDR/SoapyRadioberrySDR/reboot] ?"
read input
if [[ $input == "SoapySDR" ]]; then
echo "Installing SoapySDR..."
function install_dependency {
echo "--- Installing dependency: $1"
sudo apt-get -y install $1
}
install_dependency git
install_dependency cmake
install_dependency libusb-1.0-0-dev
cd /tmp
git clone https://github.com/pothosware/SoapySDR.git
cd SoapySDR
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig
cd ../..
rm -rf SoapySDR
SoapySDRUtil --info
echo ""
echo "SoapySDR installed."
elif [[ $input == "SoapyRadioberrySDR" ]]; then
echo "Installing SoapyRadioberrySDR ..."
function install_dependency {
echo "--- Installing dependency: $1"
sudo apt-get -y install $1
}
install_dependency git
install_dependency cmake
cd /tmp
git clone --depth=1 https://github.com/pa3gsb/Radioberry-2.x.git
cd Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig
cd ../..
rm -rf Radioberry-2.x
SoapySDRUtil --probe="driver=radioberry"
echo ""
echo "SoapyRadioberrySDR installed."
elif [[ $input == "reboot" ]]; then
sudo reboot
else
echo "You did not make a selection; Nothing installed!"
echo "73!"
fi