analogdevicesinc / ad936x-filter-wizard

MATLAB-based FIR filter design
Other
51 stars 40 forks source link

Tap count mismatch #28

Open tfcollins opened 6 years ago

tfcollins commented 6 years ago

When creating filter files (.ftr) the saved file will only output the number of taps of the present chain selected (TX or RX). For example, if the RX channel is selected and the TX is already designed, and TX has 96 taps and RX has 80 taps, 80 taps will be written to the .ftr file.

kylex2 commented 2 years ago

This breaks exporting to file. Everything in this comment has been generated with latest master as of today (924f0cd) and MATLAB 9.11.0.1837725 (R2021b) Update 2. Here is an example where according to me none of the files are correct:

0 5-1M_Rx_parameters 0 5-1M_Tx_parameters

Case 1, design Rx filter first and Tx second, issue here is that Rx number of taps is set to 128 but actual number is 112. Resulting output:

// Generated with AD9361 Filter Design Wizard 16.1.3
// MATLAB 9.11.0.1837725 (R2021b) Update 2, 15-Feb-2022 12:30:05
// Inputs:
// Data Sample Frequency = 7680000 Hz

AD9361_RXFIRConfig rx_fir_config = {
    3, // rx
    -12, // rx_gain
    2, // rx_dec
    {12,438,-712,1139,-794,990,-439,740,-215,516,-166,262,-272,-43,-482,-360,-702,-597,-806,-638,-675,-390,-247,157,434,892,1193,1578,1752,1908,1806,1611,1143,565,-238,-1093,-2054,-2936,-3749,-4310,-4609,-4492,-3959,-2909,-1383,648,3088,5892,8911,12041,15104,17969,20467,22477,23879,24603,24603,23879,22477,20467,17969,15104,12041,8911,5892,3088,648,-1383,-2909,-3959,-4492,-4609,-4310,-3749,-2936,-2054,-1093,-238,565,1143,1611,1806,1908,1752,1578,1193,892,434,157,-247,-390,-675,-638,-806,-597,-702,-360,-482,-43,-272,262,-166,516,-215,740,-439,990,-794,1139,-712,438,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // rx_coef[128]
    128, // rx_coef_size
    {983040000,122880000,61440000,30720000,15360000,7680000}, // rx_path_clks[6]
    2012001 // rx_bandwidth
};

AD9361_TXFIRConfig tx_fir_config = {
    3, // tx
    -6, // tx_gain
    2, // tx_int
    {0,0,0,0,0,0,0,0,168,-208,347,-172,294,-62,226,-19,137,-62,-4,-190,-200,-378,-419,-564,-586,-659,-609,-568,-406,-232,45,326,671,982,1295,1517,1668,1669,1541,1228,767,138,-601,-1429,-2264,-3054,-3700,-4137,-4271,-4046,-3398,-2306,-755,1222,3583,6236,9087,12003,14855,17499,19805,21651,22940,23602,23602,22940,21651,19805,17499,14855,12003,9087,6236,3583,1222,-755,-2306,-3398,-4046,-4271,-4137,-3700,-3054,-2264,-1429,-601,138,767,1228,1541,1669,1668,1517,1295,982,671,326,45,-232,-406,-568,-609,-659,-586,-564,-419,-378,-200,-190,-4,-62,137,-19,226,-62,294,-172,347,-208,168,0,0,0,0,0,0,0,0}, // tx_coef[128]
    128, // tx_coef_size
    {983040000,122880000,61440000,30720000,15360000,7680000}, // tx_path_clks[6]
    2023254 // tx_bandwidth
};

Case 2, design Tx filter first and Rx second, issue here is that Tx number of taps is set to 112 but actual number is 128. Since it has 8 leading and ending zeros it could however be outputted as a filter of length 112. (I asked about this in #43). Result:

// Generated with AD9361 Filter Design Wizard 16.1.3
// MATLAB 9.11.0.1837725 (R2021b) Update 2, 15-Feb-2022 12:30:37
// Inputs:
// Data Sample Frequency = 7680000 Hz

AD9361_RXFIRConfig rx_fir_config = {
    3, // rx
    -12, // rx_gain
    2, // rx_dec
    {12,438,-712,1139,-794,990,-439,740,-215,516,-166,262,-272,-43,-482,-360,-702,-597,-806,-638,-675,-390,-247,157,434,892,1193,1578,1752,1908,1806,1611,1143,565,-238,-1093,-2054,-2936,-3749,-4310,-4609,-4492,-3959,-2909,-1383,648,3088,5892,8911,12041,15104,17969,20467,22477,23879,24603,24603,23879,22477,20467,17969,15104,12041,8911,5892,3088,648,-1383,-2909,-3959,-4492,-4609,-4310,-3749,-2936,-2054,-1093,-238,565,1143,1611,1806,1908,1752,1578,1193,892,434,157,-247,-390,-675,-638,-806,-597,-702,-360,-482,-43,-272,262,-166,516,-215,740,-439,990,-794,1139,-712,438,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // rx_coef[128]
    112, // rx_coef_size
    {983040000,122880000,61440000,30720000,15360000,7680000}, // rx_path_clks[6]
    2012001 // rx_bandwidth
};

AD9361_TXFIRConfig tx_fir_config = {
    3, // tx
    -6, // tx_gain
    2, // tx_int
    {0,0,0,0,0,0,0,0,168,-208,347,-172,294,-62,226,-19,137,-62,-4,-190,-200,-378,-419,-564,-586,-659,-609,-568,-406,-232,45,326,671,982,1295,1517,1668,1669,1541,1228,767,138,-601,-1429,-2264,-3054,-3700,-4137,-4271,-4046,-3398,-2306,-755,1222,3583,6236,9087,12003,14855,17499,19805,21651,22940,23602,23602,22940,21651,19805,17499,14855,12003,9087,6236,3583,1222,-755,-2306,-3398,-4046,-4271,-4137,-3700,-3054,-2264,-1429,-601,138,767,1228,1541,1669,1668,1517,1295,982,671,326,45,-232,-406,-568,-609,-659,-586,-564,-419,-378,-200,-190,-4,-62,137,-19,226,-62,294,-172,347,-208,168,0,0,0,0,0,0,0,0}, // tx_coef[128]
    112, // tx_coef_size
    {983040000,122880000,61440000,30720000,15360000,7680000}, // tx_path_clks[6]
    2023254 // tx_bandwidth
};