Jump to content
  • 0

Pmod wiring to Raspberry Pi 3


daveoprea

Question

13 answers to this question

Recommended Posts

Hi daveoprea, 

After looking a little more into your question i would suggest using this cable(6 pin MTE) so that you can plug power and ground along with the GPIO pins in respect to where they are on the Raspberry Pi 3. I have moved this thread to the LabVIEW section so that more experience labview forum members will answer. Our LabVIEW expert is not in the office today so it will be a few days before you should expect a response. I am not aware of a Pmod that would not work for the the Raspberry Pi 3 and LabVIEW. I did find a github for LabVIEW and Raspberry Pi 3  here and an instructable here that uses LabVIEW, Raspberry PI 2 and the PmodAD2,PmodLVLSHT and the PmodJSTK 2. Hope this helps!

cheers,

Jon

Link to comment
Share on other sites

Thanks.  However, to which specific GPIO pins does the pmod cable plug into?  I'm assuming power is +5V & ground, but what about the other wires?  Some pmod products are I2C, some are SP1, & some are GPIO.  What wires go to where on the GPIO header for each type of interface?

Link to comment
Share on other sites

Thanks for your reply.  However, the link you gave me only describes the GPIO pins on the Raspberry Pi side of the connections.  What I'm looking for is also a pmod pinout spec so that I can know where the Raspberry Pi GPIO pins connect to the pmod. 

Link to comment
Share on other sites

@daveoprea,

Each PMod device can have a different pin out specification.  Your best bet may be to pick the PMod you wish to work with, and work the specification from there.  Typically, the 6-wire PMod has 4-data wires, a ground, and a power wire, and runs at 3.3V (DO NOT PLUG IT INTO 5V!).  There is also a 12-wire PMod standard that is the same as two 6-wire PMods on top of each other.

One difficulty you will have is that you will want to connect the PMod ground and power pins to the ground and power bus on your RPi.  While the GPIO ports may also be able to create ground and power voltages, they aren't usually rated for having the kind of current necessary to power any devices.

If you are looking for a minimal wiring solution, you might wish to examine the StickIt-MB from Xess.com.  I know this board will connect to an RPi as well as to several PMods, although its purpose is really to connect a small FPGA board to both, rather than the RPi to the PMods--so double check that the wiring will suit your purpose before you purchase (if you choose to do so).

Dan

Link to comment
Share on other sites

@daveoprea,

Ahm ... you want to plug a 6-pin connector into a 40-pin port, and you are asking which of the 40 pins to plug your 6-pin connector into?  I mean, sure, you can plug a square peg into a round hole, but it might take a touch of work to get there.

The non-Digilent answer is that it can be done, but that you are going to need to do some creative wiring to do it, and that the wiring you will need to do will be dependent upon which PMod you wish to connect to your RPi.  This is why the Digilent staff kindly pointed you to the information you would need to do this rewiring.  If you aren't comfortable with doing such wiring, you might want to rethink your project.

For example, the RPi has particular pins that offer hardware UART capability.  If you plug in a PModUSBUART, you would want to use those pins.  The RPi has other pins that offer hardware SPI functionality.  If you plug a PModSD into the RPi, you might wish to use those pins instead.  The RPi also has I2C pins.  Should you wish to plug a PMod into the RPi that communicates via I2C, you might wish to use those pins.

So ... it can be done, but how to do it depends upon what you wish to do--something you haven't shared.  The connectors themselves don't match, so ... you will need to make some creative adjustments to get things to work. 

Dan

Link to comment
Share on other sites

Please be patient with me - I'm new to this.  It sounds like you're one of the Digilent staff.  I haven't purchased any of the pmod products yet and I'm new to Raspberry Pi which why I'm trying to understand how these things connect together if I were to make a purchase.  I have no problem with kludging something together to make it work but I'm just trying to match both sides of the harness so things work properly.  If I were to choose the pmodAD1 (dual analog input, https://reference.digilentinc.com/reference/pmod/pmodad1/reference-manual), there's a table of SPI-type pins that I'm trying to match-up with the GPIO pin definitions that J.Colvin sent me (https://developer.microsoft.com/en-us/windows/iot/docs/pinmappingsrpi). It looks like all I need to do is connect the nine pmod pins (five SPI0 and four SPI1) with the corresponding nine GPIO pins, right?  By the table in the AD1 spec, it looks like there's two rows of 6 pins on the pmodAD1.  Do you have a pigtail harness product that would allow me to wire that pmod to the RPi-3 header?

Thanks for your consideration.

Link to comment
Share on other sites

@daveoprea,

Actually, I'm not one of Digilent's staff.  I'm just someone who happens to be helpful and friendly and bored anytime Vivado is synthesizing one of my designs.

I also happen to have an RPi on my desktop, and I've recently done some work to try to connect it to an icoBoard, so I've dug into the pin mapping a touch.  Most of my designs to date involve FPGA's, rather than the RPi, so ... I'm helping as much as I can.  As for being Digilent staff, I'm not sure that the RPi is an officially supported Digilent platform.  So, this may well be outside of their comfort zone.

If you look at the link @JColvin pointed you at, you'll notice that the RPi has two SPI ports connected to it's pin set.  You should be able to connect any uncommitted pin to the CS line, connect the D0 line to a SPI_MISO line, and the CLK to a SPI_CLK line.  Make sure the MISO and CLK line reference the same SPI port.  You'll want to connect the PMod power to a 3.3V power supply on the header, and the Ground to one of the ground pins on the header.  This should get you a means of reading hardware-accelerated ADC data.  Since Digilent isn't supporting the RPi interface, I doubt they have examples of how to use a SPI port on an RPi.  I've recently been looking through Clifford's code for the RPi here, but his code also has a different purpose--programming the ICO board via SPI, rather than reading samples from the PMod.  (Please don't ask me to explain his code for you--I'm not sure I could ... ;) )

