Go Down

### Topic: MD_MAX72xx strange behavior [SOLVED] (Read 1 time)previous topic - next topic

#### jeremix

##### Dec 01, 2017, 07:50 amLast Edit: Dec 04, 2017, 07:46 pm by jeremix
Hello,

I'm trying to use a chinese 32x78 led matrix with max7219 chip.

I can use it successfully with the library LedControl, and the whole matrix seems in good working condition.

I can also run the sketch MD_MAX72xx_HW_Mapper.

But the other examples of the MD_MAX72x library lead to strange results, chaotic response.

Is there a fundamental difference between the MD_MAX72xx_HW_Mapper sketch and the others of the library ?

#### jeremix

#1
##### Dec 01, 2017, 12:54 pm
It seems that my configuration is (according to the MD_MAX72xx_HW_Mapper test)

Code: [Select]
#define HW_DIG_ROWS 0#define HW_REV_COLS 0#define HW_REV_ROWS 1

which is documented like this in the header :
"Combinations not listed here have probably not been tested and may not work correctly "

Is somebody have faced the same problems ?

#### marco_c

#2
##### Dec 01, 2017, 11:43 pm
Provide a link to the hardware so we can see what you are doing.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

#### jeremix

#3
##### Dec 02, 2017, 09:28 am

My hardware is what you call "generic", a chinese one.

I'm using an Arduino Uno.

My wiring is like this
Arduino Uno - Matrix Dot
+5v -> Vin
Gnd -> Gnd
pin 12 Data -> DIN
pin 11 CLK -> CLK
pin 10 CS -> CS

I made some tests this morning, I changed the matrix (I have several), and I changed the Arduino.
Same results.

I made the MD_MAX72xx_HW_Mapper test with the matrix like this :

||||      up
I----I
I     I
I----I
I     I
I----I
I     I
I----I
I     I
I----I   down

So as I said, in this orientation, the test give me this result :
Code: [Select]
#define HW_DIG_ROWS 0#define HW_REV_COLS 0#define HW_REV_ROWS 1

So I changed the MD_MAX72xx_lib.h to :
Code: [Select]
#if USE_OTHER_HW     // user defined custom hardware configuration//#pragma message "OTHER HW selected"#define HW_DIG_ROWS 0 ///< MAX72xx digits are mapped to rows in on the matrix#define HW_REV_COLS 0 ///< Normal orientation is col 0 on the right. Set to 1 if reversed#define HW_REV_ROWS 1 ///< Normal orientation is row 0 at the top. Set to 1 if reversed#endif

and the MD_MAX72xx.h to :
Code: [Select]
/** \def USE_OTHER_HW Set to 1 to use other hardware not defined above. Module 0 (Data In) must be set up on the RHS and the CUSTOM hardware defines must be set up in the MD_MAD72xx_lib.h file under for this section, using the HW_Mapper utility to work out what the correct values to use are. */#define USE_OTHER_HW 1

Is there anything wrong in this configuration ?
I tried to reverse (180°) the matrix, and change the config files but without success.

" Module 0 (Data In) must be set up on the RHS"

What do you call RHS ?

#### marco_c

#4
##### Dec 02, 2017, 09:38 am
That looks like one of those 4 connected modules. They are usually fc-16 type, not generic.

How is that a 32x78 display as per your opening post?
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

#### jeremix

#5
##### Dec 02, 2017, 11:00 am
Yes I forget to mention that I use a 4 connected module.

And it's a 32x8. Wrong typing

I just tried the MD_MAX72xx_HW_Test with fc-16 settings.

The whole matrix light up and strange characters sometimes appears...

#### marco_c

#6
##### Dec 02, 2017, 11:26 amLast Edit: Dec 02, 2017, 11:27 am by marco_c
Forget using hw-test and just set fc-16 in the library. Then make sure you are starting the Parola library with the right parameters or you have the right pins connected for hardware spi.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

#### jeremix

