Created Thu, 21 Feb 2013 19:47:03 +0000 by dallowgill
Thu, 21 Feb 2013 19:47:03 +0000
I have a Digilent Chipkit Max32 Board and very nice it is to. However has anybody got any idea of which MPIDE libraries work out of the box, whith this board? In particular I am interested in the I2c and SPI libraries. I am just trying to decide if I should use MPLAB and PIC32 compiler and libraries or MPIDE, I don't want to waste time debugging the use of a simple I2c I/O expander or SPI device, because the software library functions do not work. I have scanned this Forum for 2 days as well as all other resources at Digilent and Arduino sites as well as the Wiki and I can see no definitive yes or no, with using these libraries with Max32 board. In fact I have seen a chart showing a lot of the libraries just don't work with this board. Have I got the wrong end of the stick? Am using MPIDE Version 'mpide-0023-windows-20120903' Any help much appreciated.
Thanks Alan
Thu, 21 Feb 2013 22:20:47 +0000
Alan,
That chart in the Wiki is not correct, nor up to date. I'm in the process of updating it with correct information.
I know that SPI works, and I also believe that I2C works. Both have been used by other people on this forum for their projects.
*Brian
Thu, 21 Feb 2013 22:26:53 +0000
Thank you Brian I thought I was going mad, I for one will appreciate your efforts in upgrading the chart on the wiki. I will try I2c and SPI libraries with basic I/O expanders and see where I get over the next few days.
Cheers Alan
Fri, 22 Feb 2013 03:34:46 +0000
I have used both the I2C and SPI libraries with the UNO.
James
Fri, 22 Feb 2013 04:11:47 +0000
I have used also both the I2C and SPI libraries with a board that uses the same processor as the Max32.
Fri, 22 Feb 2013 04:45:43 +0000
Thanks guys for taking the time to reply will get some devices hooked up, now that I know that you have found the libraries to work.
Alan
Fri, 22 Feb 2013 10:45:30 +0000
I use the DSPI library all the time (in fact, a number of my libraries rely on it), so I can vouch for it working well.
Sat, 23 Feb 2013 00:27:34 +0000
Thanks majenko That is very encouraging and I see you have plenty of experience within this forum. Have all ready visited your Shop and like the Hex Display and your little LED boards will purchase soon. I have a couple of TIL311 displays for debugging but one by one even with correct current drive the individual Segement Led/dots are dying and the device is now obsolete.
Regards Alan
Sat, 23 Feb 2013 21:48:40 +0000
Ok thanks to all you guys who took the time to reply to me. I2C now working well with a PCF8574P I/O Expander from NXP, two leds blinking alternatley via a modified 'master_writer_I2C' sketch, from the examples. So this has validated the 'Wire Library' for me and confirmed the correct pins to use on the Chipkit Max32 board as (Pin21 = SCL) & (Pin20 = SDA).
Below is the modifed Sketch for anybody new to Chipkit Max32 and MPIDE like me, hope it helps.
NOTE the code below blinks two leds on bit 0 & bit 1 of PCF8574P Alternatley.
The PCF8574P, 2 Led's and 4k7 pullup resistors for the I2C Bus are all running from the Max32 3.3v supply powered by the USB from PC.
// Wire Master Writer // by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library // Writes data to an I2C/TWI slave device // Refer to the "Wire Slave Receiver" example for use with this
// Created 29 March 2006
// This example code is in the public domain.
// Modified for Testing PCF8574P I/O Expander by Alan Randles 16/2/2013
#include <Wire.h>
void setup() { Wire.begin(); // join i2c bus (address optional for master) }
void loop() { byte x = 0; Wire.beginTransmission(0x20); // transmit to device #20
Wire.send(0); // sends one byte
Wire.endTransmission(); // stop transmitting
x = 1;
Wire.beginTransmission(0x20); // transmit to device #20
Wire.send(x); // sends one byte
Wire.endTransmission(); // stop transmitting
delay(500);
x =0;
Wire.beginTransmission(0x20); // transmit to device #20
Wire.send(x); // sends one byte
Wire.endTransmission(); // stop transmitting
delay(500);
Wire.beginTransmission(0x20); // transmit to device #20
Wire.send(0); // sends one byte
Wire.endTransmission(); // stop transmitting
x = 2;
Wire.beginTransmission(0x20); // transmit to device #20
Wire.send(x); // sends one byte
Wire.endTransmission(); // stop transmitting
delay(500);
x =0;
Wire.beginTransmission(0x20); // transmit to device #20
Wire.send(x); // sends one byte
Wire.endTransmission(); // stop transmitting
delay(500);
}