kopia lustrzana https://github.com/cariboulabs/cariboulite
bug fixes, mixer, io_utils, spi, adaptation fpga
rodzic
029f294aa9
commit
653d1f401e
|
@ -60,9 +60,6 @@ set_io i_iq_rx_09_p A4 # Paired with i_iq_rx_09_n @ B3 - positive logic
|
|||
set_io i_iq_rx_24_n A2 # Paired with i_iq_rx_24_p @ B1 - negative logic - needs to be negated
|
||||
set_io i_iq_rx_clk_p A3 # Paired with i_iq_rx_clk_n @ B2 - positive logic
|
||||
|
||||
# MODEM
|
||||
set_io i_radio_clk A12
|
||||
|
||||
# DIGITAL I/F
|
||||
set_io -pullup yes i_config[0] B29
|
||||
set_io -pullup yes i_config[1] A40
|
||||
|
@ -71,10 +68,10 @@ set_io -pullup yes i_config[3] A41
|
|||
set_io -pullup yes i_button B31
|
||||
set_io o_led0 A38
|
||||
set_io o_led1 A39
|
||||
set_io o_ldo_2v8_en B32
|
||||
|
||||
# SMI TO RPI
|
||||
set_io i_smi_a0_irq A19
|
||||
set_io o_smi_write_req A19
|
||||
set_io o_smi_read_req B19
|
||||
set_io i_smi_a1 A43
|
||||
set_io i_smi_a2 A48
|
||||
set_io i_smi_a3 A47
|
||||
|
@ -91,7 +88,7 @@ set_io io_smi_data[6] A13
|
|||
set_io io_smi_data[7] A14
|
||||
|
||||
# SPI
|
||||
set_io i_mosi B17
|
||||
set_io i_mosi A22
|
||||
set_io i_sck A23
|
||||
set_io i_ss B18
|
||||
set_io o_miso A22
|
||||
set_io o_miso B17
|
||||
|
|
18896
firmware/top.asc
18896
firmware/top.asc
Plik diff jest za duży
Load Diff
BIN
firmware/top.bin
BIN
firmware/top.bin
Plik binarny nie jest wyświetlany.
16240
firmware/top.json
16240
firmware/top.json
Plik diff jest za duży
Load Diff
|
@ -7,7 +7,6 @@
|
|||
|
||||
module top(
|
||||
input i_glob_clock,
|
||||
output i_smi_a0_irq,
|
||||
|
||||
// RF FRONT-END PATH
|
||||
output o_rx_h_tx_l,
|
||||
|
@ -19,7 +18,6 @@ module top(
|
|||
output o_shdn_tx_lna,
|
||||
|
||||
// MODEM (LVDS & CLOCK)
|
||||
input i_radio_clk,
|
||||
output o_iq_tx_p,
|
||||
output o_iq_tx_n,
|
||||
output o_iq_tx_clk_p,
|
||||
|
@ -40,7 +38,6 @@ module top(
|
|||
// DIGITAL I/F
|
||||
input [3:0] i_config,
|
||||
input i_button,
|
||||
output o_ldo_2v8_en,
|
||||
inout [7:0] io_pmod,
|
||||
output o_led0,
|
||||
output o_led1,
|
||||
|
@ -53,6 +50,8 @@ module top(
|
|||
input i_smi_soe_se,
|
||||
input i_smi_swe_srw,
|
||||
inout [7:0] io_smi_data,
|
||||
output o_smi_write_req,
|
||||
output o_smi_read_req,
|
||||
|
||||
// SPI
|
||||
input i_mosi,
|
||||
|
@ -337,6 +336,9 @@ module top(
|
|||
assign w_smi_addr = {i_smi_a3, i_smi_a2, i_smi_a1};
|
||||
assign io_smi_data = (w_smi_writing)?w_smi_data_output:1'bZ;
|
||||
assign w_smi_data_input = io_smi_data;
|
||||
assign o_smi_write_req = (w_smi_writing)?w_smi_write_req:1'bZ;
|
||||
assign o_smi_read_req = (w_smi_writing)?w_smi_read_req:1'bZ;
|
||||
|
||||
|
||||
// Testing - output the clock signal (positive and negative) to the PMOD
|
||||
assign io_pmod[0] = (w_smi_writing)?w_smi_read_req:1'bZ;
|
||||
|
|
|
@ -87,7 +87,7 @@ int at86rf215_init(at86rf215_st* dev,
|
|||
|
||||
ZF_LOGI("configuring reset and irq pins");
|
||||
// Configure GPIO pins
|
||||
io_utils_setup_gpio(dev->reset_pin, io_utils_dir_output, io_utils_pull_up);
|
||||
io_utils_setup_gpio(dev->reset_pin, io_utils_dir_output, io_utils_pull_off);
|
||||
io_utils_setup_gpio(dev->irq_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
|
||||
// set to known state
|
||||
|
@ -106,7 +106,7 @@ int at86rf215_init(at86rf215_st* dev,
|
|||
if (io_utils_setup_interrupt(dev->irq_pin, at86rf215_interrupt_handler, dev) < 0)
|
||||
{
|
||||
ZF_LOGE("interrupt registration for irq_pin (%d) failed", dev->irq_pin);
|
||||
io_utils_setup_gpio(dev->reset_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
//io_utils_setup_gpio(dev->reset_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
io_utils_setup_gpio(dev->irq_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
io_utils_spi_remove_chip(dev->io_spi, dev->io_spi_handle);
|
||||
return -1;
|
||||
|
@ -135,7 +135,7 @@ int at86rf215_close(at86rf215_st* dev)
|
|||
|
||||
dev->initialized = 0;
|
||||
|
||||
io_utils_setup_gpio(dev->reset_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
//io_utils_setup_gpio(dev->reset_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
io_utils_setup_gpio(dev->irq_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
|
||||
// Release the SPI device
|
||||
|
@ -408,8 +408,8 @@ void at86rf215_setup_iq_radio_transmit (at86rf215_st* dev, at86rf215_rf_channel_
|
|||
void at86rf215_setup_iq_radio_receive (at86rf215_st* dev, at86rf215_rf_channel_en radio, uint32_t freq_hz)
|
||||
{
|
||||
/*
|
||||
It is assumed, that
|
||||
1. the radio has been reset before and is in State TRXOFF.
|
||||
It is assumed, that
|
||||
1. the radio has been reset before and is in State TRXOFF.
|
||||
2. All interrupts in register RFn_IRQS should be enabled (RFn_IRQM=0x3f).
|
||||
*/
|
||||
|
||||
|
@ -459,7 +459,7 @@ void at86rf215_setup_iq_radio_receive (at86rf215_st* dev, at86rf215_rf_channel_e
|
|||
};
|
||||
at86rf215_radio_set_rx_bandwidth_sampling(dev, radio, &rx_bw_samp_cfg);
|
||||
|
||||
at86rf215_radio_agc_ctrl_st agc_ctrl =
|
||||
at86rf215_radio_agc_ctrl_st agc_ctrl =
|
||||
{
|
||||
// commands
|
||||
.agc_measure_source_not_filtered = 0, // AGC Input (0 - filterred, 1 - unfiltered, faster operation)
|
||||
|
@ -481,7 +481,7 @@ void at86rf215_setup_iq_radio_receive (at86rf215_st* dev, at86rf215_rf_channel_e
|
|||
// 5. Configure the channel parameters, see section "Channel Configuration" on page 62 and transmit power
|
||||
at86rf215_setup_channel (dev, radio, freq_hz);
|
||||
|
||||
// 6. Switch to State TXPREP; interrupt IRQS.TRXRDY is issued.
|
||||
// 6. Switch to State TXPREP; interrupt IRQS.TRXRDY is issued.
|
||||
// TXD and TXCLK are activated as shown in Figure 4-12 on page 26.
|
||||
// What? Why TX?
|
||||
|
||||
|
@ -491,7 +491,7 @@ void at86rf215_setup_iq_radio_receive (at86rf215_st* dev, at86rf215_rf_channel_e
|
|||
// 8. Enable the radio receiver by writing command RX to the register RFn_CMD.
|
||||
at86rf215_radio_set_state(dev, radio, at86rf215_radio_state_cmd_rx);
|
||||
|
||||
// 9. To prevent the AGC from switching its gain during reception, it is recommended to set AGCC.FRZC=1
|
||||
// 9. To prevent the AGC from switching its gain during reception, it is recommended to set AGCC.FRZC=1
|
||||
// after reception of the preamble, the AGC has to be released after finishing reception by setting AGCC.FRZC=0.
|
||||
// at86rf215_radio_setup_agc(dev, radio, &agc_ctrl);
|
||||
}
|
||||
|
|
|
@ -86,32 +86,6 @@ at86rf215_regs.h
|
|||
at86rf215_common.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_baseband.c
|
||||
stdint.h
|
||||
-
|
||||
math.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/zf_log/zf_log.h
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils_spi.h
|
||||
at86rf215_radio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
at86rf215_baseband.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_baseband.h
|
||||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_baseband.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
stdio.h
|
||||
-
|
||||
|
@ -132,36 +106,6 @@ io_utils/io_utils_spi.h
|
|||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_events.c
|
||||
stdio.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/zf_log/zf_log.h
|
||||
at86rf215_common.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.c
|
||||
stdint.h
|
||||
-
|
||||
math.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/zf_log/zf_log.h
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils_spi.h
|
||||
at86rf215_radio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
stdio.h
|
||||
-
|
||||
|
|
|
@ -56,9 +56,13 @@ stdio.h
|
|||
pigpio.h
|
||||
-
|
||||
|
||||
../../zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215.h
|
||||
at86rf215_common.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215.c
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
stdio.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
math.h
|
||||
|
@ -69,106 +73,32 @@ stdbool.h
|
|||
-
|
||||
stdio.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/zf_log/zf_log.h
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils_spi.h
|
||||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
stdio.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
at86rf215_common.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/test_at86rf215.c
|
||||
stdio.h
|
||||
-
|
||||
at86rf215.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215.h
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils_spi.h
|
||||
at86rf215_radio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215.h
|
||||
at86rf215_common.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_baseband.c
|
||||
stdint.h
|
||||
-
|
||||
math.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/zf_log/zf_log.h
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils_spi.h
|
||||
at86rf215_radio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
at86rf215_baseband.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_baseband.h
|
||||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_baseband.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
stdio.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
math.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils_spi.h
|
||||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_events.c
|
||||
stdio.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/zf_log/zf_log.h
|
||||
at86rf215_common.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.c
|
||||
stdint.h
|
||||
-
|
||||
math.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
stdbool.h
|
||||
-
|
||||
stdio.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/zf_log/zf_log.h
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/io_utils/io_utils_spi.h
|
||||
at86rf215_radio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
at86rf215_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_radio.h
|
||||
stdio.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
at86rf215_common.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_common.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/at86rf215/at86rf215_regs.h
|
||||
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -68,7 +68,7 @@ int test_at86rf215_read_chip_vn_pn(at86rf215_st* dev)
|
|||
// usec_gaps - specifies the micro-second gaps between freq steps or '-1' that
|
||||
// tell the function to put "getchars" (wait for enter key)
|
||||
void test_at86rf215_sweep_frequencies(at86rf215_st* dev,
|
||||
at86rf215_rf_channel_en channel,
|
||||
at86rf215_rf_channel_en channel,
|
||||
int start_freq,
|
||||
int num_freq,
|
||||
int step_freq,
|
||||
|
@ -95,7 +95,7 @@ void test_at86rf215_sweep_frequencies(at86rf215_st* dev,
|
|||
//printf("Press enter to switch\n");
|
||||
if (usec_gaps > 0) io_utils_usleep(usec_gaps);
|
||||
else
|
||||
{
|
||||
{
|
||||
printf("Press enter to step...\n");
|
||||
getchar();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void test_at86rf215_sweep_frequencies(at86rf215_st* dev,
|
|||
// -----------------------------------------------------------------------------------------
|
||||
// Starting a reception window
|
||||
// usec_timeout - set up a timeout value in micro-seconds or -1 to wait for "enter" key
|
||||
int test_at86rf215_continues_iq_rx (at86rf215_st* dev, at86rf215_rf_channel_en radio,
|
||||
int test_at86rf215_continues_iq_rx (at86rf215_st* dev, at86rf215_rf_channel_en radio,
|
||||
uint32_t freq_hz, int usec_timeout)
|
||||
{
|
||||
at86rf215_setup_iq_radio_receive (dev, radio, freq_hz);
|
||||
|
@ -121,7 +121,7 @@ int test_at86rf215_continues_iq_rx (at86rf215_st* dev, at86rf215_rf_channel_en r
|
|||
io_utils_usleep(usec_timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
printf("Press enter to stop...\n");
|
||||
getchar();
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ int test_at86rf215_continues_iq_rx (at86rf215_st* dev, at86rf215_rf_channel_en r
|
|||
#define NO_FPGA_MODE 0
|
||||
#define TEST_VERSIONS 1
|
||||
#define TEST_FREQ_SWEEP 0
|
||||
#define TEST_IQ_RX_WIND 1
|
||||
#define TEST_IQ_RX_WIND 0
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// MAIN
|
||||
|
@ -164,8 +164,8 @@ int main ()
|
|||
// Init spi
|
||||
io_utils_spi_init(&io_spi_dev);
|
||||
|
||||
at86rf215_init(&dev, &io_spi_dev);
|
||||
at86rf215_reset(&dev);
|
||||
at86rf215_init(&dev, &io_spi_dev);
|
||||
|
||||
// TEST: read the p/n and v/n from the IC
|
||||
#if TEST_VERSIONS
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -8,91 +8,41 @@
|
|||
|
||||
../../zf_log/zf_log.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/command.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/io_utils.h
|
||||
stdio.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
pigpio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/pigpio.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/custom.cext
|
||||
pigpio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/pigpio.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/pigpio.c
|
||||
stdio.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
strings.h
|
||||
-
|
||||
stdlib.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
inttypes.h
|
||||
stdlib.h
|
||||
-
|
||||
stdarg.h
|
||||
-
|
||||
ctype.h
|
||||
-
|
||||
syslog.h
|
||||
-
|
||||
poll.h
|
||||
-
|
||||
unistd.h
|
||||
-
|
||||
fcntl.h
|
||||
-
|
||||
termios.h
|
||||
-
|
||||
signal.h
|
||||
-
|
||||
errno.h
|
||||
pigpio/pigpio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/pigpio.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/io_utils_spi.c
|
||||
pthread.h
|
||||
-
|
||||
time.h
|
||||
-
|
||||
sys/ioctl.h
|
||||
errno.h
|
||||
-
|
||||
limits.h
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/zf_log/zf_log.h
|
||||
io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/io_utils_spi.h
|
||||
io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/io_utils.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/io_utils_spi.h
|
||||
stdio.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
pthread.h
|
||||
-
|
||||
sys/time.h
|
||||
-
|
||||
sys/mman.h
|
||||
-
|
||||
sys/types.h
|
||||
-
|
||||
sys/stat.h
|
||||
-
|
||||
sys/file.h
|
||||
-
|
||||
sys/socket.h
|
||||
-
|
||||
sys/sysmacros.h
|
||||
-
|
||||
netinet/tcp.h
|
||||
-
|
||||
arpa/inet.h
|
||||
-
|
||||
sys/select.h
|
||||
-
|
||||
fnmatch.h
|
||||
-
|
||||
glob.h
|
||||
-
|
||||
arpa/inet.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/zf_log/zf_log.h
|
||||
pigpio.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/pigpio.h
|
||||
command.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/command.h
|
||||
custom.cext
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/custom.cext
|
||||
io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/io_utils.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/io_utils/pigpio/pigpio.h
|
||||
stddef.h
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -83,6 +83,8 @@ static int io_utils_spi_write_rffc507x(io_utils_spi_st* dev, io_utils_spi_chip_s
|
|||
uint32_t data = reg;
|
||||
data = ((data & 0x7f) << 16) | val;
|
||||
|
||||
//printf("==> io_utils_spi_write_rffc507x: %06X\n", data);
|
||||
|
||||
int sdata_pin = chip->miso_mosi_swap?dev->miso:dev->mosi;
|
||||
int sclk_pin = dev->sck;
|
||||
int enx_pin = chip->cs_pin;
|
||||
|
@ -196,6 +198,8 @@ static int io_utils_spi_read_rffc507x(io_utils_spi_st* dev, io_utils_spi_chip_st
|
|||
io_utils_write_gpio_with_wait(sclk_pin, 1, nop_cnt);
|
||||
io_utils_write_gpio_with_wait(sclk_pin, 0, nop_cnt);
|
||||
|
||||
//printf("==>The read data is: %06X\n", data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -520,7 +524,8 @@ int io_utils_spi_transmit(io_utils_spi_st* dev, int chip_handle,
|
|||
}
|
||||
else
|
||||
{
|
||||
uint16_t val = ((uint16_t)(tx_buf[1]))<<8 | tx_buf[2];
|
||||
uint16_t val = ((uint16_t)(tx_buf[2]))<<8 | tx_buf[1];
|
||||
//ZF_LOGI("rffc507x writing to reg %02X, data %04X", reg, val);
|
||||
int r = io_utils_spi_write_rffc507x(dev, dev->current_chip, reg, val);
|
||||
if (r < 0)
|
||||
{
|
||||
|
|
|
@ -56,22 +56,6 @@ stdio.h
|
|||
pigpio.h
|
||||
-
|
||||
|
||||
../../zf_log/zf_log.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/rffc507x.c
|
||||
stdint.h
|
||||
-
|
||||
string.h
|
||||
-
|
||||
zf_log/zf_log.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/zf_log/zf_log.h
|
||||
rffc507x.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/rffc507x.h
|
||||
rffc507x_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/rffc507x_regs.h
|
||||
stdio.h
|
||||
-
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/rffc507x.h
|
||||
stdio.h
|
||||
-
|
||||
|
@ -82,9 +66,13 @@ io_utils/io_utils.h
|
|||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/io_utils/io_utils_spi.h
|
||||
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/rffc507x_regs.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/test_rffc507x.c
|
||||
stdio.h
|
||||
-
|
||||
stdint.h
|
||||
-
|
||||
rffc507x.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/rffc507x.h
|
||||
io_utils/io_utils.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/io_utils/io_utils.h
|
||||
io_utils/io_utils_spi.h
|
||||
/home/pi/projects/cariboulite/software/libcariboulite/src/rffc507x/io_utils/io_utils_spi.h
|
||||
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -68,8 +68,8 @@ static uint16_t rffc507x_regs_default[RFFC507X_NUM_REGS] =
|
|||
0x2a20, /* 12 */
|
||||
0x0000, /* 13 */
|
||||
0x0000, /* 14 */
|
||||
0x0000, /* 15 */
|
||||
0x0000, /* 16 */
|
||||
0x0000, /* 15h / 21d <== SDI_CTRL - SDI Control */
|
||||
0x0000, /* 16h / 22d <== GPO - General Purpose Outputs */
|
||||
0x4900, /* 17 */
|
||||
0x0281, /* 18 */
|
||||
0xf00f, /* 19 */
|
||||
|
@ -83,6 +83,7 @@ static uint16_t rffc507x_regs_default[RFFC507X_NUM_REGS] =
|
|||
//===========================================================================
|
||||
static inline void rffc507x_reg_commit(rffc507x_st* dev, uint8_t r)
|
||||
{
|
||||
//printf("writing reg %d, value: %04X\n", r, dev->rffc507x_regs[r]);
|
||||
rffc507x_reg_write(dev, r, dev->rffc507x_regs[r]);
|
||||
}
|
||||
|
||||
|
@ -117,11 +118,9 @@ int rffc507x_init( rffc507x_st* dev,
|
|||
dev->io_spi = io_spi;
|
||||
|
||||
/* Configure GPIO pins. */
|
||||
io_utils_setup_gpio(dev->mode_pin, io_utils_dir_output, io_utils_pull_up);
|
||||
io_utils_setup_gpio(dev->reset_pin, io_utils_dir_output, io_utils_pull_up);
|
||||
|
||||
/* set to known state */
|
||||
io_utils_write_gpio(dev->mode_pin, 0);
|
||||
io_utils_write_gpio(dev->reset_pin, 1);
|
||||
|
||||
dev->io_spi_handle = io_utils_spi_add_chip(dev->io_spi, dev->cs_pin, 5000000, 0, 0,
|
||||
|
@ -146,10 +145,15 @@ int rffc507x_init( rffc507x_st* dev,
|
|||
set_RFFC507X_P2PRESC(dev, 0);
|
||||
set_RFFC507X_P2VCOSEL(dev, 0);
|
||||
|
||||
// set ENBL and MODE to be configured via 3-wire interface, not control pins.
|
||||
// set ENBL and MODE to be configured via 4-wire interface, not control pins.
|
||||
set_RFFC507X_RESET(dev, 0);
|
||||
set_RFFC507X_ADDR(dev, 0);
|
||||
//set_RFFC507X_4WIRE(dev, 1);
|
||||
set_RFFC507X_4WIRE(dev, 0);
|
||||
set_RFFC507X_MODE(dev, 1);
|
||||
set_RFFC507X_ENBL(dev, 1);
|
||||
set_RFFC507X_SIPIN(dev, 1);
|
||||
|
||||
// GPOs are active at all times
|
||||
set_RFFC507X_LOCK(dev, 0);
|
||||
set_RFFC507X_GATE(dev, 1);
|
||||
|
||||
// Write default register values to chip.
|
||||
|
@ -183,7 +187,6 @@ int rffc507x_release(rffc507x_st* dev)
|
|||
dev->initialized = 0;
|
||||
|
||||
io_utils_setup_gpio(dev->reset_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
io_utils_setup_gpio(dev->mode_pin, io_utils_dir_input, io_utils_pull_up);
|
||||
|
||||
// Release the SPI device
|
||||
io_utils_spi_remove_chip(dev->io_spi, dev->io_spi_handle);
|
||||
|
@ -209,7 +212,7 @@ uint16_t rffc507x_reg_read(rffc507x_st* dev, uint8_t r)
|
|||
uint16_t vin = 0;
|
||||
|
||||
// Readback register is not cached.
|
||||
if (r == RFFC507X_READBACK_REG)
|
||||
//if (r == RFFC507X_READBACK_REG)
|
||||
{
|
||||
io_utils_spi_transmit(dev->io_spi, dev->io_spi_handle, &vout, (uint8_t*)&vin, 2, io_utils_spi_read);
|
||||
return vin;
|
||||
|
@ -371,6 +374,36 @@ uint64_t rffc507x_set_frequency(rffc507x_st* dev, uint16_t mhz)
|
|||
return tune_freq;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void rffc507x_setup_pin_functions(rffc507x_st* dev)
|
||||
{
|
||||
ZF_LOGD("setting up gpio configurations (4-wire)");
|
||||
set_RFFC507X_RESET(dev, 0);
|
||||
set_RFFC507X_ADDR(dev, 0);
|
||||
set_RFFC507X_4WIRE(dev, 1);
|
||||
set_RFFC507X_MODE(dev, 1);
|
||||
set_RFFC507X_ENBL(dev, 1);
|
||||
set_RFFC507X_SIPIN(dev, 0);
|
||||
set_RFFC507X_LOCK(dev, 0);
|
||||
set_RFFC507X_GATE(dev, 0);
|
||||
rffc507x_regs_commit(dev);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void rffc507x_readback(rffc507x_st* dev, uint16_t *readback_buff, int buf_len)
|
||||
{
|
||||
if (buf_len > 16) buf_len = 16;
|
||||
|
||||
for (int i = 0; i < buf_len; i++)
|
||||
{
|
||||
set_RFFC507X_READSEL(dev, i);
|
||||
rffc507x_regs_commit(dev);
|
||||
readback_buff[i] = rffc507x_reg_read(dev, RFFC507X_READBACK_REG);
|
||||
|
||||
printf ("READBACK #%d: %04X\n", i, readback_buff[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void rffc507x_set_gpo(rffc507x_st* dev, uint8_t gpo)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,6 @@ typedef struct
|
|||
{
|
||||
int cs_pin;
|
||||
int reset_pin;
|
||||
int mode_pin;
|
||||
|
||||
io_utils_spi_st* io_spi;
|
||||
int io_spi_handle;
|
||||
|
@ -78,5 +77,7 @@ void rffc507x_rxtx(rffc507x_st* dev);
|
|||
void rffc507x_enable(rffc507x_st* dev);
|
||||
void rffc507x_disable(rffc507x_st* dev);
|
||||
void rffc507x_set_gpo(rffc507x_st* dev, uint8_t gpo);
|
||||
void rffc507x_setup_pin_functions(rffc507x_st* dev);
|
||||
void rffc507x_readback(rffc507x_st* dev, uint16_t *readback_buff, int buf_len);
|
||||
|
||||
#endif // __RFFC507X_H
|
||||
|
|
|
@ -31,10 +31,10 @@ int main ()
|
|||
io_utils_set_gpio_mode(FPGA_RESET, io_utils_alt_gpio_out);
|
||||
io_utils_set_gpio_mode(ICE40_CS, io_utils_alt_gpio_out);
|
||||
io_utils_setup_gpio(CARIBOULITE_MXR_RESET, io_utils_dir_output, io_utils_pull_up);
|
||||
|
||||
|
||||
//io_utils_write_gpio(FPGA_RESET, 0);
|
||||
//io_utils_write_gpio(ICE40_CS, 0);
|
||||
|
||||
|
||||
io_utils_write_gpio(CARIBOULITE_MXR_RESET, 0);
|
||||
printf("RFFC5072 is reset, press enter to release...\n");
|
||||
getchar();
|
||||
|
@ -42,6 +42,7 @@ int main ()
|
|||
printf("RFFC5072 is not reset.\n");
|
||||
|
||||
io_utils_spi_init(&io_spi_dev);
|
||||
io_utils_set_gpio_mode(19, io_utils_alt_gpio_in);
|
||||
rffc507x_init(&dev, &io_spi_dev);
|
||||
|
||||
printf("RFFC507X Registers:\n");
|
||||
|
@ -51,6 +52,9 @@ int main ()
|
|||
printf("REG #%d => %04X\n", i, reg_val);
|
||||
}
|
||||
|
||||
uint16_t readback_buff[16] = {0};
|
||||
rffc507x_readback(&dev, readback_buff, 16);
|
||||
|
||||
rffc507x_release(&dev);
|
||||
io_utils_spi_close(&io_spi_dev);
|
||||
io_utils_cleanup();
|
||||
|
|
Ładowanie…
Reference in New Issue