#7
##### Dec 02, 2017, 12:03 pm
My MD_MAX72xx.h :
Code: [Select]
/** * \file * \brief Main header file for the MD_MAX72xx library *//** \def USE_PAROLA_HW Set to 1 (default) to use the Parola hardware modules. The software was originally designed to operate with this hardware type. */#define USE_PAROLA_HW 0/** \def USE_GENERIC_HW Set to 1 to use 'generic' hardware modules commonly available, with connectors at the top and bottom of the PCB, available from many sources. */#define USE_GENERIC_HW 0/** \def USE_ICSTATION_HW Set to 1 to use ICStation DIY hardware module kits available from http://www.icstation.com/product_info.php?products_id=2609#.UxqVJyxWGHs This hardware must be set up with the input on the RHS. */#define USE_ICSTATION_HW 0/** \def USE_FC16_HW Set to 1 to use FC16 hardware module kits. FC16 modules are similar in format to the ICStation modules but are wired differently. Modules are identified by a FC-16 designation on the PCB  */#define USE_FC16_HW 1/** \def USE_OTHER_HW Set to 1 to use other hardware not defined above. Module 0 (Data In) must be set up on the RHS and the CUSTOM hardware defines must be set up in the MD_MAD72xx_lib.h file under for this section, using the HW_Mapper utility to work out what the correct values to use are. */#define USE_OTHER_HW 0/** \def USE_LOCAL_FONT Set to 1 (default) to enable local font in this library and enable loadChar() and related methods. If the library is just used for graphics some FLASH RAM can be saved by not including the code to process font data. The font file is stored in PROGMEM. */#define USE_LOCAL_FONT 1/** \def USE_INDEX_FONT Set to 1 to enable font indexing to speed up font lookups - usually disabled. This will trade off increased stack RAM usage for lookup speed if enabled. When disabled lookups will then become linear searches through PROGMEM. Uses ASCII_INDEX_SIZE elements of uint16_t (512 bytes) if enabled. For most purposes the increase in speed is not needed. USE_LOCAL FONT must be enabled for this option to take effect. */#define USE_INDEX_FONT 0// Display parameter constants// Defined values that are used throughout the library to define physical limits#define ROW_SIZE 8 ///< The size in pixels of a row in the device LED matrix array#define COL_SIZE  8 ///< The size in pixels of a column in the device LED matrix array#define MAX_INTENSITY 0xf ///< The maximum intensity value that can be set for a LED array#define MAX_SCANLIMIT 7   ///< The maximum scan limit value that can be set for the devices

I checked et rechecked my wiring and the pin assignement in the sketch.

I tried to run the Parola_HelloWorld.
The whole matrix light up and that's all.

#### jeremix

#8
##### Dec 02, 2017, 03:49 pm
It's very frustrating

I continue my project with the LedControl library and this 32x8 matrix, but I must complete this project by a 96 x 16 matrix.
And with all the searches I've made, I think I will need you library !

#### marco_c

#9
##### Dec 02, 2017, 10:27 pmLast Edit: Dec 02, 2017, 10:27 pm by marco_c
I am pretty sure you have not got incompatible hardware. Most 'problems' are usually people not reading documentation, code comments or following instructions.
Quote
+5v -> Vin
Gnd -> Gnd
pin 12 Data -> DIN
pin 11 CLK -> CLK
pin 10 CS -> CS
0. Make sure you are using the latest versions of both libraries.

1. If you are using a separate power supply make sure the GND for this module is connected to the GND on the Arduino.

2. At the top of any of the examples is this:
Code: [Select]
// Define the number of devices we have in the chain and the hardware interface// NOTE: These pin numbers will probably not work with your hardware and may// need to be adapted#define MAX_DEVICES 4#define CLK_PIN   13#define DATA_PIN  11#define CS_PIN    10// Hardware SPI connectionMD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES);// Arbitrary output pins// MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

If you are using the Hardware SPI connection then the pins (CLK, DATA, CS) on a Uno must be as per the code (13, 10, 11) not the ones you have (11, 12, 10).

If you are not using Hardware SPI, then you need to comment out the hardware SPI variable declaration and uncomment the one below for Arbitrary output pins. Then you can use whatever you like but the performance is lower.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

#### jeremix

#10
##### Dec 04, 2017, 06:48 pm
Thanks for the help !

And you were so right when you say "Most 'problems' are usually people not reading documentation, code comments or following instructions."

The problem was the spi connection. I didn't noticed the uncomment trick for arbitrary pins...

As I have the luck to speak with you, do you think I can achieve my 96x16 matrix  (6 of the 4 connected modules) with one single SPI connection, in terms of performance ?

#### marco_c

#11
##### Dec 04, 2017, 08:55 pm
Quote
As I have the luck to speak with you, do you think I can achieve my 96x16 matrix  (6 of the 4 connected modules) with one single SPI connection, in terms of performance ?
No problems with that setup for hardware SPI. I have no experience with software SPI with that many but it should work. It is just a LOT slower.

If "x16" you intent double height display, then be aware there seems to be an intermittent bug with multi zone displays height that has been discussed on other forum threads. Still no solution at the time of this post.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

#### jeremix

#12
##### Dec 06, 2017, 08:52 am
Yes I wanted to do a double height sketch project.