Pages: 1 ... 18 19 [20]   Go Down
Author Topic: Scrolling LED matrix display - Parola for Arduino  (Read 43592 times)
0 Members and 2 Guests are viewing this topic.
Sydney, Australia
Online Online
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@confusered

It took a while but the answer is obvious (finally!). The pins you are selecting for the creation of the Parola object are the same pins that are defined for native-SPI hardware control. If you use the type of constructor you did, it defaults to non-native control (using these same pins). SDFat uses the same pins but with hardware controls. This overrides the non-native SPI and a mess results for the display.

Changing the constructor so that only the CS pin is defined works. This is the code that works on my system. I have left all the debug code in and you will see it has a slightly different structure. I believe that the implementation of String is buggy, so it is best to avoid it.

Code:
#include <MemoryFree.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>

#define  USE_SDFAT  1

#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 12
#define CS_PIN 10

// Generic output pins
MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);

#define SPEED_TIME 25
#define PAUSE_TIME 2000

char newstring[10] = "1234";
char datastring[10]  = "abcd";

#if  USE_SDFAT
#include <SdFat.h>
SdFat sd;

const int chipSelect = 4;
long index = 0;
#endif

void setup(void)
{
#if  USE_SDFAT
  sd.begin(chipSelect, SPI_FULL_SPEED);
#endif

  P.begin();    //starts parola
//  P.displayScroll(datastring, LEFT, SCROLL_LEFT, SPEED_TIME);
  P.displayText(datastring, CENTER, SPEED_TIME, PAUSE_TIME, SCROLL_LEFT, SCROLL_LEFT);

  Serial.begin(57600);
  Serial.println(F("[SDwithParola]"));
  Serial.print(F("freeMemory()="));
  Serial.println(freeMemory());
}

void loop(void)
{
  if (P.displayAnimate()) // animates and returns true when an animation is completed
  {
    getword();
    strcpy(datastring, newstring);
    Serial.print(F("datastring = "));
    Serial.println(datastring);
    Serial.println();
    P.displayReset();
  }
}

void getword()
{
#if  USE_SDFAT
  SdFile myFile;
  long index;
  
  if (!myFile.open("WORDS.TXT", O_READ))  //Open the file for reading
  {
    strcpy(newstring, "Error");
  }
  else
  {
    index = random(100) * 4;   // offset of a random number from 0 to the word count
    Serial.println(index);
    myFile.seekSet(index);      // go to position
    myFile.read(newstring, 4);  // read the word
    newstring[4] = '\0';
  }

  Serial.print(F("newstring  = "));
  Serial.println(newstring);  // Print the string to serial
  myFile.close();
#endif
}
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, everyone  ...Marco  if you don't mind  i would like to help nikomaz  .

@nikomaz  
Open the MD_MAX72xx folder and then open MD_MAX72xx.h (use notepad)  scroll down to the lines where i'm going to show you in my attachment and change the 0 to 1 at the bottom and 1 to 0 at the top  if I'm getting you confused just copy from my file. then save file and exit.
I'm assuming you have a setup similar to the ICStation boards (the one with SMD chip on the back and use jumpers to attach them together) you probably wired your matrix leds the same way if not use the generic hardware switch which is in the same file but you have to change the upper and lower lines to 0 and the middle to 1,  Hope it works.
 if not post a schematic of your Matrix.

after you done run the Parola examples you may  have to flip the whole display 180.  if your wires on the left side.

Yeap, i know that, I already change that values trying the 3 boards. But only Gereric works but in 90°, ICStation and Parola didn't show anything.


Hola nikomaz!

The orientation of the matrix can be adjusted in the software, but you need to do it in the MD_MAX72xx library. What to do is described in the documentation for the library. You will need to set some compile time switches to make it work - afsaisi has already told you a bit but exactly what you need to do will depend on how your matrix is wired up.

What values do I change? In documentation cant find something about it, only found the modules, but only generic works. So i need to change rows for colums i think. The matrix display is wired anodes in colums to SEG and cathodes in rows to DIG.

I can change the wires DIG and SEG but cant modify the display wired. (anodes colums, cathodes rows)
Logged

