chipKIT® Development Platform

Inspired by Arduino™

How to get the DSPI library?

Created Mon, 26 Aug 2013 23:57:04 +0000 by unexpectedly


unexpectedly

Mon, 26 Aug 2013 23:57:04 +0000

I'm a bit flummoxed here... I can download the PDF reference files but cannot find the DSPI library itself. It definitely was NOT included with mpide...

Help please. :) Chris


unexpectedly

Tue, 27 Aug 2013 00:03:09 +0000

Sweet, they're buried in Github somewhere: https://github.com/chipKIT32/chipkit-core

I couldn't even begin to tell how I found my way to that.

C'mon guys, am I really the first person to try and use DSPI? Or should I NOT be looking at http://chipkit.net/ or digilentinc.com for information??? (I'm actually not being sarcastic) This is the 2nd day I've been looking for DSPI and when I'd given up, that's how I found it. (right after I posted, I google'd something else).

:|


unexpectedly

Tue, 27 Aug 2013 03:59:26 +0000

Oh and as I mentioned in this post, DSPI does not currently compile. Not with the example I posted nor with this simple sketch:

#include <DSPI.h>

DSPI _dspi;

void setup(){
	;
}

void loop(){
	;
}

Or this simple sketch:

#include <DSPI.h>

DSPI2 _dspi;

void setup(){
	;
}

void loop(){
	;
}

You're killin me, smalls

If this keeps up, I'll eBay my chipKIT stuff and go bakc to the hobbyist Arduino child's crap that at least compiles. Apologies for my bitterness, but after spending a couple days figuring out that DSPI ... doesn't, I ended the day by having some beers and some shots. I really hope there's progress before the SPI RAM shows up that I bought for the Arduino Mega. I'm pretty sure THAT will work as I expect and then I won't need the added benefits of a proper embedded controller. :P

So, please folks, what am I doing wrong here?

Thanks, Chris


guymc

Tue, 27 Aug 2013 04:42:47 +0000

Hey Chris,

Sounds like you had a rough time. If the chipKIT documentation was more polished, then perhaps you could have been spared.

Please note that MPIDE includes a boatload of examples under the File menu. If you start there, you will find some DSPI examples. (I'm using the 20130609 distro.) Just open one of those, hit the compile button, and you should be good to go.

On my system, the examples build fine for the Uno32 and the uC32. Incidentally, there is also a SoftSPI library which could be useful for certain applications. Like DSPI, it is also built into the system.

Cheers


unexpectedly

Tue, 27 Aug 2013 05:24:26 +0000

Thanks GuyMC. yeah, it's pretty rough that mpide totally ignores DSPI out of the box. (as does everywhere else) As you'll often see declared: "Pics or it didn't happen". For as much ado about DSPI there is, little is following to make it actually happen.

Right now, I'm carefully re-writing the class from Adafruit with SPI.h, as SPI.h seems to default to SPI2 (given the DigitalPotControl.PDE example) and uses the Arduino UNO compatible pins 10~13...

So far so good... but I'm just building and compiling the class as I go. We'll see when I start throwing bits at it.

Thanks! Chris


unexpectedly

Tue, 27 Aug 2013 07:32:26 +0000

I got the ported code to compile, but it doesn't work. The sad part is that I'm sure I'm missing something simple. I did a post here. I think I should really throw my hands up and not care (and settle for something less than) but I'm too stubborn to just quit.

I just learned that Arduino.cc ported the Adafruit code, so I'll look through that tomorrow to see how much effort when into making the library less AVR specific. There is so much AVR stuff and magic numbers in the Adafruit_ST7735 code that I'm a bit worried trying to get it going. I spent a few hours on it tonight and just ... :|


unexpectedly

Tue, 27 Aug 2013 07:39:57 +0000

Please note that MPIDE includes a boatload of examples under the File menu. If you start there, you will find some DSPI examples. (I'm using the 20130609 distro.) Just open one of those, hit the compile button, and you should be good to go.

Interesting. I go the example to compile, so I copied it to my mpide directory ... compiled and it went ok. Then I changed DSPI0 to DSPI2 so that it will work with pins 10~13 ... won't compile. Just like my other post.

It really is like I'm the first person on the internet to take an Arduino hardware SPI shield and try to put it on a chipKIT board.


majenko

Tue, 27 Aug 2013 09:47:07 +0000

The Uno32 has 2 SPI channels - so DSPI0 and DSPI1 are available - DSPI2 isn't.

DSPI0 is SPI 2 on the chip. DSPI1 is SPI 1 on the chip.


Ian_B

Thu, 29 Aug 2013 00:12:03 +0000

Hi Chris,

Sorry you've been having problems using your chipKIT board and MPIDE.

What majenko posted should clear up your problems with the DSPI library.

Here's some extra info on the DSPI library and MPIDE.

If you open the MPIDE folder and go to hardware\pic32\variants, there will be a folder for supported boards. In the folder for your board, there will be a header file called "Board_Defs.h" that has hardware definitions for the board (like on the Uno32/uC32: NUM_DSPI_PORTS = 2, DSPI0 being SPI2, etc).

Also going back to your original post here, the DSPI library should be included when you download MPIDE here:

mpide-0023-windows-20130715\hardware\pic32\libraries

If you plan on using Digilent's network libraries or any others, chipKIT.net has information on using third party libraries at:

http://chipkit.net/started/learn-basics/party-libraries/

Hope this helps you out.


unexpectedly

Wed, 04 Sep 2013 08:25:04 +0000

Hi Ian,

Thanks for your reply. Using basically the same code for SPI or DSPI, I was able to make SPI work and not able to make DSPI work. So far, I'm trying to just get stuff done, so I haven't put any effort into figuring out DSPI. I put my code up on the Shields forum for the TFT 1.8" SPI display shield from Adafruit, which I love more than way too many things in the rest of my life...

So, I'm happy? :D