hotz
New Member
Posts: 28
|
Post by hotz on Mar 28, 2017 9:51:51 GMT
I have received 4 Boards now from 2 different shipments and they all have the same problem. Analog Inputs A4 & A5 have 5V(4.84V). on brand new boards. Even after programming the boards to Analog Reads on all of the Analog Inputs and making sure that the pinMode is set to INPUT on all of the Analog Inputs A4 & A5 still have 5V(4.84V).
Any help with this matter would be greatly appreciated as I need all of the Analog Inputs for our current project, which will make use of many Shieldbuddy's if we can get them to work properly.
Thank You!
|
|
|
Post by Admin on Mar 28, 2017 9:58:21 GMT
Hi, I think I know what is causing this - I will check!
|
|
|
Post by Admin on Mar 28, 2017 11:21:28 GMT
If the analog signal applied to AD4/5/12/13/14/15 has a high source impedance, the pull-up applied by the secondary port pins connected to these pins will cause a high reading. To fix this, the pull-ups need to be disconnected before the channels are first read using:
// Make sure secondary pins do not apply a pull-up resistor to analog input IfxPort_setPinMode(&MODULE_P10, 7, IfxPort_Mode_inputNoPullDevice); // AD4 SAR3.0 / P10.7 IfxPort_setPinMode(&MODULE_P10, 8, IfxPort_Mode_inputNoPullDevice); // AD5 SAR3.1 / P10.8 IfxPort_setPinMode(&MODULE_P20, 8, IfxPort_Mode_inputNoPullDevice); // AD15 SAR5.7 / P20.8 / CAN0 TX IfxPort_setPinMode(&MODULE_P20, 7, IfxPort_Mode_inputNoPullDevice); // AD14 SAR5.6 / P20.7 / CAN0 RX IfxPort_setPinMode(&MODULE_P33, 11, IfxPort_Mode_inputNoPullDevice); // AD13 SAR5.5 / P33.11 IfxPort_setPinMode(&MODULE_P20, 9, IfxPort_Mode_inputNoPullDevice); // AD12 SAR5.4 / P20.9 / P33.10 IfxPort_setPinMode(&MODULE_P33, 10, IfxPort_Mode_inputNoPullDevice); // AD12 SAR5.4 / P20.9 / P33.10
We will incorporate this as a default in the next release.
|
|
hotz
New Member
Posts: 28
|
Post by hotz on Mar 30, 2017 1:11:39 GMT
That did bring the Voltage down on Analog Inputs A4 & A5 - Thank You! I am reading all of the Analog Inputs and get some random spikes that cause the inputs to trigger on and off more often than they should. Would it be beneficial to set all of the Analog Pins in a similar fashion to what you have done above?
|
|
|
Post by Admin on Mar 30, 2017 5:51:40 GMT
At what sample rate are you reading each analog channel?
|
|
hotz
New Member
Posts: 28
|
Post by hotz on Mar 30, 2017 12:28:28 GMT
We are reading a Matrix of 200 sensors (20 x 10) and the loop takes around 2 milliseconds.
|
|
|
Post by Admin on Mar 30, 2017 12:40:56 GMT
How many bits of resolution?
|
|
hotz
New Member
Posts: 28
|
Post by hotz on Mar 30, 2017 14:44:01 GMT
8 bit
|
|
|
Post by mjb on Mar 30, 2017 19:09:27 GMT
Depending on your hardware design you could try connecting the analog ground of the sensors directly to the analog ground of the ShieldBuddy. There is a pad marked "AGND" between the processor and the analog inputs. If you can solder a wire to the sensor ground onto this you may find that the stability of the analog readings improves. We have found that when the USB is connected to the board, the analog readings become noisier.
Another approach is to sample each channel say 3 times and take the average of the results. If you can afford to make the cycle time for all 200 sensors increase to around 6ms, this might work.
|
|
hotz
New Member
Posts: 28
|
Post by hotz on Mar 30, 2017 20:55:38 GMT
Thank you for your comments. However, these sensors have no ground, they are Force Sensing Resistors. 5V is fed to one side of the traces and the output voltage comes from the other traces. These work fine with an Arduino Due and Mega. Our main interest in the ShieldBuddy was to increase the speed of the unit, so multiple sampling is not really an option for our purpose. It seems that the ShieldBuddy behaves differently than the Due or Mega in how we are using it. I have spent a great deal of time trying all kinds of hacks to get the same consistent response we get from an Arduino Due. I wonder if something has to be set different with the ShieldBuddy.
We are feeding the Matrix with 5V sequentially from the Digital pins 22 through 42, to the Columns of the Matrix and reading the Output of the Rows on Analog Inputs 0 through 9.
|
|
|
Post by Admin on Mar 30, 2017 21:09:31 GMT
The Aurix ADC can be adjusted for different hardware environments and yours might need need this. Do you have a spec for the sensors?
|
|
hotz
New Member
Posts: 28
|
Post by hotz on Mar 30, 2017 21:41:33 GMT
It is effectively a variable resistor that goes from near infinite resistance to around 2.5K when full pressure is applied. For 5V systems, 5V is fed to one side and the output from the other side is fed to the Analog input. The Analog input will also typically have any where from a 10K to 100k resistor to Ground depending on the overall design. I have tried a variety of resistor values from the Analog input to Ground with the Shieldbuddy and that does not seem to affect the current problem. Without a load resistor to Ground, the Analog inputs have too much crosstalk and noise. This is true for all of the Arduinos.
|
|
|
Post by Admin on Mar 31, 2017 12:25:35 GMT
Please add this code before the first use of the ADC:
VADC_G5ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G4ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G3ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G2ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G0ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time
This will considerably reduce the variation in readings when the analog signal has a high source impedance.
|
|
|
Post by Admin on Mar 31, 2017 14:44:11 GMT
Have you tried putting something like a 1nF capacitor across each ADC input? This can make a huge difference to the stability of ADC readings.
|
|
hotz
New Member
Posts: 28
|
Post by hotz on Apr 1, 2017 18:37:41 GMT
Please add this code before the first use of the ADC: VADC_G5ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G4ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G3ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G2ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time VADC_G0ICLASS0.U = (VADC_8BitConversion <<8) | 0x01; // One extra Fadci cycle sample time This will considerably reduce the variation in readings when the analog signal has a high source impedance. After running a number of tests at all of the various bit rates, it appears, at least with all of the code I tried on the ShieldBuddy, that 10-bit is the most consistent by a long shot. All of the other bit rates had occasional random values, which varied greatly from the reading before and after the random value This has been verified with a consistent variable voltage source. These tests were done without the above code. What would be the proper settings of the above code for 10-bit and where would I find the documentation on the use of that code? I am currently using analogReadResolution(10); to set the ADC to 10-bit.
|
|