Code can be found here.
Testing it with a 10kHz (0-1V) sine gives the following
and with a 10kHz (0-1V) sine:
Not satisfactory.
Code can be found here.
RCC_ADCPRE_PCLK_DIV_2 can replace ADC_PRE_PCLK2_DIV_2 .. or so it seems
Question is found on github:
I'm trying to see how fast the Feather WICED ADC can go. I've been trying with analogRead()
, and at first sight, I'm getting data at around 50ksps. Will be posting the raw data later on to support this.
Now, I've begun digging into the maple ADC and corresponding code, and I've put together a piece of code to test acquisition speed. This code compiles nicely, but doesn't work (nothing on serial). I'm unsure of the reason behind this, and I guess some registers need to be finetuned.
For example, the enumeration for STM32F1 differs from STM32F2, as said by leaflab. However, using ADC_SMPR_1_5
during compilation works, but not the actual ADC_SMPR_3
.
Working on this at the moment, but would appreciate if you had some ideas on what I could do next, I'll be updating/documenting the issue in the same time.
But removing all references to the second ADC (and so .. to the third as well), the code works.
Interfacing the feather to a i2c 128x64 oled display, I can see that it takes around 990 us to get 1000 samples. That's a bit more than 1Msps - and it should be enough to get a signal coming from the emulator.
Moreover, with this working, we can see that the input signal coming from 0 to 3.3V gives 0 to 4095.. as expected. Since the output of Goblin is up to 3.3V, it means I can connect goblin's output to this one, and try to trig on the same trigger as the emulator as well. Will need a level shifter.
Been putting the trig on the 5V trigger from the pulser. Works better.
Also doing some averaging.. need to check if it really works.
Anyhow, the code works.
It seems like for 2048 points buffer, only 4 full periods of the pulser are present. This pulser working at 300us intervals, this would put the acquisition at 1.7Msps. Need to check what is really the speed of this acquisition.
Seeing echoes as well from a real transducer =)
The code is here ADC2UDP-Cleaning.ino.
I got 24x128 points (data is here, decimated 128 times: and I see 22.2 decimated points for a period of 300us.
Thats 533 points per period. Since it's a 300us period, the overall acquisition speed is close to 1.776Msps at 12 bits, using only one ADC.
Getting an image with Silent and Goblin
Silent is the emulating module, which emulates a ultrasound piezo. It's output before Goblin, the analog processing module, is as follows:
and after
The data was acquired with Croaker through the UDP streaming option. Lines are 128 points long (hence 72us long), and the value is coded over 12 bits, from 0-4095, corresponding to 0-3.3V. Data is here
Comparing with the source signal, it seems that we are late on acquisition: the trigger took some time.
Peaks on the 3 smaller peaks afterwards are on points 82, 88 and 95. That's 6.5 points on average between each, or 3.66 us between each peak. In the config of Silent, we see that each is separated by roughly 7 us. That would mean the ADC speed varies. Needs to be explored.
New acquisition is as follows:
The peaks get better resolved. Data is here -and Arduino code is here. Roughly doubling the sampling rate.
- Video of the setup, showing the OLED screen showcasing the signal : https://www.youtube.com/watch?v=iyfDMsgAquI