Sydney, Australia
Online Online
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Look in the _lib header file. Each of the specifics is converted to a series of other transformations.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look in the _lib header file. Each of the specifics is converted to a series of other transformations.

Thank you Marco! it worked!!! en the _lib header in fact I fix the problem.
Regards
Long live Parola!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I appreciate all your help and I am learning a lot.

I tried your soltion with no success.  I am a bit confused about the use of generic hardware, and the use of the constructor, and the use of USE_GENERIC_HW in the MD_MAX72xx.h file.

The examples show

Code:
// Hardware SPI connection
MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);
// Generic output pins
// MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
//
I took this to mean if you are using the generic hardware devices, you needed to use the generic output pins constructor.  Now i'm starting to think the above comments apply only to SPI pins.

I set my MD_MAX72xx.h file to "#define   USE_GENERIC_HW   1" and the other two choices to 0.

Using my first posted code where I use Parola to display the word TEXT only, All works well with the constructor:

Code:
#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 12
#define CS_PIN 10
// Generic output pins
MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

In the same example, If I use the constructor with DATA_PIN and CLK_PIN removed, It will not work.  (display is jumbled and static or all on).

I must be missing something.  I'm using the generic eBay displays since I had them already.  I can get some different ones if that's what it takes.  I really want to get this working.  I did order some a couple weeks back that look like the ICSTATION ones. (about 4 weeks delivery to my location)

Can you tell me which HW setup you have this working on and how you have the USE_x_HW switches set in the MD_MAX72xx.h file.

Thanks again
Logged

Sydney, Australia
Online Online
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The USE_HW is used to select the type of hardware module that you have got.

Irrespective of the hardware, the interface to the hardware is the same (SPI). SPI can be implemented in software or you can use the CPU supported hardware implementation. If you specify all the pins, then the library will assume that you are implementing the software version of SPI. If you only specify the CS pin then it defaults to the hardware implementation, where the pins are set by the type of hardware CPU you use.

All of this is in the MD_MAX72xx library documentation.

My setup is for an Arduino Uno and I use the Parola module.
« Last Edit: July 27, 2014, 03:00:25 pm by marco_c » Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Marco,

Still having trouble and don't want to be a pain, but I thought I'd provide the current situation.  Using your example code above with Uno and now ICSTATION displays, I get the following results.  I added in the line for defining generic SPI pins as part of the experiment.  I understand the display choice is independent of the SPI setup.  It appears we are using similar hardware but getting different results.  Since each function (SD and Matrix display) are working under at least one condition, I assume the hardware is all connected up correctly.  It seems mine just does not want to work using the hardware SPI.

Conditions:

"USE_SDFAT 0" & "MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);" = Matrix display WORKING

"USE_SDFAT 0" & "MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);" = Matrix display NOT working

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);" = Matrix display NOT working, SD working

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);" = Matrix display NOT working, SD working

I am using the following versions downloaded on July 19.
MD_MAX72xx_v2.4_20140406
MD_Parola_v2.0_20140329
and
Arduino 1.0.5-r2
sdfatlib20131225

Thanks and G'day from Virginia USA
Logged

West Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm just jumping in right here with my questions about Parola 2.0. I've made a lot of cool little signs with 6 and 8 matrices using Parola 1, they've turned out so cool.  smiley-cool

Now I'm hitting a brick wall with 2. I've setup a little test piece: basic ebay 2 max7219 matrix boards wired together with a potentiometer to vary speed. This little setup works perfectly for all my testing with Parola v1. The code I typically use is a variation of Parola_Display. I've made several signs with it and have just added to the curText because that's really all I know how to code  smiley!

My problem is this: To setup Parola 2, I remove the folders with the old libraries Max7219 and Parola out of my libraries subfolder. They are called MD_MAX72xx and MD_Parola. I have the two zip files, MD_MAX72xx_v2.4_20140406.zip & MD_MAX72xx_v2.4_20140406.zip. I uncrunch them and copy those folders to the same libraries folder. I run the Arduino IDE for Windows, load an example, change the data pins to how mine is setup, compile and upload, get a normal ending and all I get is all solid lights on all matrices. Some of the example don't compile because I haven't put the keys library in yet.

