Maxim MAX7219 LED driver not booting up blank (with or without Picaxe attached)

OLDmarty

Senior Member
#1
Hi All,

I recently bought a small Maxim MAX7219 LED dot-matrix display to play with.

After reading through the 7219 data sheet closely, i found it quite easy to control this chip.

However, When the matrix powers up, there is a brief flash of ALL LEDS (well, maybe 3 or 4 don't flash on).


Straight from the data sheet:

Code:
Initial Power-Up
On initial power-up, all control registers are reset, the
display is blanked, and the MAX7219/MAX7221 enter
shutdown mode. Program the display driver prior to
display use. Otherwise, it will initially be set to scan one
digit, it will not decode data in the data registers, and
the intensity register will be set to its minimum value.
I've programmed all the 7219 registers in my picaxe code to initialise correctly, but the data sheet doesn't show any preferable order that the 7219 should be initialised.

Has anyone had this experience? and is there a preferred order of setup codes that should be sent to the 7219 to make it bootup blank instead of a flash of LEDs?


Thanks in advance.
 

hippy

Technical Support
Staff member
#2
I've programmed all the 7219 registers in my picaxe code to initialise correctly, but the data sheet doesn't show any preferable order that the 7219 should be initialised.
Perhaps post your code so it can be checked that it's not doing anything to flash the LED's. At start-up the display should be blanked so nothing should flash. It may be that you are actually setting LED's before clearing them.

The code I have for my program which initialises a 7219 for an LED matrix is -

Code:
; Turn the display off. Enable all rows.
; Set no decoding mode for all rows. Blank
; the rows. Turn the display on.
  
Out16( $0F00 )            ; Ensure test mode is off
Out16( $0C00 )            ; Display off
Out16( $0BFF )            ; All rows used
Out16( $0900 )            ; Segment display
Out16( $0100 )            ; Row 1 = Blank
Out16( $0200 )            ; Row 2 = Blank
Out16( $0300 )            ; Row 3 = Blank
Out16( $0400 )            ; Row 4 = Blank
Out16( $0500 )            ; Row 5 = Blank
Out16( $0600 )            ; Row 6 = Blank
Out16( $0700 )            ; Row 7 = Blank
Out16( $0800 )            ; Row 8 = Blank
Out16( $0C01 )            ; Display on
I don't recall any flashing of LED's but I rarely power it off and on while testing my code.
 

OLDmarty

Senior Member
#3
Thanks Hippy, OK, here's a quick listing of what i do to initialise the 7219 before sending the main code to it.

I read in the data sheet that the 7219 can still be programmed while sleeping, and i *think* i should be turning OFF the led test mode 1st, instead of 2nd, as per my sequence below...

Sorry i don't have my final working code handy, i'm not at work, but this is the exact order of things i'm sending to the 7219.


Code:
Initialise:

;set the 'load-7219' pin LOW
;set the 'clock-7219' pin LOW
;set the 'datain-7219' pin LOW

; SETUP 7219 matrix chip to start accepting valid data and displaying LEds...

;Turn 7219 chip ON, (get 7219 out of shutdown mode):
;
SHIFTOUT Clock-7219, Datain_7219, MSBFirst_L, ($0C, $01)
PULSOUT load-7219, 1


;Turn OFF the LED Test mode.
;
SHIFTOUT Clock-7219, Datain_7219, MSBFirst_L, ($0F, $00)
PULSOUT load-7219, 1


;Set display INTENSITY to around 50%
;
SHIFTOUT Clock-7219, Datain_7219, MSBFirst_L, ($0A, $07)
PULSOUT load-7219, 1


;Set NUMBER of display digits to enable (all 8, for 64 leds or 8x 7-seg displays)
;
SHIFTOUT Clock-7219, Datain_7219, MSBFirst_L, ($0B, $07)
PULSOUT load-7219, 1


;Set DECODE MODE - OFF for this test (mainly ON for 7-seg display stuff)
;
SHIFTOUT Clock-7219, Datain_7219, MSBFirst_L, ($09, $00)
PULSOUT load-7219, 1


;BLANK out ALL 8 Displays to clear their contents.


pause 1 second


Start main code loop (LED patterns and/or 7-seg stuff)
 

OLDmarty

Senior Member
#4
On another note, when the 7219 LED matrix board is powered up by itself (NOT connected to a picaxe) it still flashes "all leds" briefly (except 3 or 4 leds).
(Note that ALL leds are fully controllable by my LED-pattern codes, so it's not a faulty driver or matrix display.

The display never used to flash like this upon powerup, so i can't help feeling i've "set" something in the 7219 via my picaxe coding.

As a reference, I bought a 2nd 7219 matrix board today ($8), and without programming anything into it, it does not flash anything at power up (no picaxe connected).
 

OLDmarty

Senior Member
#6
http://www.picaxeforum.co.uk/showthread.php?16812-OT-Cheap-Chinese-ICs ... perhaps? (especially see post #41 though)

...I can't believe that the 7219 on an $8 board (got a link?) will be a genuine Maxim full-spec device.
Ahhh, yes, i never considered the chinese flakey chips.
Bare in mind, the chip responds and does everything i instruct it to do, all rows/columns are working as expected and i have no problems turning particular LED(s) on or off at any given time.

My only slight concern as per OP, is the bootup flash when the data sheet clearly says it boots up with all registers cleared and in sleep mode....something to consider and i should buy a real chip ($20) and compare the 2 outcomes.

Here's where i bought it locally in Australia: https://www.jaycar.com.au/arduino-compatible-8-x-8-led-dot-matrix-module/p/XC4499
 

hippy

Technical Support
Staff member
#7
It may be a 'dodgy chip' but I would have suspected it's sending the Turn Display Command On ($0C01) before having explicitly cleared all the data registers. Once on it could will be displaying whatever random garbage is in those data registers.

It does seem odd that it displays anything when powered-up and not connected to anything. I guess if the PICAXE stops it displaying, prevents any flash, it doesn't really matter.

Those who clone other people's chips may not replicate them exactly but they would normally do enough to not have them appear faulty or behave unacceptably at turn on.
 

OLDmarty

Senior Member
#8
It does seem odd that it displays anything when powered-up and not connected to anything. I guess if the PICAXE stops it displaying, prevents any flash, it doesn't really matter.
This is the problem, even when the picaxe is connected, the display STILL flashes at powerup when it shouldn't.

The matrix display never flashed at powerup when i first got it. It's only since i've been using the picaxe to initialise/clear/turn-on the 7219 that it now flashes during powerup, even on it's own.

I can't help feeling i've internally 'set' (or corrupted) a register in the 7219.
 

hippy

Technical Support
Staff member
#9
There is no non-volatile memory in the 7219 so no way to accidentally program it to do something it should not be doing at turn-on.

This seems to be a chip hardware issue and, if disabling the display immediately at turn-on when connected to the PICAXE does not prevent the unwanted flash, then it would seem to be a case of either live with that or replace the chip.
 

Circuit

Senior Member
#10
It may be a 'dodgy chip' but I would have suspected it's sending the Turn Display Command On ($0C01) before having explicitly cleared all the data registers. Once on it could will be displaying whatever random garbage is in those data registers.

It does seem odd that it displays anything when powered-up and not connected to anything. I guess if the PICAXE stops it displaying, prevents any flash, it doesn't really matter.

Those who clone other people's chips may not replicate them exactly but they would normally do enough to not have them appear faulty or behave unacceptably at turn on.
Perhaps the photos in this post may help in checking the veracity of the chip that you have; http://forum.arduino.cc/index.php?topic=233109.0
 

techElder

Well-known member
#12
Apparently, the 8x8 display modules that I use in my testing prototypes are "FAKE" (according to that website), but I have had absolutely no problems with them. They seem to work in every way that I've used them.

Until looking at that photo of the 7219 die showing "1996", I didn't realize the design was 20 years old!

Someone on that forum from the link above mentioned that they bought their 7219s from Sparkfun, so I looked and found a little discrepancy.

The photo of the IC item itself: https://www.sparkfun.com/products/9622

The photo of the KIT item: https://www.sparkfun.com/products/11861

The kit clearly shows a "FAKE" 7219 ic. :D

You can decide what that means.
 
#13
This is my "clear / clean" start up routine .. So the first thing you write to the display - is the first thing the display shows.
PS .. big thanks to many members of this forum, over the years, for stimulating my use of these PICAXE chips for many of our sailing club timing devices .....

Code:
'****************************************************	
'*        main INITIALISATION starts hear          **
'****************************************************
symbol decode    =  9		' decode register; specify digits to decode
symbol brite     = 10		' intensity (brightness) register; 15 = 100%
symbol scan      = 11		' scan-limit register; specify how many digits
symbol on_off    = 12		' 1 = display on; 0 = display off 
symbol Disptest  = 15		' 1 = display test(default); 0 = display normal 

 	maxreg  = scan			' MAX7219 > set scan limit for digits 0-7
  	outbyte = 7	:  	gosub shoutbb
  	 
  	maxreg  = brite			' MAX7219 > set brightness to 5 (15 = 100%)
  	outbyte = 4 :   	gosub shoutbb
  	
  	maxreg  = decode			' MAX7219 > set BCD decoding 
  	outbyte = %11111111 : gosub shoutbb	'   > set for decode mode B

	maxreg  = Disptest		' MAX7219 > tests all segments
  	outbyte =  0 :  	gosub shoutbb
  	
	maxreg  = on_off			' MAX7219 > turn display off
  	outbyte = 0 :  	gosub shoutbb 
		
	Maxreg  =  8 :  	outbyte = %01111111 :  	gosub shoutbb	'Blank / empty digits 8 - 1 registers
	Maxreg  =  7 :  	outbyte = %01111111 :  	gosub shoutbb
	Maxreg  =  6 :  	outbyte = %01111111 :  	gosub shoutbb
	Maxreg  =  5 :  	outbyte = %01111111 :  	gosub shoutbb
	Maxreg  =  4 :  	outbyte = %01111111 :  	gosub shoutbb
	Maxreg  =  3 :  	outbyte = %01111111 :  	gosub shoutbb
	Maxreg  =  2 :  	outbyte = %01111111 :  	gosub shoutbb
	Maxreg  =  1 :  	outbyte = %01111111 :  	gosub shoutbb
  	
	maxreg  = on_off			' MAX7219 > turn display on
  	outbyte = 1 :  	gosub shoutbb
 
Top