hi guys,
i am working on a student bachelor thesis where i should implement a BTC
from matlab to the SHARC ADSP-21369 EZ-Kit to edit parameters for a
simple 3-band-EQ during the board's runtime.
i have now a class in matlab including the methods for accessing,
writing and reading the BTC and i have initialized the channels in
VisualDSP++ like shown in the getting started example.
now i have the following problem:
i will transmit filter coefficients für a biquad filter, so the
numerator-coefficients are 3x1 cell array, the denominator-coeffs 2x1
cell array
if i try to send these values through the BTC, the BTC memory window
shows me, that only one single coefficient of the array is edited, the
others get 0. a very interesting point is, that in the 3x1 cell array
the 2nd coefficient is edited, the first and the third get zero.
has anyone an idea how to fix this? i would need quite a quick solution,
because i have to presentate my project on monday.
here is the code ob my accessBTC.m
1 | classdef accessBTC < handle
|
2 |
|
3 |
|
4 |
|
5 | properties
|
6 |
|
7 | numChannels = [];
|
8 |
|
9 | isInitialized = 0; %Logical 0 or 1 to indicate if the class is instantiated to connect to the VisualDSP session
|
10 |
|
11 | end
|
12 |
|
13 |
|
14 |
|
15 | properties(SetAccess = private)
|
16 |
|
17 | channelList = {}; % Array of channel objects
|
18 |
|
19 | end
|
20 |
|
21 |
|
22 |
|
23 | methods
|
24 |
|
25 |
|
26 |
|
27 | function initialize(obj)
|
28 |
|
29 | a = actxserver('VisualDSP.ADspApplication');
|
30 |
|
31 | btcPlugin = a.PluginList.invoke('Item','BtcManager');
|
32 |
|
33 | btcManager = btcPlugin.Open;
|
34 |
|
35 | btcChannelList = btcManager.ChannelList(int16(0)); % Get the channel list in processor #0 (always INT16)
|
36 |
|
37 | obj.numChannels = btcChannelList.Count;
|
38 |
|
39 | disp(['Total Number of Channels: ', num2str(obj.numChannels)]);
|
40 |
|
41 | % Create the BTC Channel interfaces
|
42 |
|
43 | for i = 1: obj.numChannels
|
44 |
|
45 | obj.channelList{i} = btcChannelList.invoke('Item',int32(i-1));
|
46 |
|
47 | end
|
48 |
|
49 | obj.isInitialized = 1;
|
50 |
|
51 | % S=saveobj(obj);
|
52 |
|
53 | end % End of Method: INITIALIZE
|
54 |
|
55 |
|
56 |
|
57 | function outVal = read(obj,channelNum,width)
|
58 |
|
59 | % Default width is 32; other possible values: 16, 8
|
60 |
|
61 | % Channel num starts frm 0
|
62 |
|
63 | if nargin ==2
|
64 |
|
65 | width = 32;
|
66 |
|
67 | end
|
68 |
|
69 | widthStr = ['btcWidth',num2str(width)];
|
70 |
|
71 | btcChan = obj.channelList{channelNum};
|
72 |
|
73 | out_val = btcChan.Read(widthStr);
|
74 |
|
75 | outVal = cell2mat(out_val);
|
76 |
|
77 | end % End of Method: READ
|
78 |
|
79 |
|
80 |
|
81 | function write(obj, channelNum, val)
|
82 |
|
83 | % input val needs to be a scalar or a vector of int32 or in16 or
|
84 |
|
85 | % int8 values
|
86 |
|
87 | % Channel num starts frm 0
|
88 |
|
89 | if nargin ~=3
|
90 |
|
91 | error('WRITE method for accessBTC object needs 2 inputs.')
|
92 |
|
93 | end
|
94 |
|
95 |
|
96 |
|
97 | btcChan = obj.channelList{channelNum+1};
|
98 |
|
99 | btcChan.Write('btcWidth32',num2cell(val));
|
100 |
|
101 | end %End of Method: WRITE
|
102 |
|
103 |
|
104 |
|
105 | function reset(obj)
|
106 |
|
107 | obj.numChannels = [];
|
108 |
|
109 | obj.isInitialized = 0;
|
110 |
|
111 | obj.channelList = [];
|
112 |
|
113 | end %End of Method: RESET
|
114 |
|
115 |
|
116 |
|
117 | end
|
so if i sending for example these single arrays
1 | num_1 = [1.324; -1.45; 0.83]
|
2 | den_1 = [-1.45; 0.74]
|
i am getting in my BTC memory window as floating point
1 | num_1 = [0.0000000; -1.45; 0.0000000]
|
2 | den_1 = [-1.45; 0.0000000]
|
has anybody an idea how to fix this?
thanks a lot and best regards,
markus