chipKIT® Development Platform

Inspired by Arduino™

Multiple SPI pins etc?

Created Mon, 15 Aug 2011 20:28:41 +0000 by rasmadrak


rasmadrak

Mon, 15 Aug 2011 20:28:41 +0000

Hi there!

I've ordered a Chipkit Max32 because I've outgrown the RAM and pins of my Arduino board. I read somewhere that the Max32 have 2 sets of SPI-pins?

I've looked at the documentation but cannot understand where these pins are. Also - it looks as if the SPI1 pins are shared over several pins, is it possible to only have SPI on the center pins (J13)?

Again, I've looked at the pin documentation but cannot understand it. So please don't just send me to RTFM... :)


rtestardi

Mon, 15 Aug 2011 22:21:11 +0000

I think the Max32 actually has 4 SPI ports, not 2.

If I didn't make any copy/paste errors, you can find them on the following port pins:

SPI1


SCK1/IC3/PMCS2/PMA15/RD10 T5CK/SDI1/RC4 SDO1/OC1/INT0/RD0 SS1/IC2/RD9 SPI2

ECOL/SCK2/U6TX/U3RTS/PMA5/CN8/RG6 ECRS/SDA4/SDI2/U3RX/PMA4/CN9/RG7 ERXDV/AERXDV/ECRSDV/AECRSDV/SCL4/SDO2/U3TX/PMA3/CN10/RG8 ERXCLK/AERXCLK/EREFCLK/AEREFCLK/SS2/U6RX/U3CTS/PMA2/CN11/RG9 SPI3

AETXD1/SCK3/U4TX/U1RTS/CN21/RD15 SDA3/SDI3/U1RX/RF2 SCL3/SDO3/U1TX/RF8 AETXD0/SS3/U4RX/U1CTS/CN20/RD14 SPI4

AC1TX/SCK4/U5TX/U2RTS/RF13 SDA5/SDI4/U2RX/PMA9/CN17/RF4 SCL5/SDO4/U2TX/PMA8/CN18/RF5 AC1RX/SS4/U5RX/U2CTS/RF12

So for example, when looking for the first pin above, which is really "RD10", on the schematic it will be listed in the "Port D" block and you can see it gets renamed to "PMCS2", which then goes to the I/O Connectors page XIOL J8 pin 38.

It's pretty hard to follow each pin since the schematic PDF does not allow searching, unfortunately, so it takes a bit of luck here. :-(


rasmadrak

Tue, 16 Aug 2011 13:02:36 +0000

Hi there!

Thanks for the reply.

I figure this would mean that each pin have several uses? Is it possible to use SPI on one set of pins, and also use these pins for another type of input/output as well?

Or do I simply enable SPI and these pins are "locked" to using SPI?

I would love to be able to gather a switch matrix from all the pins, and afterwards use the SPI to send the switch-matrix to another device for instance. Is this possible, or would it become "number of pins available" minus "spi pins" that can be used for switches?

Hope I'm making sense... :)


rtestardi

Tue, 16 Aug 2011 13:21:30 +0000

Or do I simply enable SPI and these pins are "locked" to using SPI?

Usually you switch the pins to SPI mode and leave them that way to keep the circuit simple and predictable.

There's nothing preventing you from switching them into and out of SPI mode on the fly however -- so long as you don't assert the SPI chip select for any SPI peripherals, they should ignore the noise as you multiplex the pins for other purposes...

I'd probably recommend against that, though. :-)


GeneApperson

Tue, 16 Aug 2011 18:07:32 +0000

It's pretty hard to follow each pin since the schematic PDF does not allow searching, unfortunately, so it takes a bit of luck here.

Rich,

Years ago, when I first started using Eagle I continually had problems getting text to line up between the screen and the printed page, and even had problems with text disappearing when printed. The only way I could get consitent results was to check "use verctor fonts always" in the preferences. This removes any notion of searchable text in the pdf file. Possibly this isn't needed any more. I'll look into it.

Gene Apperson Digilent


GeneApperson

Tue, 16 Aug 2011 18:14:46 +0000

There are searchable tables at the end of the hardware reference manual for the Max32. You can download this document from the Digilent web site. The same tables are posted as an Excel spreadsheet as well. They are arranged by logical pin number, connector and pin, and microcontroller pin, and give the full signal name (as shown in the Microchip data sheet) for each pin.

@rasmadrak

Most microcontrollers overload the pins with multiple peripheral functions. The PIC32MX795 device on the Max32 has a very large number of peripheral devices for the number of pins on the package, and so most pins are overloaded with a large number of peripheral functions. Generally, when you enable one of the peripheral devices (such as an SPI controller), that device takes over the operation of the pins and they are not available for other purposes until that peripheral device has been disabled.

As Rich said, you can sometimes design a circuit that tolerates multiple different uses of the same pins, but it can be pretty tricky to get working correctly and is best to avoid unless you really need to.

Gene Apperson Digilent


rasmadrak

Tue, 16 Aug 2011 19:31:55 +0000

Awesome replies, both of you. :)

I'll keep the SPI ports separate from the rest of the switches / lights etc. I figure it would be nice to know that the SPI connection is "always on" between the devices.

Can't wait to get my board! :D