chipKIT® Development Platform

Inspired by Arduino™

Naive question about DSPI library...

Created Mon, 08 Oct 2012 15:20:51 +0000 by Vittorio


Vittorio

Mon, 08 Oct 2012 15:20:51 +0000

Hi, there is a point i have not able to figure out from the DSPI manual available on the chipkit website:

which are the pins used by the different SPI ports?

thanks :)

V.


majenko

Mon, 08 Oct 2012 16:59:29 +0000

Read the user guide for your chipkit board. That contains a list of all the pins, their "PIC" names, and the alternate functions (including SPI).


Vittorio

Tue, 09 Oct 2012 09:21:25 +0000

I have this [url]http://www.digilentinc.com/Data/Products/CHIPKIT-MAX32/chipKIT%20Max32_rm.pdf[/url]

how are the pisn supposed to be named?

for example i see that the pin 51 is listed as: "ERXDV/AERXDV/ECRSDV/AECRSDV/SCL2A/SDO2A/U2ATX/PMA3/CN10/RG8"

i'm still confused about where could I recognize the SPI...


majenko

Tue, 09 Oct 2012 10:14:18 +0000

Ah yes, of course, for some reason ChipKit decided to give some peripherals different names.

Cross-reference the pins with the datasheet for the chip on your board for more clarity.

SPI1 is SDI1/SDO1/SCK1. SPI2 is SDI2/SDO2/SCK2 etc.

I'm not sure why they named them SDO2A etc in the ChipKit manuals - seems a bit stupid to me. Kind of like saying "I'm just popping out to get some molk".


Vittorio

Tue, 09 Oct 2012 14:02:07 +0000

Thanks, i'll try to clarify and then make a summary

50 J4-06 16 SCL3A/SDO3A/U3ATX/PMA8/CN18/RF5 51 J9-13 25 USBID/RF3 52 J14-01 0 SDA1A/SDI1A/U1ARX/RF2 53 J14-03 1 SCL1A/SDO1A/U1ATX/RF8

these are the pins used by the SPIdriven by SPI.h

i'm still confused about the fact that 50 is SDO3A and 52 SDI1A.

when for the SPI.h we have 50 (MISO), 51 (MOSI), 52 (SCK), and 53 (SS).


JordanR

Wed, 10 Oct 2012 00:05:09 +0000

Hello Vittorio,

The pins 50, 51, 52, 53 that you have shown are the PIC32 pin numbers. The pins you see in SPI.h are the chipKIT pin numbers. When looking at the Max32 reference manual, you should reference the chipKIT pin numbers.

Best Regards,

Jordan R


Vittorio

Wed, 10 Oct 2012 10:07:34 +0000

ok thanks, sorry for the mistake:

here we go: the SPI port used by spi.h is the

50 SDI2A (MISO) 51 SDO2A (MOSI) 52 SCK2A (CLOCK) 53 SS2A (SS)

i imagine that this is the spi port number two in DSPI.h

then the other two ports are the third (?)

14 SCK3A (CLOCK) 15 SS3A (SS) 16 SDO3A (MOSI) 17 SDI3A (MISO)

the first (?) 18 SCK1A (CLOCK) 19 SS1A (SS) 0 SDI1A (MISO) 1 SDO1A (MOSI)

is it right? best, V.


chow@vajri.com

Wed, 10 Oct 2012 14:58:42 +0000

I thought that the DSPI library and board_defs.h file worked together such that the DSPI library created a DSPI0, DSPI1, DSPI3, etc object depending on the number of ports the board supported. That way if you wrote your sketch using DSPI1, it would work on any board that had at least 2 SPI ports. board_defs.h has the mapping between DSPI# and SPI#. For the Uno32 I think it is DSPI0=SPI2 and DSPI1=SPI1. Not sure which go to which on the Max.


JordanR

Wed, 10 Oct 2012 19:52:02 +0000

Hello chow@vajri.com,

Yes, you are correct. For example, looking at Max32 board's Board_Defs.h, you can see there are 4 DSPI -> SPI port declarations.

DSPI0 -> SPI port 2 DSPI1 -> SPI port 1 DSPI2 -> SPI port 3 DSPI4 -> SPI port 4

Best Regards,

Jordan R


Vittorio

Thu, 11 Oct 2012 07:52:26 +0000

are you sure there is a fourth port? :o


majenko

Thu, 11 Oct 2012 08:40:29 +0000

The PIC32 MX795F512L chip has 4 SPI ports. It also has 6 UART ports.


rasmadrak

Thu, 11 Oct 2012 12:12:39 +0000

On a Max32:

DSPI0 (Standard SPI): 50 SDI2A 51 SDO2A 52 SCK2A 53 SS2A

DSPI1: 11 SDI1 (I've written pin 20 earlier, but that appears wrong according to the documentation) 3 SDO1 38 SCK1 74 SS1

DSPI2: 0 SDI1A 1 SDO1A 18 SCK1A 19 SS1A

DSPI3: 17 SDI3A 16 SDO3A 14 SCK3A 15 SS3A