Chipworkx Analogue pin exception

Greetings all,

I am seeking some guidense. I am testing a 3 Axis accelerometer breakout board ( http://www.freescale.com/files/sensors/doc/data_sheet/MMA7260QT.pdf ) . How I am understand it is (I maybe be wrong) that the X-Axis, Y-Axis and Z-Axis are analogue.

I have tried to connect them to Pins AnalogIn.Pin.Ain0 , AnalogIn.Pin.Ain1 , AnalogIn.Pin.Ain2 (xbee pins available on SV1) . But keep getting

An unhandled exception of type ‘System.NotSupportedException’ occurred in GHIElectronics.NETMF.Hardware.dll

Where am i going wrong?

Hardware:
Chipwork version 4.1.8.0
Tinyboot version 4.1.6.0

Here is my short code before that i get the exception:


using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.IO;

using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.System;

using Diagnose.Debug;


namespace InternalSensors
{
    public class Accelerometer3Axis : InternalSensorsBase
    {

        #region Pins

        private AnalogIn Xaxis;
        private AnalogIn Yaxis;
        private AnalogIn Zaxis;
        private OutputPort CS1Select;
        private OutputPort CS2Select;

        #endregion

        /// <summary>
        /// Initialise
        /// </summary>
        public Accelerometer3Axis()
        {
            Xaxis = new AnalogIn(AnalogIn.Pin.Ain0);  // Exception here
            Yaxis = new AnalogIn(AnalogIn.Pin.Ain1);  // Exception here
            Zaxis = new AnalogIn(AnalogIn.Pin.Ain2);  // Exception here

            // 1.5g = CS1 false CS2 false
            // 2g =   CS1 true  CS2 false
            // 4g =   CS1 false CS2 true
            // 6g =   CS1 true  CS2 true
            CS1Select = new OutputPort(AccelerometerAssignedPins.GS1, false);
            CS2Select = new OutputPort(AccelerometerAssignedPins.GS2, false);
        

        }

        public void Run()
        {
            while (true)
            {
               Thread.Sleep(500);
            }
        }

        /// <summary>
        /// Dispose/release pins
        /// </summary>
        public override void Dispose()
        {
            Xaxis.Dispose();
            Yaxis.Dispose();
            Zaxis.Dispose();
            CS1Select.Dispose();
            CS2Select.Dispose();
        }
    }
}



Many Thanks

hi @ Londongeek, welcome to the forum.

I don’t have a CwX device, but I suspect that the AnalogIn.Pin.xxx enums aren’t mapped to anything on CwX; have you tried using something like:

(AnalogIn.Pin)ChipworkX.Pin.PA0

Welcome to the forum.

By the way ChipworkX DevSys has its own accelerometer. Also be careful since ChipworkX IOs are 3V3.

Hi Brett,
Many thanks. I have tried the coverting (AnalogIn.Pin)ChipworkX.Pin.PA0 and my chipworkx screen goes white and my pc (windows) thinks it has a new device plugged in and tries to install the driver lol . I tried another pin and still get the same exception error.

Hi Architect,

Thanks, yes this sensor runs 3.3v so one is safe there lol . Yes, i did use the chipworks 3D acc a while back. But i want to try this bad boy out for a project I’m working on.

pa0 was just an example, you’d need to find the correct pins…

can you confirm the SDK version you have installed (from the installation notes) and it matches the firmware version on your board? That might show some valuable info?

NETMF SDK for NETMF v4.1 - Chipworkx version 4.1.8.0
SDK Version 1.0.19 .

Is it possible to map the AD0 pins?

ChipworkX doesn’t have Analog In. Well that’s what I deduce from looking at the documentation about the CwX module and the CwX DevSys.

I think the Analog Input pins that are marked on that are for the xbee module itself - then the CwX would leverage the xbee reading the analog in and reporting back over uart.

There don’t seem to be any Analog pins discussed http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation%20v4.1/html/5b69f030-bb87-cbff-e913-d2ba2bd6ae56.htm but the same can be said for USBizi and EMX, so that’s not conclusive.

There are no analog pins on Chipworkx.

Yep, schematic shows they’re xbee links only

Edit: Gus beat me to it…

Thanks Brett and Gus.

Might have to invest a I2C Accelerometer!!

I dont know why i taught chipworkx had analogue!!

Thanks again guys.