32X8 Led display multizone problem, with Parola Library (SOLVED)

Hi,

I am working on midi footcontroller. For display I have been using two daisy chained 8X8 matrices. Display was divided into two zones and 16X8 with two zones is working perfectly. I am using Parola Library and the daisy chained max7219 modules are from ebay.

I am need to enlarge the display to 32X8. To do this, added two more modules to the chain. My code was for two devices so it cloned the displayed text to the newly added matrices. I modified to code and set the max devices to 4 and adjusted the borders for zones. However when I change the code to work for 4 modules arduino hangs after reboot and the displays dont work. I need to mention that the scrolling text example of Parola library works fine with 4 devices. Problem exist only when I use the multizone setup.

My original code for 2 modules with 2 zones works without any problems. The related settings in this code:

//Initialize part
#define	MAX_DEVICES	2

//In the setup loop
P.begin(2);
 P.setZone(0, 0, 0);
P.setZone(1, 1, 1);

To make it work with 4 modules with 2 zones, I change these settings as shown below. With these settings Arduino cannot complete the boot process.

//Initialize part
#define	MAX_DEVICES	4

//In the setup loop
P.begin(2);
 P.setZone(0, 0, 2);
P.setZone(1, 3, 3);

I checked the mutlizone examples that are available in Parola library but they are causing the same problem…

Does anyone have an idea about what I am doing wrong?

I am using Arduino Micro and the full code of my project is attached.

fullCode.rtf (22 KB)

Have you got enough RAM to do what you want to do? Adding additional displays reserves more memory space for the display buffers. It is not a lot of additional RAM, but if you are borderline then it could cause problems.

If you are failing to start up then it could well be a lack of RAM. This is separate from the Flash memory that the program is stored in. How far does it get? Does it finish the setup()? P.begin() is where buffer memory is allocated.

Also, I noticed that you use

  for(int z=0; z<2; z++){
       if (P.displayAnimate()){ // animates and returns true when an animation is completed 
           P.displayReset();                
           }             
         P.displayZoneText(0, numbers[x], RIGHT, 0, 0, PRINT,NO_EFFECT);
        }
 }

when you want to display text for zones 0 and 1. The for loop does both zones (z=0, z=1 in the loop), If you are just displaying (PRINT) data when you need to, with no animations, then just display the data as required using the displayZoneText() method. No need for anything else as far as I can see.

Thank you so much for your reply Marco.

It was not finishing the setup(). I think it was freezing before P.begin() cause the buttons connected to the mux also dont responde when it freeze.

I cleaned up the code a bit and deleted some unused variables. Arduino is running OK now and the displays are also functional. I guess you were right about the ram issue.

As you see in my code, I have two arrays that hold the text to display on Zone 0 and 1. My aim to display static text when I switch a preset with footswitches. I would love to have a scroll effects when texts changes but couldnt manage it. To be honest my coding skills is very limited and I am heavly dependent on copy/pasting from other code samples. I am sure you already realized it as soon as you checked my full code. For about the display zone text for loops; this is the best I coould. I tried to remove P.displayAnimate() and P.displayReset() from the for loop but the displays go blank and cannot show anytext when I do that.

OK. If deleting a few variables makes a difference, then I would suggest that you are very close to the limit on your RAM.

One way to free up RAM if you are just printing text is not to use Parola but just the MD_72XX library. The Parola libraries add a bunch of overhead that, if you are not using the animated displays, is unnecessary.

A straight text print example is probably a good one to have for the MD_72XX library. I'll work one out and let you know when I am done. That should make your program smaller and more straightforward.

New example is attached. This just uses the hardware library for printing a string to a ‘zone’ (contiguous modules). The example is already in the Git Repo on codeplex and will become part of the next release.

Hope this helps.

MD_MAX72xx_PrintText.ino (3.72 KB)

You are great Marco, thank you so much for your help and for the example sketch.

All problems solved and my sketch size also went down to 54% from 90%.

NO problems. Karma points always welcome :)