MKR1000 not workling with LedControl and MAX7221

Hello together,

I try since days to get my MKR1000 working with LedControl Library and two Max7221 but with totally no success. The Led matrix is dark. Has anybody an idea what's wrong?

PS: I use a level shifter (3.3=>5 V from SparkFun)



For anyone to even start helping you should post your current schematic and code.
When posting code PLEASE USE THE CODE TAGS ( </> )

Sure. I have 2 Max7221 in row and they work fine with an Arduino Nano and the code I’ve posted here. The only HW change between Nano and MKR1000 I’ve made is the integration of the level shift from 3.3V to 5V.

#include "LedControl.h"

const int dummy = 0;

 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD

LedControl lc=LedControl(12,11,10,2);

//The setup function is called once at startup of the sketch
void setup(void) {

	  while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB port only

	//we have already set the number of devices when we created the LedControl
	int devices=lc.getDeviceCount();
	//we have to init all devices in a loop
	for(int address=0;address<devices;address++) {
		/*The MAX72XX is in power-saving mode on startup*/
		/* Set the brightness to a medium values */
		/* and clear the display */


void loop(void){



I also tested with a minimal example using the SPI Lib, of course now I use the MOSI & CLK Pin according to the Arduino device. But with the same result, working for Arduino Nano, but not with the MKR1000:

//#include <LedControl/src/LedControl.h>
#include <Arduino.h>
#include <SPI.h>
//LedControl lc=LedControl(12,11,10,2);

int maxDevices = 2;
byte spidata[16];
//int SPI_MOSI=12;
//int SPI_CLK=11;
//int SPI_CS=10;
int SPI_CS=7;

void setup()

void loop()


	int numDevices = 2;

	if(numDevices<=0 || numDevices>8 )

	for(int i=0;i<maxDevices;i++) {


void spiTransfer(int addr, volatile byte opcode, volatile byte data) {
	//Create an array with the data to shift out
	int offset=addr*2;
	int maxbytes=maxDevices*2;

	for(int i=0;i<maxbytes;i++)
	//put our device data into the array
	//enable the line
	//Now shift out the data
	for(int i=maxbytes;i>0;i--)
	//latch the data onto the display

void shiftOutSPI( byte dataToSend)
	SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE0));



The first sketch fails here to compile as I don't have that lib installed but the second compiles just fine for a Mini and MKR1000 under IDE 1.6.12 with boards version 1.6.7 for MKR and 1.6.13 for AVR. (found by going TOOLS, Board, Boards Manager)

I suspect a wiring or a voltage supply / current issue at the moment.
Maybe double check your wiring first and then if that is OK maybe supply the LED's with thier own power with only a common ground back to the MKR

Schematics ?
Decent quality pictures ?
Source web site links ?
Have you also checked that all your libs are up to date too ?
Libraries sources links ?

Okay, thank you for the quick answer. I use IDE 1.6.8 with AVR Boards Version 1.6.14 and 1.6.7 for MKR. The LED and the MKR are supplied by an extra regulated power supply at 5V.

The Datasheet to the MAX7221 can be found at e.g.

The second code example only uses build in libraries and should switch all the led's on ... in the test mode. So we can focus on this for debugging.

Currently, I don't have a detailed schematics, but I'll create one, if necessary. As already mentioned, it's working with a ArduinoNano, so maybe it's sufficient to create the schematics only of the MKR1000 part and the SPI connection?

How are you routing the power to (A) the MKR and (B) the display and what is the current / supply capability rating on each ?

Also bear in mind that the level shifter is DIGITAL ONLY and does not up or downshift analog voltages.
Its primary use is SIGNAL level shifting and NOT power. This could well be an issue if you mistake its capability.
That is the reason I suggested seperate PSU's for each.

So I think its back to getting a schematic.


here is the schematic. Of course the LEDs are also connected. Please be lenient with me, I’m not so experienced with eagle :confused: .

Its better than most of anything I turn out LOL.
I can follow a schematic but probably not the best person to fully understand.


Just wondering if there is a reason no ground is used on the other side of the level converter.

And why GND on the MKR goes to VCC on the second 7221 rather than being tied to a common ground back to the MKRmkr1000_max7221_schem 02.png

Added common ground and cut VCC trace and ran to a near VCC point.
I think it looks better.