chipKIT® Development Platform

Inspired by Arduino™

Multiple SPI pins etc?

Created Mon, 15 Aug 2011 20:28:41 +0000 by 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... :)


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:






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. :-(


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... :)


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. :-)


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.


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


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.


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


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