#define   MAX_DEVICES   2
#define   CLK_PIN      10
#define   CS_PIN           9
#define   DATA_PIN   8
&
#define   SPEED_IN   A0 (A5 in examples)
this is all I change.

Then I reverse the whole thing, put back the old libraries, compile and upload the old program and everything works again.  

Doing the same on Linux (Ubuntu 12 LTS) does exactly the same thing.   smiley-confuse

Recently upgrading from Ubuntu 12 to 14 has completely destroyed my Arduino IDE because of some strange avrdude bug-this is another issue altogether.

Could my hardware be a problem? Doesn't like 2.0? Am I not getting how to install the new libraries? Head is really hurting.
Thanks for hearing me out!
Richard



* simple test setup.jpg (106.39 KB, 420x287 - viewed 6 times.)
« Last Edit: July 30, 2014, 01:41:56 am by OSComputing » Logged

Early to bed and early to rise makes a man healthy, wealthy, and wise.
        --Benjamin Franklin

Well, it's a good goal to shoot for..

Sydney, Australia
Online Online
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@confusered

Can you try to test using different SPI pins for the sd and display?
Also, is that the latest version of sdfat? Not near my computer at the moment...

Edit: SDFAT is the same version as mine.
« Last Edit: July 30, 2014, 05:05:58 am by marco_c » Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Sydney, Australia
Online Online
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@oscomputing

I have sent yo a new version of the library to try. There were a couple of bugs in V2 that have been corrected and this is pre release.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Marco,  Here are some more test conditions with various CS pins.  Display still never works with hardware SPI.

Conditions 7/30/14
"USE_SDFAT 0" & "MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN = 10, MAX_DEVICES);" = Matrix display WORKING

"USE_SDFAT 0" & "MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN = 8, MAX_DEVICES);" = Matrix display WORKING

"USE_SDFAT 0" & "MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN = 9, MAX_DEVICES);" = Matrix display WORKING

"USE_SDFAT 0" & "MD_Parola P = MD_Parola(CS_PIN = 10, MAX_DEVICES);" = Matrix display NOT working

"USE_SDFAT 0" & "MD_Parola P = MD_Parola(CS_PIN = 8, MAX_DEVICES);" = Matrix display NOT working

"USE_SDFAT 0" & "MD_Parola P = MD_Parola(CS_PIN = 9, MAX_DEVICES);" = Matrix display NOT working

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN = 10, MAX_DEVICES);" = Matrix display NOT working, SD Working w/ CS = 4

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN = 10, MAX_DEVICES);" = Matrix display NOT working, SD Working w/CS = 5

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN = 9, MAX_DEVICES);" = Matrix display NOT working, SD Working w/CS = 5

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN = 8, MAX_DEVICES);" = Matrix display NOT working, SD Working w/CS = 5

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN = 5, MAX_DEVICES);" = Matrix display NOT working, SD Working w/CS = 4

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN = 5, MAX_DEVICES);" = Matrix display NOT working, SD NOT Working w/CS = 1

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(CS_PIN = 5, MAX_DEVICES);" = Matrix display NOT working, SD  Working w/CS = 2

"USE_SDFAT 1" & "MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN = 5, MAX_DEVICES);" = Matrix display NOT working, SD working W/CS = 2

Thanks again.
Logged

Sydney, Australia
Online Online
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, I was not clear. I meant use DATA and CLK pins different from the hardware pins, to avoid any contention issues. With the two different data streams, if the displays still don't work with just software SPI, then you are looking at a fundamentally different problem to chase down.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Marco.  I just tried the following setup and the display works and SD card does not.  I can now see the "Error" message on the matrix display.

USE_SDFAT  1 or 0 w/CS = 10 or 7  &  MD_Parola P = MD_Parola(DATA_PIN = 8, CLK_PIN = 9, CS_PIN = 5, MAX_DEVICES);


Regards,
Logged

Pages: 1 ... 18 19 [20]   Go Up
Jump to: