chipKIT® Development Platform

Inspired by Arduino™

Porting Arduino SPI code to the max32

Created Thu, 10 Nov 2011 11:50:11 +0000 by N-o-s-t-r-o-m-o


N-o-s-t-r-o-m-o

Thu, 10 Nov 2011 11:50:11 +0000

Hi,

Im trying to get the GD library for the Gameduino board working with the max32 and have some compiler issues relating to some AVR specific registers that are not supported.

Specifically the SPI startup code for the GD library looks something like:

SPI.begin(); SPI.setClockDivider(SPI_CLOCK_DIV2); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); SPSR = (1 << SPI2X);

However it seems that SPSR & SPI2X are both undefined, should I perhaps be using some other SPI library on the max32? Or is there any information on the correct setup procedure?

And may I ask, where would I find the chip manual for the processor used by chipKIT Max32 - so I can look into the hardware registers & their usage, etc?

Kindest regards,

Nostromo


lloyddean

Thu, 10 Nov 2011 19:41:06 +0000

I have a working (with Asteroids at least) version of the GD library posted in the "Shields" section of the forum.

Note also that the chipKit MAX32, like the Arduino Mega, has the SPI pins at another position than required of the Gameduino Shield.