Problem: IO60P16-Module internal pullup problem

Hello,

i have the following code:


IO60P16.InputPort m_HeadPhonePin = new IO60P16.InputPort(IO60P16.IOPin.Port0_Pin1, IO60P16.ResistorMode.ResistivePullUp);
Debug.Print(m_HeadPhonePin.Read());

With a normal switch which close the connection on push it works without problems, but if the connection is closed on startup it prints always “false” and never “true”.

The switch is connected to GND and an io-pin.

Is there a workaround for this problem?

ok, I’ve found the problem.

If i initialte the IO-Port on startup in the first program-lines, it won’t work, but if i do the initiation later, it works.

Strange problem.

The IO60P16 is an I2C module. It sounds like you may be sending it commands before it gets done with its initialization.

I’ve got this problem again, but this time it doesn’t work to initiate the IO-Pin later.

Can someone confirm this problem?

I really need help in this.

Does someone has a Mountaineer Ethernet with NETMF 4.2(QEF2) Firmware and an IO60P16 Module who can comfirm this strange issue?

Meanwhile i have a new issue with this module.

I’ve pullup Port0_Pin7 and nothing connected to it. If i use Read() i get sometimes “True” and sometimes “False”.

If the pin is connected to GND over a switch at Startup, this pin works correct. What could be the reason for this?

Is the pullup resistor not strong enough?

[quote=“miugemelo”]I’ve pullup Port0_Pin7 and nothing connected to it. If i use Read() i get sometimes “True” and sometimes “False”.

If the pin is connected to GND over a switch at Startup, this pin works correct. What could be the reason for this?

Is the pullup resistor not strong enough?
[/quote]

This is the the SoftwareI2C problem that has plagued this module. The only solution is to switch over to hardware I2C (convert your “X” socket to an “I” socket).

How do i convert the “X” socket to an “I” socket? And what further things need to be done?

@ miugemelo -

Hello,
I tried this code on EMX and no problem found. Is it easy to reproduce? What version GHI.NET Gadgeteer SDK are you using? What device are you using?

using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace EMM_Test_IO60P16
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/
            

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            new Thread(ThreadTestRead).Start();

        }
        void ThreadTestRead()
        {
            IO60P16.InputPort m_HeadPhonePin = new IO60P16.InputPort(io60p16,IO60P16.IOPin.Port0_Pin7, IO60P16.ResistorMode.ResistivePullUp);
            while (true)
            {
                Debug.Print("Value " + m_HeadPhonePin.Read());
                Thread.Sleep(100);
            }
        }
    }
}

Hello Dat,

thank you for your answere.

I’m using SDK 1.6.10.0 and IO60P16 version 1.1.2.0.

I cannot find the download-link for the newer version on this page:

http://www.ghielectronics.com/support/.net-micro-framework

i think its this one

http://www.ghielectronics.com/download/ghi-software-package-v4.2-02142013

@ miugemelo -

Use the newest version and hope you will be happy :))

Ok, I’ll try and report :slight_smile:

It’s still the same.

If the pin is connected to ground on start up, it works. But if nothing is connected on start up, it gives me some true and some false values.

Another thing is, if i read all pins of port 0, it gives me strage values aswell, not matter, if one pin is connected to ground or not on startup.

The following code and nothing connected:


IO60P16.InputPort m_TempPin0 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin0, IO60P16.ResistorMode.ResistivePullUp);
IO60P16.InputPort m_TempPin1 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin1, IO60P16.ResistorMode.ResistivePullUp);
IO60P16.InputPort m_TempPin2 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin2, IO60P16.ResistorMode.ResistivePullUp);
IO60P16.InputPort m_TempPin3 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin3, IO60P16.ResistorMode.ResistivePullUp);
IO60P16.InputPort m_TempPin4 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin4, IO60P16.ResistorMode.ResistivePullUp);
IO60P16.InputPort m_TempPin5 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin5, IO60P16.ResistorMode.ResistivePullUp);
IO60P16.InputPort m_TempPin6 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin6, IO60P16.ResistorMode.ResistivePullUp);
IO60P16.InputPort m_TempPin7 = new IO60P16.InputPort(io60p16, IO60P16.IOPin.Port0_Pin7, IO60P16.ResistorMode.ResistivePullUp);

while(true)
{
                    Debug.Print("0: " + m_TempPin0.Read());
                    Debug.Print("1: " + m_TempPin1.Read());
                    Debug.Print("2: " + m_TempPin2.Read());
                    Debug.Print("3: " + m_TempPin3.Read());
                    Debug.Print("4: " + m_TempPin4.Read());
                    Debug.Print("5: " + m_TempPin5.Read());
                    Debug.Print("6: " + m_TempPin6.Read());   
                    Debug.Print("7: " + m_TempPin7.Read());  
                    Thread.Sleep(100);
}

Output:
0: True
1: True
3: False
4: True
5: False
6: True
7: True

0: True
1: True
3: True
4: True
5: False
6: True
7: True

0: True
1: True
3: False
4: True
5: False
6: True
7: True

0: True
1: True
3: False
4: True
5: True
6: True
7: True

0: True
1: True
3: True
4: True
5: True
6: True
7: True

0: True
1: True
3: True
4: True
5: False
6: True
7: True

0: True
1: True
3: False
4: True
5: True
6: True
7: True

0: True
1: True
3: True
4: True
5: False
6: True
7: True

@ miugemelo -

try to uninstall gadgeteer then reinstall again, then make a new project, please. It looks like the older one is still on your PC
Here is my test:

Does it work?

Dat, have you tried this on a Hydra & Cerberus? I believe what he’s seeing is what I’ve seen with this module on 4.2 every since it was released. It is not happy with SoftwareI2C and has always had a problem with inaccurate reads for me on 4.2.

EDIT:
Well, maybe not… I haven’t run that test since the last release. I just ran his code and it works perfect for me on the Cerberus. It looks like maybe the bug has been fixed. He said he’s using a Mountaineer board. Could it be that they need whatever fix you put on the GHI boards? The symptoms he describes look exactly like what I fought with for months. Thanks.

Yeah, thanks for your confirmation.

Everything we fixed that is in IO60P16 module driver. It was wrong register for reading state. Nothing wrong inside mainboard firmware.

Use lasted driver, some major issues were fixed (reading pin, PWM…).

It’s still not working. I have reinstalled the all GHI software and driver.

Is it maybe because i am using the Mountaineer with 4.2(QFE2) Firmware?
Are all GHI-Module assemblies compatible with the earlier version 4.2(QFE1)?

EDIT1:
I’ve downgraded my mountaineer to 4.2(QFE1) and I have also this issue with wrong readings.

EDIT2:
I’ve found out, that the last initialized pin is always working correctly. The others give random values, depending on how many pins were initialized.

I’ve tested the IO60P16 module with a FEZ Spider mainboard. It’s working without problems. So this must be a problem with the MountaineerEth firmware.

The mountaineer mainboard itself cannot be the problem, because the io-module problem can be reproduced with another mountaineer.

Is it possible to contact GHI directly about this problem? I need a fast solution for this.

Thank you. I’ve contacted both. Hope they can help me.