Main Site Documentation

FEZ Hydra and I2C PCF8574


#1

Hi,

Does somebody successfully used socket 5 on FEZ Hydra to connect with the I2C IO Expander PCF8574AP from NXP.

The chip is on my breadborad with the folowing Pinout

FEZ Hydra Socket 5 PCF8574AP
pin 2 pin 16
pin 8 pin 15
pin 9 pin 14
pin 10 pin 8

Nothing more, nothing less. Just these 4 pins connected together, no additionnal component.

If you look at the following document, you will see that the 7 bit address should be 0x38
http://www.nxp.com/documents/data_sheet/PCF8574.pdf

I’m starting with “clean” new FEZ Hydra Gadgeteer project, and I write the following code. I run it and unfortunately, no pin came to 0V as espected :frowning:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
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.Seeed;
using GTI = Gadgeteer.Interfaces;

namespace HyperionGadgeteer
{
public partial class Program
{

    GTI.I2CBus MyI2C;

    // This method is run when the mainboard is powered up or reset.   
    void ProgramStarted()
    {
        // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
        Debug.Print("Program Started");
        
        ushort PHILLIPS_PFC8574A_ADDRESS = 0x38;
        int PHILLIPS_PFC8574A_CLOCK_IN_kHz = 100;
        GT.Socket socket = GT.Socket.GetSocket(5, true, null, null);
        MyI2C = new GTI.I2CBus(socket, PHILLIPS_PFC8574A_ADDRESS, PHILLIPS_PFC8574A_CLOCK_IN_kHz, null);

        byte[] ByteToWrite = new byte[1] { 0x00 };
        
        MyI2C.Write(ByteToWrite, 1000);

    }

}

}


#2

Hummmm,

I think I2C is bugged on hydra…

http://www.tinyclr.com/forum/21/5747/

http://www.tinyclr.com/forum/21/5783/

Except if someone has already successfully connected a PCF8574 to his FEZ Hydra, I will try it later with the next SDK.


#3

I2C is fixed already on the SDK found under beta forum.


#4

Tried the new firmware. Still no success. The “I2C - EEPROM” tutorial always return success. With any device address.


#5

Sure but it should work. We have it tested with many devices.


#6

How can I get more information on error? With try catch?


#7

I didn’t understand your question. I2C is tested to work on latest release with multiple devices. If you are seeing a problem, please provide a scope trace, details, more info on the problem. The driver may not report an error when using an invalid address but this doesn’t indicate it is not working.

Please use a scope to verify your connections.


#8

I don’t have scope yet, but is it normal to have 3.2 V on SDA if I transmit nothing? It should not be 0 or 5V?


#9

Yes normal


#10

it was a code 21. 21 inch from screen :o

It is mandatory to put the chip address pins to ground. I let them floating. Newbie mistake.

Thanks to Dave for is 4X4 KEYPAD VIA PCF8574AP PORT EXTENDER

http://code.tinyclr.com/project/265/4x4-keypad-via-pcf8574ap-port-extender/

Thank you Gus for your patience.