The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
Hello,
I need to use gpio pins as analog inputs as follows:
using AnalogInput_SecretLabs = SecretLabs.NETMF.Hardware.AnalogInput;
AnalogInput_SecretLabs input1 = new AnalogInput_SecretLabs(Pins.GPIO_PIN_D2);
Pins D2, D3, D7, D8, D9 should be able to be used as analog inputs but at running time a System.ArgumentException is thrown.
Can pins D2, D3, D7, D8, D9 used as analog inputs ? If yes, how should the code be written ?
Hi tomabecea,
The NETMF STM32 core only recognizes the 6 analog channels, but if you wanted to tweak the firmware you could access the analog feature of additional pins.
Chris
It would be a bad solution to mutliplex or use external shield while STM32 core has already powerful capabilities.
mhzpower:
I'm afraid I'm not sure what your first phrase means, my english is not that good. If I correctly understood your question, yes, my inputs needs as much Samples/sec as it is possible. Currently we use 1kS/sec per channel but with other devices.
Chris Walker:
The STM32 core is capable to use more than those 6 analog pins. So I'm heading toward some tweaking, though I'm still confused about how this can be done. For example I start to look what IDE and C libraries STM offers.
If you have any clues or ideas which you can share with us about tweaking firmware, please let us know.
It would be great to combine ethernet with 8 analog inputs
Hi tomabacea,
The code for STM32 ADCs in NETMF is located in:
C:MicroFrameworkPK_v4_3DeviceCodeTargetsNativeSTM32DeviceCodeSTM32_AnalogSTM32_AD_functions.cpp
It's set up to use a series of sequential pins...but you could change STM32_AD_CHANNELS to a greater number of pins and modify AD_GetPinForChannel to return the related pins you want to use.
Chris
Sorry, I was meaning Mux Shield by Mayhew Labs. I have this shield so I am curious what others think.
I'm just getting started with ND2+ so someone else might be able to comment on the maximum samples per second. And feel free to correct me if I'm wrong.
The fastest you could sample on the Mux Shield, would be reading 3 inputs at one time. The CD74HC4067 has a analog in rise time of 500ns, so that might limit your sampling to 2000 per second.
It would be a bad solution to mutliplex or use external shield while STM32 core has already powerful capabilities.
mhzpower:
I'm afraid I'm not sure what your first phrase means, my english is not that good. If I correctly understood your question, yes, my inputs needs as much Samples/sec as it is possible. Currently we use 1kS/sec per channel but with other devices.
Chris Walker:
The STM32 core is capable to use more than those 6 analog pins. So I'm heading toward some tweaking, though I'm still confused about how this can be done. For example I start to look what IDE and C libraries STM offers.
If you have any clues or ideas which you can share with us about tweaking firmware, please let us know.
It would be great to combine ethernet with 8 analog inputs
It absolutely would not be a bad idea to use external parts, regardless of the STM32's power! My projects use AD7714 24-bit ADCs. Each part gives you 5 pseudo-differential inputs, and since they're SPI, you can use as many parts as you want, provided you can wire into CS individually. I use a full 6-wire interface for my parts, which means that I would need 3 ports for each part, aside from the SPI. That means I could use 5 of these ADCs, giving me 25 channels, each with 24-bit resolution.
Another benefit of external ADCs is enhanced accuracy and, as Verdris noted, superior precision.
On-MCU ADCs are very convenient, but they are usually by nature less accurate and can't offer the amazing precision that off-board ADCs can bring to your project.
Chris
Of course there are more other viable solutions (I can extend your idea) and talk about my current solution (64 channels, 16 bits ADC, single ended, etc) which are more powerful than STM32. What I'm following is to see how much of its power I can squeeze of it with keeping the combination between efficiency, ease of programming and reduced costs because the project I'm working on it (gas chromatography) must be implemented in many equipments.
Of course there are more other viable solutions (I can extend your idea) and talk about my current solution (64 channels, 16 bits ADC, single ended, etc) which are more powerful than STM32. What I'm following is to see how much of its power I can squeeze of it with keeping the combination between efficiency, ease of programming and reduced costs because the project I'm working on it (gas chromatography) must be implemented in many equipments.
Thanks.
The neat thing about using multiple identical parts on the SPI bus is that your code can be crafted to make things easy. For example, I have a function that gets a reading from a specified channel. It's overloaded, so I can either get a single or integrated reading, I can set the PGA, and I can choose between fully differential or pseudodifferential sensors, all with a single function call. If I wanted to grab a 30-reading integration of channel 19 with gain of 8 and it's a pseudodifferential sensor, I can just call ReadChannel(19,30,false,8); and I'm done.