Wave Shield with ATMega1284P or ATMega644P
Moderators: adafruit_support_bill, adafruit

Wave Shield with ATMega1284P or ATMega644P

by Bratan on Fri Nov 30, 2012 10:25 am

Is it possible to get Wave Shield working on custom Arduino based on ATMega1284p or 644P processors? What would be Pin mappings? Any changes to library needed?
Bratan
 
Posts: 35
Joined: Sun Mar 25, 2012 2:08 pm

Re: Wave Shield with ATMega1284P or ATMega644P

by xl97 on Fri Nov 30, 2012 1:11 pm

I am not sure about the 1284/644.. bu maybe looking at the MEGA tutorials will yield some help/direction?

Also the only changes you need to make to the library would be the WavePinDefs file.. in the WaveHC library..

this would be for setting your DAC pins..etc...

good luck.
xl97
 
Posts: 144
Joined: Mon Jul 27, 2009 12:51 pm

Re: Wave Shield with ATMega1284P or ATMega644P

by Bratan on Fri Nov 30, 2012 1:38 pm

Hmm, WavePinDefs.h doesn't look it has specific pin numbers. But I just found them in ArduinoPins.h
I wonder if it would be sufficient to change SPI port pins or do I need to make more changes in the file?
Code: Select all | TOGGLE FULL SIZE
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
// Mega Arduino

// Two Wire (aka I2C) ports
#define SDA_PIN 20
#define SCL_PIN 21

// SPI port
#define SS_PIN 53
#define MOSI_PIN 51
#define MISO_PIN 50
#define SCK_PIN 52
Bratan
 
Posts: 35
Joined: Sun Mar 25, 2012 2:08 pm

Re: Wave Shield with ATMega1284P or ATMega644P

by xl97 on Fri Nov 30, 2012 2:14 pm

Im not sure.. I have never used it with a Mega or anything..

but I have used it with a 'custom' board with the WaveShield components 'built-in'..

and by default I used different pins for my DAC to free up some PWM pins and other pins..etc..

in the: WavePinDefs.h

Code: Select all | TOGGLE FULL SIZE
//------------------------------------------------------------------------------
// DAC pin definitions

// LDAC may be connected to ground to save a pin
/** Set USE_MCP_DAC_LDAC to 0 if LDAC is grounded. */
#define USE_MCP_DAC_LDAC 1

// use arduino pins A3(D17), D4, D7, D8 for DAC

// pin A3/D17 is DAC chip select

/** Data direction register for DAC chip select. */
#define MCP_DAC_CS_DDR  PIN17_DDRREG
/** Port register for DAC chip select. */
#define MCP_DAC_CS_PORT PIN17_PORTREG
/** Port bit number for DAC chip select. */
#define MCP_DAC_CS_BIT  PIN17_BITNUM

// pin D4 is DAC serial clock
/** Data direction register for DAC clock. */
#define MCP_DAC_SCK_DDR  PIN4_DDRREG
/** Port register for DAC clock. */
#define MCP_DAC_SCK_PORT PIN4_PORTREG
/** Port bit number for DAC clock. */
#define MCP_DAC_SCK_BIT  PIN4_BITNUM

// pin D7 is DAC serial data in
/** Data direction register for DAC serial in. */
#define MCP_DAC_SDI_DDR  PIN7_DDRREG
/** Port register for DAC clock. */
#define MCP_DAC_SDI_PORT PIN7_PORTREG
/** Port bit number for DAC clock. */
#define MCP_DAC_SDI_BIT  PIN7_BITNUM


// pin D8 is LDAC if used
#if USE_MCP_DAC_LDAC
/** Data direction register for Latch DAC Input. */
#define MCP_DAC_LDAC_DDR  PIN8_DDRREG
/** Port register for Latch DAC Input. */
#define MCP_DAC_LDAC_PORT PIN8_PORTREG
/** Port bit number for Latch DAC Input. */
#define MCP_DAC_LDAC_BIT  PIN8_BITNUM
#endif // USE_MCP_DAC_LDAC





you define the PINS you want to use (I have posted about it here s well when I had to change it other pins not on same port)

For you.. couldnt hurt to look in the Arduino pins defs though too...

(since my custom board was still more or less an Uno)
xl97
 
Posts: 144
Joined: Mon Jul 27, 2009 12:51 pm

Re: Wave Shield with ATMega1284P or ATMega644P

by Bratan on Sat Dec 01, 2012 12:20 pm

Got it working!!! I found another post describing the process, works like a charm on ATMega644P
viewtopic.php?f=31&t=15421
Just had to replace ArduinoPins.h and WavePinDefs.h
Adafruit, please include it in the official library! :) It's just one extra definition...
Bratan
 
Posts: 35
Joined: Sun Mar 25, 2012 2:08 pm