Arduino mega using dmd library (SOLVED)

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
Ipin17
Posts: 5
Joined: Sun Dec 29, 2019 8:01 am

Arduino mega using dmd library (SOLVED)

Post by Ipin17 » Sun Dec 29, 2019 8:30 am

Hi,
Sorry if my subject may exist before, i try to search but not find with users has a problem like me.

I already using dmd library for my uno, but later i need more bigger flash and ram also, so i try to using my mega 2560 to running my old code.

I know mega has different spi pin using 51 and 52. I move clk and sclk to these pins and run my code.

Compiled fine but my dmd matrix is not display correctly. Some times goes blank or displays randomly. The strangest thing is when i touch pins with my finger, suddenly it displays but with flickering, when i not touch again, display will gone (may blank or random pixel again). Is i miss something here?, because when i search this sub topic i found many users using dmd library with their mega 2560. My dmd library is untouched and using standard dmd pin assignment except spi pins moved to mega spi pins.

Please dont suggest me using dmd2 library, i simply dont like it and not want to change my old code.

Please help me.
Thanks
Last edited by Ipin17 on Mon Dec 30, 2019 2:39 pm, edited 1 time in total.

Brissieboy
Posts: 190
Joined: Fri Sep 20, 2013 7:25 am

Re: Arduino mega using dmd library

Post by Brissieboy » Sun Dec 29, 2019 10:21 am

It sounds like you might have an unconnected input if a finger touch changes things. Make sure all pins are connected correctly and all the mega ouput pins being used are correctly set as outputs.
Use a pulldown resistor on the OE line - but that should not be the cause of your issue here.
And also power your DMDs from a good separate 5V supply (around 2A or more per DMD).
Clock speed should be the same for both the uno and the mega so SPI speed should not be a problem.

Ipin17
Posts: 5
Joined: Sun Dec 29, 2019 8:01 am

Re: Arduino mega using dmd library

Post by Ipin17 » Sun Dec 29, 2019 10:58 am

Thanks brissieboy,

Im sure there are no pin unconnected, for your info, if i try to rum dmd2 library, it works correctly with its marquee demo (i change dmd2.cpp pin assignment using mega spi pin). Same at pulldown/pullup resistor, i also already try yesterday using 10k resistor between noe and gnd or 5v pin, no effect.

I forgot to told that im not using dmdconn, just using jumper cable between dmd ribbon cable and uno/mega pins. My dmd panel are 2 in series and using regulated 5v 20a power supply. This dmd panel are running using uno almost 3 months without problem in my office, then need upgrade for our information system makes me thinking using mega for better support.

Please help me, i try almost 3 days without luck 😅

Brissieboy
Posts: 190
Joined: Fri Sep 20, 2013 7:25 am

Re: Arduino mega using dmd library

Post by Brissieboy » Sun Dec 29, 2019 11:26 pm

Did you change the #defines in DMD.h for the DMD pins to suit those you are using with the mega??
Set like this by default but can be edited:

Code: Select all

#define PIN_DMD_A         6    // D6
#define PIN_DMD_B         7    // D7
#define PIN_DMD_CLK       13   // D13_SCK  is SPI Clock if SPI is used
#define PIN_DMD_SCLK      8    // D8
#define PIN_DMD_R_DATA    11   // D11_MOSI is SPI Master Out if SPI is used
If it worked using DMD2 with the altered pin assignment then it is very likely something to do with the pins you are using and how they are set up.

Ipin17
Posts: 5
Joined: Sun Dec 29, 2019 8:01 am

Re: Arduino mega using dmd library

Post by Ipin17 » Mon Dec 30, 2019 1:02 am

Hi Brissieboy,

Yes i change pin assignments in dmd.h like this :

Code: Select all

#define PIN_DMD_A         6    // D6
#define PIN_DMD_B         7    // D7
#define PIN_DMD_CLK       52   // D13_SCK  is SPI Clock if SPI is used
#define PIN_DMD_SCLK      8    // D8
#define PIN_DMD_R_DATA    51   // D11_MOSI is SPI Master Out if SPI is used

Is it correct?.

Last night my new mega 2560 pro embed from robotdyn has arrived, so i try with this little board, even with a new dmd panel and new ribbon cable, also same result, i really got frustrated now, i check my cable connections, dmd libraries, my codes, but i think all is correct. If this problem cannot solved, i will back using uno/nano with external eeprom module although i must change the program codes globally.

If there are any mega 2560 user using dmd library and had no problem, please help me mate :| , maybe tonight i will post a video about my connection and result on dmd panel

Brissieboy
Posts: 190
Joined: Fri Sep 20, 2013 7:25 am

Re: Arduino mega using dmd library

Post by Brissieboy » Mon Dec 30, 2019 3:29 am

The mega can successfully run the DMD library and drive the DMDs - same as a Uno except for the SPI pins. Plenty have done that.
My next suggestion would be to start a new test sketch and run just the DMD demo sketch - nothing else added and no changes. If that does not work then you definitely have a problem with your hardware which has to be the interconnections since you say it works correctly using the DMD2 library.
If you have modified the DMD library, download a new copy and use that (with just the #define changes for the mega SPI).
And make sure you have the DMD power supply negative connected to the mega ground.

Ipin17
Posts: 5
Joined: Sun Dec 29, 2019 8:01 am

Re: Arduino mega using dmd library (SOLVED)

Post by Ipin17 » Mon Dec 30, 2019 2:19 pm

Gotcha, i finally found the culprit
i replace PIN_OTHER_SPI_nCS value in dmd.h, before 10, i try to change to 1, and dmd panel displays correctly with mega

Code: Select all

#define PIN_OTHER_SPI_nCS 1 // Original value is 10
i change it to 1 is no specific, because i'm not using another module that use spi pins other than dmd

Brissieboy
Posts: 190
Joined: Fri Sep 20, 2013 7:25 am

Re: Arduino mega using dmd library (SOLVED)

Post by Brissieboy » Mon Dec 30, 2019 11:21 pm

Great news. Always very satisfying when you fix something that has been frustrating you for a while.

Ipin17
Posts: 5
Joined: Sun Dec 29, 2019 8:01 am

Re: Arduino mega using dmd library (SOLVED)

Post by Ipin17 » Tue Dec 31, 2019 4:35 am

Thanks Brissieboy,

This case may help others that have same problem like me ;)

Post Reply