Yet another PROGMEM question, IO pins and SPI no longer working

Hi all, I'm new to forum and new to Arduino large memory allocation archetecture, so forgive the stumbling around until I learn the ropes.

My target device is the Mega 2650, I have a complex program that uses a total 8, 8192 byte arrays of ultrasound waveform data. (64KB total). Naturally I ran out of SRAM, so I jumped over to PROGMEM to store the data in flash. Which worked great, saved a lot of space... until I started adding more code.

Here's the current size:

Sketch uses 85958 bytes (33%) of program storage space. Maximum is 253952 bytes.
Global variables use 1305 bytes (15%) of dynamic memory, leaving 6887 bytes for local variables. Maximum is 8192 bytes.

I noticed that at some point I could no longer control SPI the ultrasound oscillator (via SPI) or the 8 data pins to the the 44780 LCD. Plus I starting getting garbage steaming out the serial port to the serial terminal/monitor.

I read that PROGMEM allocations in flash are lmited to 64kB. But 128kB is possible with IDE 1.8 (which I have on my mac). In any event, of I cut the arrays down to 7 instead of 8, all is well.

Note: I'm not using the arrays right now, I'm just declaring them as follows.

static const PROGMEM char Bank0[8192] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, ... fill out to a total of 8192... };

Put a total of 8 or 9 of these "banks" of data in your program, and reference them in code or they will get optimized out, and you will start to see I/O issues.

Keeping in mind, I can access the data fine, this is just a matter of declaring the arrays.

I see there is some kind of known bug, but I also read that people have a work around that I cannot locate.

I played around with for a few days, and ultimately got these strange "r30" errors.

Anyway, I need the pins working so I can pump the data to the ultrasonic oscilator and get the desired waveforms.

Any suggestions would be great! External memory?

Show us the code.
Show us the exact text of the errors.

Remember to use the forum's code tags.

Have a look at PROGMEM/F() vs Mega2560 - how to avoid a disaster? solution in #12.