This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hello folks,
So, I'm working with a cc13x2 and would like to know what would be the fastest/less power hungry way of computing an integer average of an array of uint16_t with constant size
I'm asking that because this chip has DSP instructions with Parallel addition and subtraction (from here, page 114) and It would be nice to know if you guys know of some implementation that leverages the best from these instructions.
Cheers!
Hi,
We will look into it and get back to you ASAP. Please bear with us.
Thanks,
PM
Hello Leoni,
Does the data originate in the Sensor Controller RAM (i.e. collected from sensor controller)?
If the Sensor Controller calculate sum/average, will this reduce the amount of data that needs to be transferred to the CM4?
How large/big is the array?
Hello Eirik
-> Does the data originate in the Sensor Controller RAM (i.e. collected from sensor controller)?
Yes it does, it comes from an ADC in a sensor controller task.
Right now, I'm computing this average in the sensor controller itself by averaging intermediate sums.
but I'm afraid it adds a lot of overhead to the power consumption (my application needn't to be power hungry)
Cheers!
Hello Leoni,
Please review the Utilities : Accumulator-Based Math Module in Sensor Controller Studio:
You can utilize the accAdd16s() or accAdd16u() to add all the values to an 40 bit accumulator before you transfer the value to the MCU (M4) domain. If desired we can provide a new function that takes in an array pointer and length as arguments to accAdd16x(). Division by 97 is not favorable for optimized exectuion speed in the sensor controller.
Do you collect all the 97 samples before you want to compute the average? Or did you consider some form of rolling average?
Yes, so, that's what I've been using so far. It's not important at all this 97. This is just what I use as transmitting the packets through sug1.
What I do right now is:
accAdd16u() for 2^12 samples
after 2^12 samples : accGet16(12; average); (since this is equivalent to accumulator / (2 ^ 12))
That is what I've doing so far. But it has nothing special. I was kinda looking more into dsp instructions so it could be done more efficiently in hardware
Hello Leoni,
If you run one (1) accAdd16u() per ADC-sample then your solution is already optimal.
You don't try to collect 2^12 samples before you add to the accumulator?
Alright.
Yes, I accumulate 2^12 samples, compute the average by << 12 and then I clear the accumulator.
But I mean collect an array of 2^12 items that equals 4096 samples and is larger than the AUX RAM?
You add each sample to the accumulator and overwrite with the next?
Maybe I've made a bad job at expressing myself.
The goal is to have an estimation of the mean of the signal received by the adc. This mean is supposed to not change that much, it is just a dc level from another circuit. It can be rolling mean, it could be a long mean. It could be a number of things.
There's an array of 97 U16 samples inside the sensor controller where I store the samples. It is obviously NOT a constraint of project to use this array for computing the mean. This is just an array. It can be used for the mean or not.
I'm currently computing the mean by using the 40bit accumulator to accumulate 2^12 samples and then computing the mean with this accumulator. It is as I said in a few messages above:
So, my question was, are you guys aware of an another/smarter way of acquiring this dc level? I'm asking that because I saw dsp instructions on the datasheet and thought that it could be an option for computing a mean of a long signal in a faster way.
But again, this is not a constraint. Just something I saw in the datasheet and thought that if you guys had examples using those dsp instructions to compute the mean in a efficient manner.