Main Site Documentation

Assistance required with MCP4131 library


#1

Hi all, I need some help with the MCP4131 library that I downloaded from the code share here, i.e. https://www.ghielectronics.com/community/codeshare/entry/344

I’m using Hydra mainboard, so I changed the call to the constructor, instead of

MCP4131 myMCP4131 = new MCP4131((Cpu.Pin)FEZHydra_Pins.PB8, SPI.SPI_module.SPI1);

To->

 MCP4131 myMCP4131 = new MCP4131((Cpu.Pin)GHI.Hardware.FEZHydra.Pin.PB8, SPI.SPI_module.SPI1);

(Now it compiles…)

I created a new gadgeteer project and there a new class called MCP4131 and put there the implementation of the object.
At program.cs added the followning namespaces:

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 Microsoft.SPOT.Hardware;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GHIElectronics;
//using GHIElectronics.NETMF.FEZ; // for FEZ -----> commented because it didn't compile 
using GHI.Hardware.FEZHydra;
using GTM = Gadgeteer.Modules;

Using the extender I connected the MCP4131 to socket #3 (type S) on my Hydra board and the scheme is attached.

I’m running the program.cs (it compiles) but all I get is

i=128
Wiper REG: 0
Status REG: 0
TCON: 0
i=127
Wiper REG: 0
Status REG: 0
TCON: 0

In other words just zeros.
I’m not sure what is wrong and I have no idea how to debug it.
Any help would be useful, I will be grateful until the end of my life =)


#2

where’s the pictures and screenshots ? :slight_smile:

If I was going to troubleshoot this I’d first try to confirm if I have SPI pins connected correctly. Do you have another SPI device, or a logic analyser that you can connect to confirm this?


#3

I have three MCP4131, That’s all.
Can’t you see the image attached ?


#4

In your other thread I asked for a screenshot of your REFERENCES in your project, and a picture of the connections - yes I can see your diagram, but that’s not a picture of real life connections :slight_smile:

So if you don’t have a Logic Analyser, I’d suggest it’s really worth the $50 or so for a cheap one - I have a Logic Sniffer from Dangerous Prototypes, you can buy them from Seeed Studio


#5

Hope it helps:


#6

@ Brett - Can you see something I’ve missed? And could you please explain the purpose of the device you suggested ?


#7

@ andre.m - Oh my god. It works!


#8

Yeah, and the conductive foam works also :wink:


#9

I would have never imagine.


#10

So see why a photo helps ? :slight_smile:


#11

@ Brett - LOL.
Thanks!