I just followed the same procedure to get the GPS Shield working with the Arduino Mega / ATMega1280
First, you don't have to chop off shield pins if you make pins 10 - 13 inputs by adding the following code at the top of the "void setup()" routine:
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
pinMode(13, INPUT);
Here's some other notes on getting the GPS Shield happy with the Mega:
*** There's no CS pad, so connect pin 10 of the GPS Shield to pin 53 of the Arduino Mega.
*** When you copy the file "sd_raw_config.h", change:
#define SD_RAW_WRITE_SUPPORT 0
to
#define SD_RAW_WRITE_SUPPORT 1
You'll get a weird compile error if you don't.
*** You don't need the file "dac.h".
----------------------
*** When using the file "GPStest_RMC.pde", I had to make the following to changes to get uncorrupted serial data:
- Replace all three instances of "NewSoftSerial" with "SoftwareSerial". For some reason, NewSoftSerial simply didn't work with the Mega.
- Comment out the line "Serial.print("\n\rread: ");" at the start of the loop() routine. While the Arduino busy is outputting this text, it's missing incoming bytes and some characters show up as garbage. It should be possible to use a UART on the Mega but I'm not there yet.
Wave Shield and Arduino Mega: how-to
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- abritinthebay
- Posts: 32
- Joined: Wed Dec 02, 2009 5:00 pm
Re: Wave Shield and Arduino Mega: how-to
I too would like to know that.nandadoes wrote: Does it take all PWM pins?
If I understand it correctly though - it allows you to access the pins (that aren't being used - 13, 12, & 11 have to be whereas 2, 3, 4, 5, & 10 are software configurable) with the contacts next to the soldered headers.
Am I correct? (I've not worked with shields before, this is my first, so this would be good to know).
If so, I suppose you could buy some pin sockets like the ones used in the Arduino itself and solder them into the sections that aren't used. (right?)
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Wave Shield and Arduino Mega: how-to
it doesnt use the PWM pins but it does use some timers! the mega has more timers but we are not sure which ones go to which PWM pins
- abritinthebay
- Posts: 32
- Joined: Wed Dec 02, 2009 5:00 pm
Re: Wave Shield and Arduino Mega: how-to
Well all the pins listed are PWM pins, so it does "use" them in that regard.
However, given what you just said, does that mean that the optional pins have to be mapped to PWM supporting pins (as they are by default), or would any digital IO pin do?
If any would do that would mean a major gain in the number of free PWM capable pins with the Wave Sheild....
However, given what you just said, does that mean that the optional pins have to be mapped to PWM supporting pins (as they are by default), or would any digital IO pin do?
If any would do that would mean a major gain in the number of free PWM capable pins with the Wave Sheild....
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Wave Shield and Arduino Mega: how-to
only the SPI (SD card) pins are important. the others can be remapped
- abritinthebay
- Posts: 32
- Joined: Wed Dec 02, 2009 5:00 pm
Re: Wave Shield and Arduino Mega: how-to
Fantastic - and as those are already being remapped on the Mega (per the OP) to standard Digital IO pins... that makes life nice and easy
- abritinthebay
- Posts: 32
- Joined: Wed Dec 02, 2009 5:00 pm
Re: Wave Shield and Arduino Mega: how-to
Hmmm... odd issue here.
I got the Wave Shield working, and made sure to add/change the correct code. However... now I'm getting a SD I/O Error with a card that *worked* before with it.
(long story short - I forgot I had the damn thing turned off, it was playing fine but muted, so I started to de-solder the pins - I'm using 46,47,48,& 49 as DAC pins - but then realized what I did, soldered the two things back in, and now I get an IO error after reconnecting all the wires).
Only thing that changed is that I uses sudo rm to remove the .Trashes and such files (I'm on a mac, card is FAT32).
My Macbook reads the card fine over the usb reader, but I still get IO Error (0, 1). (which means it can't read the card)...
Now I've double checked that the wires are in the right pins, and the wires have full conductivity... so what else could be going wrong here?
I got the Wave Shield working, and made sure to add/change the correct code. However... now I'm getting a SD I/O Error with a card that *worked* before with it.
(long story short - I forgot I had the damn thing turned off, it was playing fine but muted, so I started to de-solder the pins - I'm using 46,47,48,& 49 as DAC pins - but then realized what I did, soldered the two things back in, and now I get an IO error after reconnecting all the wires).
Only thing that changed is that I uses sudo rm to remove the .Trashes and such files (I'm on a mac, card is FAT32).
My Macbook reads the card fine over the usb reader, but I still get IO Error (0, 1). (which means it can't read the card)...
Now I've double checked that the wires are in the right pins, and the wires have full conductivity... so what else could be going wrong here?
- abritinthebay
- Posts: 32
- Joined: Wed Dec 02, 2009 5:00 pm
Re: Wave Shield and Arduino Mega: how-to
Scratch that.
Not sure what magic I did, but re-inserting the SD into the macbook and removing it fixed the issue (but now it has all the hidden files on it again, annoying)..
New problem - no sound. No errors, but no sound.
I remapped the DAC pins to 46-49 as follows in dac.h:
From what I can tell this should be perfectly fine (though correct me if you see anything wrong).
What would cause no sound with no errors?
Not sure what magic I did, but re-inserting the SD into the macbook and removing it fixed the issue (but now it has all the hidden files on it again, annoying)..
New problem - no sound. No errors, but no sound.
I remapped the DAC pins to 46-49 as follows in dac.h:
Code: Select all
#define DAC_CS_PORT PORTL
#define DAC_CS_DDR DDRL
#define DAC_CS PINL0 //49
#define DAC_CLK_PORT PORTL
#define DAC_CLK_DDR DDRL
#define DAC_CLK PINL1 //48
#define DAC_DI_PORT PORTL
#define DAC_DI_DDR DDRL
#define DAC_DI PINL2 //47
#define DAC_LATCH_PORT PORTL
#define DAC_LATCH_DDR DDRL
#define DAC_LATCH PINL3 //46
What would cause no sound with no errors?
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Wave Shield and Arduino Mega: how-to
should be fine. just make sure you've got 'em hooked up right
- fat16lib
- Posts: 595
- Joined: Wed Dec 24, 2008 1:54 pm
Re: Wave Shield and Arduino Mega: how-to
Did you change this in setup()?
Code: Select all
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
- abritinthebay
- Posts: 32
- Joined: Wed Dec 02, 2009 5:00 pm
Re: Wave Shield and Arduino Mega: how-to
.... no.fat16lib wrote:Did you change this in setup()?
Sonofa... that's what I get for doing electronics projects at 2am in the grip on insomnia!
Works fine now!
Not sure why that step isn't done in the library (not sour grapes, just curious), wouldn't that make more sense? As the pins themselves have to be defined there anyhow (just in a more literal way)... or at least via constants defined in the same DAC.h file.
I'd be happy to submit a patch that added it, but it is a trivial modification (and keeps all that sort of data in the same header files).
- fat16lib
- Posts: 595
- Joined: Wed Dec 24, 2008 1:54 pm
Re: Wave Shield and Arduino Mega: how-to
This is one of many thing that need to be fixed. The DAC code was written before there was a Mega then a user started this thread with a hack. In fact ladyada did he DAC stuff before there was a 328 Arduino.
I started a major rewrite but got interrupted by a more tasty project.
I started a major rewrite but got interrupted by a more tasty project.
- abritinthebay
- Posts: 32
- Joined: Wed Dec 02, 2009 5:00 pm
Re: Wave Shield and Arduino Mega: how-to
Ah, yeah - I know how that goes.
I know the project is on google code, but it doesn't look like you have the individual code files set up there in its version control system (svn I think). Have you considered doing this? It would be easy for people to help, and I'd love to help optimize the lib in any way I can.
I know the project is on google code, but it doesn't look like you have the individual code files set up there in its version control system (svn I think). Have you considered doing this? It would be easy for people to help, and I'd love to help optimize the lib in any way I can.
- fat16lib
- Posts: 595
- Joined: Wed Dec 24, 2008 1:54 pm
Re: Wave Shield and Arduino Mega: how-to
I don't plan to open WaveHC to that kind of development. It is part of a set of projects that I want to keep synchronized. I just use google as a place for people to download code.
The SD I/O stuff in WaveHC uses parts of other libraries I wrote. The new DAC stuff can mostly be lifted from WaveRP, a record/play library that I wrote for the Wave Shield.
The SD I/O stuff in WaveHC uses parts of other libraries I wrote. The new DAC stuff can mostly be lifted from WaveRP, a record/play library that I wrote for the Wave Shield.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Wave Shield and Arduino Mega: how-to
well...at least its good now OneOfTheThingsWereWorkingOn is making the pins not-hardcoded - paul s. made some AWESOME macros that allow compiler optimizations that use 'arduino naming' and convert to single-instruction codes. so that would solve a lot of problems.
Please be positive and constructive with your questions and comments.