merging changes from dev branch

pull/197/head
matteo serva 2024-04-23 12:20:35 +02:00
rodzic d0805f51c9
commit c7efd74bb9
5 zmienionych plików z 1282 dodań i 1239 usunięć

Wyświetl plik

@ -1,3 +1,20 @@
# MODIFIED CARIBOULITE
This is a non-official branch of cariboulite.
Features:
- performance upgrades
- transmission of arbitrary waveforms
The guide on how to use this version is in docs/notes/tutorial.txt
___
_
___
_
___
_
# CaribouLite
CaribouLite is an affordable, educational, open-source SDR evaluation platform and a HAT for the Raspberry-Pi family of boards (40-pin versions only). It is built for makers, hackers, and researchers and was designed to complement the current SDR (Software Defined Radio) eco-systems offering with a scalable, standalone dual-channel software-defined radio.

Wyświetl plik

@ -20,6 +20,7 @@
#define IOC_SYS_CTRL_SYS_SOFT_RST 4
#define IOC_SYS_CTRL_DEBUG_MODES 5
#define IOC_SYS_CTRL_SYS_TX_SAMPLE_GAP 6
#define IOC_SYS_CTRL_SYS_CTRL_WORD 3
#define IOC_IO_CTRL_MODE 1
#define IOC_IO_CTRL_DIG_PIN 2
@ -384,6 +385,21 @@ int caribou_fpga_get_errors (caribou_fpga_st* dev, uint8_t *err_map)
return caribou_fpga_spi_transfer (dev, (uint8_t*)(&oc), err_map);
}
int caribou_fpga_get_debug (caribou_fpga_st* dev, uint8_t *err_map)
{
CARIBOU_FPGA_CHECK_DEV(dev,"caribou_fpga_get_errors");
CARIBOU_FPGA_CHECK_PTR_NOT_NULL(err_map,"caribou_fpga_get_errors","err_map");
caribou_fpga_opcode_st oc =
{
.rw = caribou_fpga_rw_read,
.mid = caribou_fpga_mid_res,
.ioc = IOC_SYS_CTRL_SYS_ERR_STAT
};
*err_map = 0;
return caribou_fpga_spi_transfer (dev, (uint8_t*)(&oc), err_map);
}
//--------------------------------------------------------------
int caribou_fpga_set_sys_ctrl_tx_sample_gap (caribou_fpga_st* dev, uint8_t gap)
{
@ -397,6 +413,18 @@ int caribou_fpga_set_sys_ctrl_tx_sample_gap (caribou_fpga_st* dev, uint8_t gap)
return caribou_fpga_spi_transfer (dev, (uint8_t*)(&oc), &gap);
}
int caribou_fpga_set_sys_ctrl_tx_control_word (caribou_fpga_st* dev, uint8_t word)
{
CARIBOU_FPGA_CHECK_DEV(dev,"caribou_fpga_set_sys_ctrl_tx_control_word");
caribou_fpga_opcode_st oc =
{
.rw = caribou_fpga_rw_write,
.mid = caribou_fpga_mid_sys_ctrl,
.ioc = IOC_SYS_CTRL_SYS_CTRL_WORD,
};
return caribou_fpga_spi_transfer (dev, (uint8_t*)(&oc), &word);
}
//--------------------------------------------------------------
int caribou_fpga_get_sys_ctrl_tx_sample_gap (caribou_fpga_st* dev, uint8_t *gap)
{

Wyświetl plik

@ -153,6 +153,7 @@ int caribou_fpga_set_debug_modes (caribou_fpga_st* dev, bool dbg_fifo_push, bool
int caribou_fpga_set_sys_ctrl_tx_sample_gap (caribou_fpga_st* dev, uint8_t gap);
int caribou_fpga_get_sys_ctrl_tx_sample_gap (caribou_fpga_st* dev, uint8_t *gap);
int caribou_fpga_set_sys_ctrl_tx_control_word (caribou_fpga_st* dev, uint8_t word);
// I/O Controller
int caribou_fpga_set_io_ctrl_mode (caribou_fpga_st* dev, uint8_t debug_mode, caribou_fpga_io_ctrl_rfm_en rfm);
@ -175,6 +176,8 @@ int caribou_fpga_get_smi_ctrl_fifo_status (caribou_fpga_st* dev, caribou_fpga_sm
int caribou_fpga_set_smi_channel (caribou_fpga_st* dev, caribou_fpga_smi_channel_en channel);
int caribou_fpga_set_smi_ctrl_data_direction (caribou_fpga_st* dev, uint8_t dir);
int caribou_fpga_get_debug (caribou_fpga_st* dev, uint8_t *err_map);
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -25,6 +25,7 @@ static float sample_rate_middles[] = {3000, 1666, 1166, 900, 733, 583, 450};
static float rx_bandwidth_middles[] = {225, 281, 356, 450, 562, 706, 893, 1125, 1406, 1781, 2250};
static float tx_bandwidth_middles[] = {90, 112, 142, 180, 225, 282, 357, 450, 562, 712, 900};
int cariboulite_radio_set_modem_state(cariboulite_radio_state_st* radio, cariboulite_radio_state_cmd_en state);
void cariboulite_radio_debug(cariboulite_radio_state_st* radio)
{
@ -34,8 +35,8 @@ void cariboulite_radio_debug(cariboulite_radio_state_st* radio)
at86rf215_iq_interface_config_st cfg;
at86rf215_get_iq_if_cfg(&radio->sys->modem,&cfg,1);
uint8_t debug_word = 0;
//caribou_fpga_get_debug (&radio->sys->fpga, &debug_word);
uint8_t debug_word;
caribou_fpga_get_debug (&radio->sys->fpga, &debug_word);
printf("debug word vale %02X\n",(int)debug_word);
}
@ -1080,7 +1081,7 @@ static int cariboulite_radio_tx_prep(cariboulite_radio_state_st* radio)
int cariboulite_radio_activate_channel(cariboulite_radio_state_st* radio,
cariboulite_channel_dir_en dir,
bool activate)
{
{
int ret = 0;
radio->channel_direction = dir;
radio->active = activate;
@ -1088,6 +1089,7 @@ int cariboulite_radio_activate_channel(cariboulite_radio_state_st* radio,
ZF_LOGD("Activating channel %d, dir = %s, activate = %d", radio->type, radio->channel_direction==cariboulite_channel_dir_rx?"RX":"TX", activate);
// then deactivate the modem's stream
cariboulite_radio_set_modem_state(radio, cariboulite_radio_state_cmd_trx_off);
@ -1163,8 +1165,9 @@ int cariboulite_radio_activate_channel(cariboulite_radio_state_st* radio,
.radio24_mode = at86rf215_iq_if_mode,
.clock_skew = at86rf215_iq_clock_data_skew_4_906ns,
};
at86rf215_setup_iq_if(&radio->sys->modem, &modem_iq_config);
at86rf215_setup_iq_if(&radio->sys->modem, &modem_iq_config);
// if its an LO frequency output from the mixer - no need for modem output
// LO applicable only to the channel with the mixer
if (radio->lo_output &&
@ -1195,7 +1198,7 @@ int cariboulite_radio_activate_channel(cariboulite_radio_state_st* radio,
1, 0x3F);
// transition to state TX
cariboulite_radio_set_modem_state(radio, cariboulite_radio_state_cmd_tx);
//cariboulite_radio_set_modem_state(radio, cariboulite_radio_state_cmd_tx);
}
else
{
@ -1212,11 +1215,21 @@ int cariboulite_radio_activate_channel(cariboulite_radio_state_st* radio,
// apply the state
caribou_smi_set_driver_streaming_state(&radio->sys->smi, smi_stream_tx_channel);
// ACTIVATION STEPS
//caribou_fpga_set_sys_ctrl_tx_control_word(&radio->sys->fpga, 0x0); // send zero frames to the radio
if(cariboulite_radio_tx_prep(radio))
{
return -1;
}
}
usleep(100); // wait at least tx_start_delay
caribou_fpga_set_sys_ctrl_tx_control_word(&radio->sys->fpga, 0x01);
}
}
return 0;