Some things to notice: 1. The MOSI port will remain unconnected, this PMod doesn't use it.  2. The description I gave you above only works for the D0 channel, not the D1 channel.  Indeed, you may wish to leave D1 unconnected.  (DON'T CONNECT IT TO AN OUTPUT PIN!)  I think you might struggle to get both channels at the same time--since the separate SPI ports on the RPi use separate clocks, and the PMod only uses a single clock.  While you might still manage to make it work, it would depend upon some RPi wizardry that I'm not familiar with.  3. While you may be able to use a generic SPI driver to get these data samples, you might also find that such a generic driver cannot handle the repetitive read and clock consistency requirements of an ADC, I just don't know.  If you check the resource page for the AD1, you'll find example code for a ChipKit and a ZedBoard.  Both would be very different from an RPi.

Hope that helps,

Dan

 

 

Link to comment
Share on other sites

Hi daveoprea,

@D@n is correct in his guess that Digilent does not really support the Raspberry Pi directly; what we do have is the LabVIEW MakerHub LINX which can target the Raspberry Pi and has pre-existing VI's for a number of Digilent Pmods (although not all of them), so creating code to run directly on the Raspberry Pi is a bit out of the realm of what Digilent does. I'm not even certain myself how one would do it outside of LINX that's in a nice friendly fashion.

The Pmod AD1 does technically have two rows of 6 pins each, but in terms of connecting it to the Raspberry Pi, you would only want to concern yourself with the male pins on the J1 header side of the module. You'll end up physically connecting the Raspberry Pi and the Pmod (whether the Pmod AD1 or any other Pmod) via a set of cables and individual gender changers (Digilent has some of these that come in rows of 6). Digilent doesn't have a single cable (whether for 6 wires or a single wire) that will directly connect the two pieces of hardware. Because of the way the Raspberry Pi is set up (and truthfully, the vast majority of microcontroller/microprocessor boards that exist) you will need to wire the Pmod to the board through individual pins since the Raspberry Pi does not have a "Pmod Host port". There isn't really any way to get around that for the Raspberry Pi that I am aware of.

In terms of SPI, you'll find that a variety of development boards (such as the Raspberry Pi) have a number of prebuilt SPI ports, commonly labeled SPI0, SPI1, etc. For a Pmod that uses SPI (I2C and UART follow this same pattern), you would only need to connect to one such port, such as SPI0. You wouldn't have to worry about SPI1. In terms of the physical connection, it would be done much like it is shown in this tutorial that runs a SPI Pmod on a Digilent board through LabVIEW; the Raspberry Pi will not have the same connection pin numbers, but you would connect the Pmod to the SPI pins that do exist on the Raspberry Pi in a very similar manner.

As Dan correctly points out, you would only need to connect the CS pin, the D0 pin, the CLK pin, the GND pin, and the VCC pin to get "half" of the Pmod AD1 working. In theory (as he mentions) you could also connect the D1 pin to a different SPI port (since SPI only consists of 4 pins: CS, MOSI, MISO, and SCLK; you can learn some more about SPI here), but that has a whole other set of problems that is beyond the scope of this thread (that and I don't know how it would be done on a Raspberry Pi directly).

I suppose this begs the question of it's so difficult to make the Pmod AD1 work on a microcontroller why was it designed this way? The answer to that is that it was designed for FPGAs (and prior to Digilent getting its toe dipped in the microcontroller sector), and FPGAs can handle two data input lines simultaneously far more easily than a microcontroller and can easily account for pins being in different arrangements.

I guess a final point might be that at Digilent we want to help teach people about electronics and want to help people learn about them. We'll definitely help you in the ways that we can to get you started, but we won't be able to promise that everything will be as straightforward as plugging a keyboard into your computer and having it work, cool as that would be for Pmods; there'll be a little more learning involved :)

Let us know if you have any more questions.

Thanks,
JColvin

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...