Simplify bias
This commit is contained in:
parent
53ac42ca2e
commit
f57c5b006c
2 changed files with 44 additions and 41 deletions
|
@ -40,6 +40,7 @@ blocks:
|
||||||
const_points: '[-1-1j, -1+1j, 1+1j, 1-1j]'
|
const_points: '[-1-1j, -1+1j, 1+1j, 1-1j]'
|
||||||
dims: '1'
|
dims: '1'
|
||||||
normalization: digital.constellation.AMPLITUDE_NORMALIZATION
|
normalization: digital.constellation.AMPLITUDE_NORMALIZATION
|
||||||
|
npwr: '1.0'
|
||||||
precision: '8'
|
precision: '8'
|
||||||
rot_sym: '4'
|
rot_sym: '4'
|
||||||
soft_dec_lut: None
|
soft_dec_lut: None
|
||||||
|
@ -77,7 +78,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [704, 296.0]
|
coordinate: [704, 312.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: true
|
state: true
|
||||||
- name: analog_wfm_rcv_pll_0
|
- name: analog_wfm_rcv_pll_0
|
||||||
|
@ -140,11 +141,12 @@ blocks:
|
||||||
alias: ''
|
alias: ''
|
||||||
comment: ''
|
comment: ''
|
||||||
en_uvec: 'True'
|
en_uvec: 'True'
|
||||||
|
log_level: info
|
||||||
states:
|
states:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [1000, 32.0]
|
coordinate: [992, 8.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: true
|
state: true
|
||||||
- name: blocks_probe_rate_0
|
- name: blocks_probe_rate_0
|
||||||
|
@ -157,6 +159,7 @@ blocks:
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
mintime: '2500'
|
mintime: '2500'
|
||||||
|
name: ''
|
||||||
type: complex
|
type: complex
|
||||||
vlen: '1'
|
vlen: '1'
|
||||||
states:
|
states:
|
||||||
|
@ -179,6 +182,30 @@ blocks:
|
||||||
coordinate: [440, 8.0]
|
coordinate: [440, 8.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: true
|
state: true
|
||||||
|
- name: low_pass_filter_0
|
||||||
|
id: low_pass_filter
|
||||||
|
parameters:
|
||||||
|
affinity: ''
|
||||||
|
alias: ''
|
||||||
|
beta: '6.76'
|
||||||
|
comment: ''
|
||||||
|
cutoff_freq: samp_rate / 8
|
||||||
|
decim: '4'
|
||||||
|
gain: '1'
|
||||||
|
interp: '1'
|
||||||
|
maxoutbuf: '0'
|
||||||
|
minoutbuf: '0'
|
||||||
|
samp_rate: samp_rate
|
||||||
|
type: fir_filter_fff
|
||||||
|
width: samp_rate / 8
|
||||||
|
win: window.WIN_HAMMING
|
||||||
|
states:
|
||||||
|
bus_sink: false
|
||||||
|
bus_source: false
|
||||||
|
bus_structure: null
|
||||||
|
coordinate: [992, 284.0]
|
||||||
|
rotation: 0
|
||||||
|
state: enabled
|
||||||
- name: network_tcp_source_0
|
- name: network_tcp_source_0
|
||||||
id: network_tcp_source
|
id: network_tcp_source
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -293,7 +320,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [704, 192.0]
|
coordinate: [704, 208.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: true
|
state: true
|
||||||
- name: qtgui_time_sink_x_0_0
|
- name: qtgui_time_sink_x_0_0
|
||||||
|
@ -351,8 +378,8 @@ blocks:
|
||||||
marker9: '-1'
|
marker9: '-1'
|
||||||
name: '"FM Demodulation"'
|
name: '"FM Demodulation"'
|
||||||
nconnections: '1'
|
nconnections: '1'
|
||||||
size: int(samp_rate // 30)
|
size: '512'
|
||||||
srate: samp_rate
|
srate: samp_rate // (2 ** 3)
|
||||||
stemplot: 'False'
|
stemplot: 'False'
|
||||||
style1: '1'
|
style1: '1'
|
||||||
style10: '1'
|
style10: '1'
|
||||||
|
@ -390,7 +417,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [992, 272.0]
|
coordinate: [1192, 312.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: true
|
state: true
|
||||||
- name: qtgui_waterfall_sink_x_0_0
|
- name: qtgui_waterfall_sink_x_0_0
|
||||||
|
@ -451,7 +478,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [704, 88.0]
|
coordinate: [704, 104.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: true
|
state: true
|
||||||
- name: qtgui_waterfall_sink_x_0_0_0
|
- name: qtgui_waterfall_sink_x_0_0_0
|
||||||
|
@ -573,12 +600,12 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [992, 168.0]
|
coordinate: [992, 184.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: true
|
state: true
|
||||||
|
|
||||||
connections:
|
connections:
|
||||||
- [analog_quadrature_demod_cf_0, '0', qtgui_time_sink_x_0_0, '0']
|
- [analog_quadrature_demod_cf_0, '0', low_pass_filter_0, '0']
|
||||||
- [analog_quadrature_demod_cf_0, '0', qtgui_waterfall_sink_x_0_0_0_0, '0']
|
- [analog_quadrature_demod_cf_0, '0', qtgui_waterfall_sink_x_0_0_0_0, '0']
|
||||||
- [analog_wfm_rcv_pll_0, '0', audio_sink_0, '0']
|
- [analog_wfm_rcv_pll_0, '0', audio_sink_0, '0']
|
||||||
- [analog_wfm_rcv_pll_0, '0', qtgui_waterfall_sink_x_0_0_0, '0']
|
- [analog_wfm_rcv_pll_0, '0', qtgui_waterfall_sink_x_0_0_0, '0']
|
||||||
|
@ -590,8 +617,9 @@ connections:
|
||||||
- [blocks_interleaved_short_to_complex_0, '0', qtgui_time_sink_x_0, '0']
|
- [blocks_interleaved_short_to_complex_0, '0', qtgui_time_sink_x_0, '0']
|
||||||
- [blocks_interleaved_short_to_complex_0, '0', qtgui_waterfall_sink_x_0_0, '0']
|
- [blocks_interleaved_short_to_complex_0, '0', qtgui_waterfall_sink_x_0_0, '0']
|
||||||
- [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
|
- [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
|
||||||
|
- [low_pass_filter_0, '0', qtgui_time_sink_x_0_0, '0']
|
||||||
- [network_tcp_source_0, '0', blocks_interleaved_short_to_complex_0, '0']
|
- [network_tcp_source_0, '0', blocks_interleaved_short_to_complex_0, '0']
|
||||||
|
|
||||||
metadata:
|
metadata:
|
||||||
file_format: 1
|
file_format: 1
|
||||||
grc_version: 3.10.6.0
|
grc_version: 3.10.9.2
|
||||||
|
|
37
src/main.c
37
src/main.c
|
@ -45,7 +45,6 @@
|
||||||
#define DECIMATION_BITS 3
|
#define DECIMATION_BITS 3
|
||||||
#define LPF_ORDER 4
|
#define LPF_ORDER 4
|
||||||
#define AGC_DECAY_BITS 20
|
#define AGC_DECAY_BITS 20
|
||||||
#define BIAS_STRENGTH 0
|
|
||||||
#define LO_DITHER 0
|
#define LO_DITHER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -57,7 +56,6 @@
|
||||||
#define DECIMATION_BITS 6
|
#define DECIMATION_BITS 6
|
||||||
#define LPF_ORDER 4
|
#define LPF_ORDER 4
|
||||||
#define AGC_DECAY_BITS 16
|
#define AGC_DECAY_BITS 16
|
||||||
#define BIAS_STRENGTH 3
|
|
||||||
#define LO_DITHER 1
|
#define LO_DITHER 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -67,7 +65,6 @@
|
||||||
|
|
||||||
static_assert(RX_SLEEP_US > 0, "RX_SLEEP_US must be positive");
|
static_assert(RX_SLEEP_US > 0, "RX_SLEEP_US must be positive");
|
||||||
static_assert(LPF_ORDER <= 4, "LPF_ORDER must be 0-4");
|
static_assert(LPF_ORDER <= 4, "LPF_ORDER must be 0-4");
|
||||||
static_assert(BIAS_STRENGTH >= 0 && BIAS_STRENGTH <= 9, "BIAS_STRENGTH must be 0-9");
|
|
||||||
|
|
||||||
#define XOR_ADDR 0x1000
|
#define XOR_ADDR 0x1000
|
||||||
#define LO_COS_ACCUMULATOR (&pio1->sm[2].pinctrl)
|
#define LO_COS_ACCUMULATOR (&pio1->sm[2].pinctrl)
|
||||||
|
@ -129,33 +126,12 @@ static void bias_init(int in_pin, int out_pin)
|
||||||
|
|
||||||
const uint16_t insn[] = {
|
const uint16_t insn[] = {
|
||||||
pio_encode_mov_not(pio_pins, pio_pins) | pio_encode_sideset(1, 1),
|
pio_encode_mov_not(pio_pins, pio_pins) | pio_encode_sideset(1, 1),
|
||||||
|
pio_encode_set(pio_x, 4) | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
||||||
|
pio_encode_jmp_x_dec(2) | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
||||||
|
|
||||||
pio_encode_mov_not(pio_pins, pio_pins) | pio_encode_sideset(1, 1),
|
pio_encode_mov_not(pio_pins, pio_pins) | pio_encode_sideset(1, 1),
|
||||||
|
pio_encode_set(pio_x, 4) | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(0), /* 1 */
|
pio_encode_jmp_x_dec(5) | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(0), /* 2 */
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(1), /* 4 */
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(3), /* 8 */
|
|
||||||
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(7), /* 16 */
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15), /* 32 */
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15), /* 48 */
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15), /* 64 */
|
|
||||||
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_nop() | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
|
|
||||||
pio_encode_set(pio_x, 7) | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
pio_encode_jmp_x_dec(21) | pio_encode_sideset(1, 0) | pio_encode_delay(15),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pio_program_t prog = {
|
pio_program_t prog = {
|
||||||
|
@ -178,8 +154,7 @@ static void bias_init(int in_pin, int out_pin)
|
||||||
sm_config_set_out_pins(&pc, out_pin, 1);
|
sm_config_set_out_pins(&pc, out_pin, 1);
|
||||||
sm_config_set_set_pins(&pc, out_pin, 1);
|
sm_config_set_set_pins(&pc, out_pin, 1);
|
||||||
|
|
||||||
int nops[10] = { 20, 12, 8, 6, 5, 4, 3, 2, 1, 0 };
|
sm_config_set_wrap(&pc, prog.origin, prog.origin + prog.length - 1);
|
||||||
sm_config_set_wrap(&pc, prog.origin, prog.origin + 1 + nops[BIAS_STRENGTH]);
|
|
||||||
|
|
||||||
sm_config_set_clkdiv_int_frac(&pc, 1, 0);
|
sm_config_set_clkdiv_int_frac(&pc, 1, 0);
|
||||||
pio_sm_init(pio1, 0, prog.origin, &pc);
|
pio_sm_init(pio1, 0, prog.origin, &pc);
|
||||||
|
|
Loading…
Reference in a new issue