MAX7221 dont work when connected to DIG-pin

hi!

Im trying to use a MAX7221 on a 7-segment display.
But i cant get it to work. It flashes very dim for like 0.5s then it go black.
I have tested every single LED independently with just power and a resistor and they all work fine.
I have blue LED and I use 27K resistor as Iset.
5V
3.3V forward
20mA current

If i connect the CC-pin from the 7-Segment to ground via 100Ohm it work. But i suppose its not the right way and probably will damage the chip.
Connect CC to DIG0 and it just flash dim for 0.5s and then go black.
Is it a faulty chip or do i do something wrong here?
Code:

/*
  Basic code for using Maxim MAX7219/MAX7221 with Arduino.

  Wire the Arduino and the MAX7219/MAX7221 together as follows:

  | Arduino   | MAX7219/MAX7221 |
  | --------- | --------------- |
  | MOSI (11) | DIN (1)         |
  | SCK (13)  | CLK (13)        |
  | I/O (7)*  | LOAD/CS (12)    |

    * - This should match the LOAD_PIN constant defined below.
  
  For the rest of the wiring follow the wiring diagram found in the datasheet.
  
  Datasheet: http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf

  Author:  Nicholas Dobie <nick@nickdobie.com>
  Date:    30 December 2013
  License: WTFPL (http://www.wtfpl.net/)
 */
#include <SPI.h>
 
// What pin on the Arduino connects to the LOAD/CS pin on the MAX7219/MAX7221
#define LOAD_PIN 7
 
/**
 * Transfers data to a MAX7219/MAX7221 register.
 * 
 * @param address The register to load data into
 * @param value   Value to store in the register
 */
void maxTransfer(uint8_t address, uint8_t value) {
 
  // Ensure LOAD/CS is LOW
  digitalWrite(LOAD_PIN, LOW);
 
  // Send the register address
  SPI.transfer(address);
 
  // Send the value
  SPI.transfer(value);
 
  // Tell chip to load in data
  digitalWrite(LOAD_PIN, HIGH);
}
  
 
void setup() {
  
  // Set load pin to output
  pinMode(LOAD_PIN, OUTPUT);
 
  // Reverse the SPI transfer to send the MSB first  
  SPI.setBitOrder(MSBFIRST);
  
  // Start SPI
  SPI.begin();
 
  // Run test
  // All LED segments should light up
  maxTransfer(0x0F, 0x01);
  delay(1000);
  maxTransfer(0x0F, 0x00);
  
  // Enable mode B
  maxTransfer(0x09, 0xFF);
  
  // Use lowest intensity
  maxTransfer(0x0A, 0x00);
  
  // Only scan one digit
  maxTransfer(0x0B, 0x00);
  
  // Turn on chip
  maxTransfer(0x0C, 0x01);
  
  
  
}
 
void loop() {
  
  // Loop through each code
  for (uint8_t i = 0; i < 0x10; ++i)
  {
    maxTransfer(0x01, i);
    delay(1000);
  }
  
}

Read the instructions.

Show your connections.

Show a perfectly focused photo of your setup. As a link in the posting, not using "Attachments and other options".

Post your code - using "code" tags - the first "</>" icon above the "Preview" window.

ehel:
Is it a faulty chip or do i do something wrong here?

Hi, yes it could be one of those two things, but we can't tell you which because you have not given a schematic or your sketch. Please provide both and use code tags for your sketch.

Paul

Picture and code added.
Sorry for bad picture. Hard to get a good picture with all wires.

I can't see a problem with your sketch. Your pictures are not clear and do not show the display. Can you draw a schematic? Hand drawn on paper and scanned or photo will be ok.

Try 47K instead of 27K for the iset resistor. There is a paragraph at the top of page 10 of the data sheet that talks about max current when only 1 to 3 digits are used. It says max segment current should be 10mA for 1digit, and for 3.5V Vf leds this corresponds to a 50K iset resistor.

Connect CC to DIG0 and it just flash dim for 0.5s and then go black.

Is it 0.5s or 1s? Your sketch performs a 1s led test at the start.

Try this change:

  // Use lowest intensity
  maxTransfer(0x0A, 0x0F);

Also I don't see any caps in your pics. You should have 0.1uF and 10uF close to the max's power pins.

Paul__B:

  • Show your connections.
  • Show a perfectly focused photo of your setup. As a link in the posting, not using "Attachments and other options".
  • Post your code - using "code" tags - the first "</>" icon above the "Preview" window.

Ah well, I suppose one out of three isn't bad!

I will have to go and find a computer that can deal with bodgie attachments. This one wants to open them with gedit! :astonished: