Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Controlling more than 1 Max7219 (goal is 6)


Best Answer vader7071, 23 January 2014 - 03:20 PM

Ok, here is a copy of the files I am using in a txt format.   First off.  Thank you to Paul Newton on the forum and to Paul from Baltimore Hackerspace.  (Yeah, I thought the same thing until I realized P. Newton is from the UK).  These 2 gentlemen have been so patient helping me solve this problem and have taught me so much.   Now, onto the solution.  I realize this in not the "end all be all" solution.  There are probably more ways to do this, and I am sure I will learn them in time, but this is what I have now.   Finding code to control 1 Max7219 was fairly easy.  I did notice a common thread though.  Most every successful max7219 program had an external file called max7219.cs (or some variant there of).  This external file setup the chip and setup the spi configuration.  But we are not talking about 1 chip here, we want more.   So with the help of the Pauls, here is what I have.   Setup.  I am running multiple max7219 chips to an 8x8 led grid.  Here is what I am using.   program.cs is the guts.  This is where you make the display you want.  max7219.cs is the chip driver.  Without this file, it won't work.   Notes in max719.cs first.  To run multiple chips, there is a section titled "maxDouble".  Looks like:  

// Sends 1 Command / Data pair to two driver chips   public void maxDouble(byte reg1, byte col1, byte reg2, byte col2)      {         // LOAD low         loadPin.Write(false);          // Transmit Register 1         putByte(reg1);         // Transmit Column 1         putByte(col1);         // Transmit Register 2         putByte(reg2);         // Transmit Column 2         putByte(col2);          // LOAD high latches data sent         loadPin.Write(true);      }
You have to have a reg and a col per chip.  So, if you wanted to run 5 chips, there would be a reg1, reg 2, reg 3, reg 4, reg 5 plus the additional lines below making reg 1-5.  Same for col.  This is the first part of controlling multiple chips with different data on each.   Ok, we have made the changes to max7219.cs, now on to program.cs. In program.cs we have 2 areas to look at.  First is near the bottom and says:  
for (v = 0; v < animations[animation_num][0].Length; v++)   {      driver.maxDouble         (            (byte)((v % 8) + 1), animations[animation_num][1][v], //chip 2 (end of line)            (byte)((v % 8) + 1), animations[animation_num][0][v]  //chip 1 (closest to Netduino)         );      Thread.Sleep(10);  // delay set to write next column   }
This is setup for 2 chips.  If we go to the 5 discussed earlier, you will modify it to the following:  
for (v = 0; v < animations[animation_num][0].Length; v++)   {      driver.maxDouble      (         (byte)((v % 8) + 1), animations[animation_num][4][v], //chip 5 (end of line)         (byte)((v % 8) + 1), animations[animation_num][3][v], //chip 4         (byte)((v % 8) + 1), animations[animation_num][2][v], //chip 3         (byte)((v % 8) + 1), animations[animation_num][1][v], //chip 2         (byte)((v % 8) + 1), animations[animation_num][0][v]  //chip 1      );      Thread.Sleep(10);  // delay set to write next column   }
  (notice the change in count from 4 to 0?  That is how we are addressing the chips).   This is the only modification to be done in this area.  You only change here if you are wanting to have more than 2 chips from the example supplied.  Notice though that the chips count from the last chip in the line to the closest chip to the Netduino.  That is key and will be referenced below.   the sleep command is what slows the counting process down.  Increase the value, the update time is slower, decrease, the leds move faster.  the time is in milliseconds.   Now that is all the setup.  But we still don't have our "pretty".  Here is the pretty.  Going back up in the code, there is a section that starts:   byte[][][] animations = new byte[][][]   This is where the pretty is stored.  The reason for 3 sets of brackets is to allow for more than one "pretty".  I won't go into too much detail here, but hopefully as I explain what is where you will see what is going on.   The code:  
byte[][][] animations = new byte[][][]   {      //Annimation index 0      new byte[][]      {         //Chip 1 output (closest to Netduino)         new byte[]         {            0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,            0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01         },          //Chip 2 output (end of line)         new byte[]         {            0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,            0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe         }      }   };
  (now this is extremely simplified).   Each row is 8 bytes long.  Each hex value controls one column of lights.  So to control the whole grid, I have to send 8 hex values total.  0x00 = no lights, 0xff = all lights in a column.  the lights count in binary 1 being the highest led and 128 being the lowest led. One comment about this. Both bytes MUST be the same length. If you are showing something on chip 2 but want chip 1 blank, you MUST send 0x00 as long as you are sending something to chip 2. If they are different lengths, it will fault the program.   The attached code currently scrolls "VA" across 2 displays.  I am in the process of expanding it to say "VADER RULES!" but as you can see, that will take time.  I am sure there are better ways to do it, in fact I am almost positive, but I am learning myself, and this is helping me to better understand what is going on.   Upcoming updates for this for my uses, multiple scrolling messages.  I will have "VADER RULES!" and then have it setup to output random values so the leds just flash and then have it set so the random is running and then every so often, "VADER RULES!" scrolls across and back to random flashing. Go to the full post


  • Please log in to reply
31 replies to this topic

#1 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 26 December 2013 - 08:55 PM

I have a project that will use 6 Max7219 LED matrix controllers.  I have used the Max72197221Test program from NetduinoHelpers and got the random flash pattern I wanted.  Only trouble is, all the Max7219 I connect display the same thing.

 

I want to be able to write individually to each Max.  Doing some reading, I read that if I send {11111111} to the Max, the first led will light per each column (8x8 grid).  If I send {22222222}, the second led will light, {33333333} makes the first 2 light, and so on in a decimal to binary conversion.  I also read that if I send {1111111122222222} that the first Max will use all the 1's and the 2nd will use all the 2's.  So to control 6 Max 7219, I would send:

 

{111111112222222233333333444444445555555566666666} and each max would get a different value.

 

Am I correct in my understanding?  If I am, how do I make it work?  I have tried doing just 2 and with the program I have used, if I do not send exactly 8 segments, it faults.  I have looked trough the code, and adjusted anywhere I see "8" to "16" and "16" to "32" to double the size to try and control 2 chips.  No luck.

 

I will admit, this is a little above my understanding, but if your gonna go, go big...lol  How else do I learn?

 

I have attached the program and all associated files (I just zipped the project folder together).  I am using Visual Studio 2012 Pro.

 

Thank you in advance for your help.

Attached Files



#2 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 27 December 2013 - 11:46 AM

Hi,

 

I had a look at the code but could not find the 1111111222222 etc. you describe above so I am not entirely sure what code you are running.

(The code in the zip file has a whole load of clever stuff to wade through - much too complicated for me to pick apart quickly.)

 

One hardware thing to check is that you have wired up the data input for each max chip to the output of the previous one "Daisy Chain". If all the displays' inputs are connected directly to the Netduino, then you will need to use differenet strobe lines to distinguish them.

 

Assuming you have a daisy chain, my understanding is that you should setup a byte array with two bytes per display. Then send the array to the SPI port.

Each pair in the array has a column address (or row address or digit number, depending on how you have wired it up) and the binary pattern to write to that group of 8 LEDs.

 

So if you had an array of {1,1,1,1,1,1,1,1,1,1,1,1}, then all the six max chips would receive column 1 value 1.

If you wanted to set a differnt value on each display, I think you should be sending something like {1,1,2,2,3,3,4,4,5,5,6,6}

This would set:

  display 1, column 1, LED 1

  display 2, column 2, LED 2

  display 3, column 3, LED 1 + 2

  display 4, column 4, LED 3

  display 5, column 5, LED 1 + 3

  display 6, column 6, LED 2 + 3

 

Hope this makes sense and helps - Paul



#3 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 27 December 2013 - 01:03 PM

Thanks for looking Paul.

 

Where I am trying to send the double byte is in the Program.cs file starting at line 132 and looks like:

 _displayList = new ArrayList {new byte[] {  1,   3,   7,  14,  28,  12,  76,  73},new byte[] { 16,   2,  82, 255,  83, 123,  23, 128},new byte[] { 95, 205,  60, 190,  43,  83, 217, 195},new byte[] { 29, 115, 120, 173,  39,  91,  85, 235},new byte[] {  1,  74,  36,  29, 243, 165, 177, 101},new byte[] { 82,  18,  32,  67, 130, 193,  58, 254},new byte[] { 73,  30, 163, 129, 228, 164,   2,   1},new byte[] { 39,  57,  12,  17,  34, 126,  74,  15},new byte[] {100,  64,   3,   2,  10,  52, 239,   7},}                                             /*_displayList = new ArrayList {new byte[] {  1,   3,   7,  14,  28,  12,  76,  73, 100,  64,   3,   2,  10,  52, 239,   7},new byte[] { 16,   2,  82, 255,  83, 123,  23, 128, 129, 241, 130, 158,  73,  67,  16,  34},new byte[] { 95, 205,  60, 190,  43,  83, 217, 195,  27,  82,  76,  91,  32,  12, 243,   4},new byte[] { 29, 115, 120, 173,  39,  91,  85, 235,  30,  37, 127, 130,  11, 110,   8,   2},new byte[] {  1,  74,  36,  29, 243, 165, 177, 101,  40,  26,  50,  38, 184,  40,  34,  30},new byte[] { 82,  18,  32,  67, 130, 193,  58, 254,  59,  49, 174, 149, 173, 241, 198,   3},new byte[] { 73,  30, 163, 129, 228, 164,   2,   1,  40,  25,  72,  12,  26,  67,  28,  87},new byte[] { 39,  57,  12,  17,  34, 126,  74,  15,  49,  40,  20, 201, 228, 124,  58,  27},new byte[] {100,  64,   3,   2,  10,  52, 239,   7,  39,  57,  12,  17,  34, 126,  74,  15},};*/


#4 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 27 December 2013 - 01:10 PM

The calling instruction comes at line 182 (see below)

 

But this code is a little "big" for my liking.  I would prefer a streamlined program that does just what I want.  Do you know of a tutorial where I can learn about coding SPI to talk to the chips?

 

      private static void Spinner() {            while (true) {                foreach (byte[] matrix in _displayList) {                    _max.Display(matrix);                    _max.SetIntensity(_intensity);                    Thread.Sleep(120);                }


#5 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 27 December 2013 - 01:23 PM

Paul, I was looking in the wiki at http://wiki.netduino.com/SPI.ashx.

 

Will the code given in there work for what I am wanting to do?  The code shows using multiple SPI devices not in a daisy chain.  I would just not initialize the second SS pin, and then under the "writing to spi device" I could send the full 16 segments.  Do you think I am on the right track or am I chasing rabbits?



#6 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 27 December 2013 - 03:40 PM

"Shhhh! - I'm hunting wabbits"

 

I like to get something working with a very simple piece of code - like in the Wiki page.

Once I have that running I know the hardware is OK and then I will look at "better" methods - creating my own classes etc.

 

The Wiki code may not be OK - I think it will have been written for the v1 Netduinos, so some of the syntax may have changed. Ditto for my code - I am using .NetMF v4.2, but I dont have a v2 Netduino.

 

This code is from an example I made a while ago. It is a complete stand alone program.

It should drive the first max device with a pattern, each second a new column will be written with the next value in a 0 to 255 sequence.

If you daisy chain the data to more devices, then the second device should show the same updates one update later and so on.

 

It compiles for NetduinoPlus v1 with .NetMF v4.2 - see if it works for you.

 

(Note that I have assumed the column addresses are 0 to 7, not 1 to 8.)

You will need to change the strobe pin to which ever one you are using, and you may need to change the SPI configuration - active edge etc.

using System.Threading;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;namespace Temp_SPI_Demo{	public class Program	{		public static void Main()		{			SPI.Configuration xSPIConfig;   // SPI configuration			SPI xspi;                       // The actual SPI object			// Setup the configuration D4 is the latch / strobe pin			xSPIConfig = new SPI.Configuration(     Pins.GPIO_PIN_D4,    //Chip Select pin								false,              //Chip Select Active State								0,                  //Chip Select Setup Time								0,                  //Chip Select Hold Time								false,              //Clock Idle State								true,               //Clock Edge								32,                 //Clock Rate (kHz)								SPI.SPI_module.SPI1);//SPI Module			xspi = new SPI(xSPIConfig);		// Create the SPI port			byte[] byteArray = new byte[2];		// Array to send to SPI port*** EDIT ***                        byteArray[0] = (byte)0xB;                        byteArray[1] = (byte)0x7;        			    xspi.Write(byteArray);		          // Set number of digits to 8                        byteArray[0] = (byte)0xA;                        byteArray[1] = (byte)0xF;			            xspi.Write(byteArray);		          // Set maximum intensity                        byteArray[0] = (byte)0xC;                        byteArray[1] = (byte)0x1;        			    xspi.Write(byteArray);	             // Enable display		        byte column = 1;**** END EDIT ***			for (byte i = 0; i < 255; i++)		// Just in case - A byte should never exceed 255 :-)			{					byteArray[0] = column;							byteArray[1] = i;					xspi.Write(byteArray);		// write pattern				Thread.Sleep(1000);		// Sleep for a while				column++;			// Move to next column (or wrap)*** EDITED ***		        if (column > 8)									{*** EDITED ***	  		     column = 1;				}			}		}	}}

Assuming that works, try modifying the loop to drive two displays in a chain:

			byte[] byteArray = new byte[4];		// Array to send to SPI port*** EDITED ***		byte column1 = 1;*** EDITED ***		byte column2 = 8;			for (byte i = 0; i < 255; i++)		// Just in case - A byte should never exceed 255 :-)			{				byteArray[0] = column1;				byteArray[2] = column2;								byteArray[1] = i;				byteArray[3] = (byte)(255 - i);	// Set opposite pattern				xspi.Write(byteArray);		// write pattern				Thread.Sleep(1000);		// Sleep for a while				column1++;			// Move to next column (or wrap)*** EDITED ***			if (column1 > 8)				{*** EDITED ***				column1 = 1;				}*** EDITED ***			column2 = (byte)(8 - column1);				}

Hopefully this gets you going.

 

 

 

EDITS

I have added lines to prepare the display to use all digits (columns), set the max intensity and turn it on. I have updated the column value to run 1 to 8 not 0 to 7.



#7 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 27 December 2013 - 03:49 PM

OH WOW!  Thanks!  Yeah, I guess that rabbit hunt didn't go so well for me.  Bugs got me again ;)

 

I'll get this loaded and see where it takes me.



#8 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 27 December 2013 - 05:30 PM

To make sure I am following, CLK goes to pin 13, CS goes to pin 4, and DIN (aka MOSI) goes to pin 11?

 

Once I get it wired up, what is the expected output?  I am using an 8x8 led grid.  I loaded the code and all I get is all the LEDs coming on.



#9 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 27 December 2013 - 06:31 PM

Yes, clock goes to pin 13 SCLK, Data IN goes to pin 11 MOSI (Master Out Slave In), CS goes to which ever pin you wish to use, the example code was set to D4 so yes.

Make sure you also have a ground connected too.

 

I expected that the first loop through the code would write 0 to the first column.

 - I was wrong. Looking at the zip file, there is an enumeration for the "digits" RegisterAddressMap - zero is no operation, 1 is digit 1 etc.

So the column counter should start at 1 and go up to (and including) 8.

 

With that change, I think you should get zero to the first column (all off), then one second later, 1 to the second column (first LED on), ... , 7 to the 8th column (first 3 LEDs ON), then wrap around and 8 to the first column, and so on.

 

You say that all the LEDs are ON, is this imediate or after a while?

(Do all the LEDs come on before the program on the Netduino runs?)

 

Also looking at the zip code, the value 0xF is used for display test - I am guessing this means all LEDs ON.

If the column value written out is 0xF then all the LEDs might come on.

This could mean that the problem is the order of the bytes in the array - try swappng [0] and [1] over so the column is in [1], and value is in [0]......

 

We will get there in the end.



#10 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 27 December 2013 - 06:46 PM

Data sheet says that all the registers are reset at power on:

 

 

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.

 

So you should have to set up a couple of reisters before the digits will come on at all:

 - Scan limit needs to be set to 7 - 0xB, 0x7 (byte[0] = 0xB and byte[1] = 0x7)

 - Intensity needs to be turned up - 0xA, 0xF  (0xF is for max intensity)

 - Normal mode needs to be set - 0xC, 0x1

 

EDIT

I have gone back and edited the code I posted above.



#11 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 28 December 2013 - 09:58 PM

Thank you for your patience and help.

 

I have corrected my code to match yours (I did make one change from D4 to D8 to keep my wiring the same).  Still no output on the matrix display.  I tested by uploading the code "super loaded" code and got the display to work.  I am reading over your comments of what you have vs the other and trying to see what the difference is.

 

I follow the section where you are writing the bits (for byte i=0; i<255; i++ and further).  You start at i = 0, and increment by one per scan till you get to 255, then reset.  The you have a column counter to move from one column to the next.

 

The spi part is where I am still not fully understanding what is going on.  I am trying to figure the "why" as I do the "what".



#12 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 29 December 2013 - 05:36 PM

OOOh you SPIwy wabbit.

 

The SPI should be the easy bit!

You create an SPI configuration that tells the hardware how to behave, then create the SPI port passing it the configuration.

(If you need to, you can create several configurations with different settings and different strobe lines, and then use them one after another.)

 

To use the SPI, all you do is give it an array of bytes to transmit.

The array is written out into the chain shift registers that form the 7219s.

The device furthest from the Netduino gets the first pair of bytes in the array, the one closest gets the last pair in the array.

Hence the array needs to be one byte pair per 7219.

 

Each time you write to them, they are all given two bytes. So if you just want to make a change to one device, you still have to give data to all of them in the chain. (This is OK because the ones you don't want to change are given zero in the digit/column byte - this makes those devices not respond to their data byte).

 

I have driven a number of devices now using SPI, including having devices (2) in a daisy chain.

(I have not yet got a max7219 display, I have almost hit "BUY" on ebay a couple of times now for some 8x8 matrix displays).

 

You said before that all the LEDs came on, now they don't?

Have you tried reversing the order of the byte pairs?

 

Paul



#13 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 30 December 2013 - 09:48 PM

I haven't tried that yet.  That will be my next test.  And now I have a better idea what is trying to be accomplished.  I plan to sit tonight and read the code you sent plus datasheet having a better understanding.

 

As for the 8x8 displays, I got (5) 8x8 with MAX7219 chips, board, and all for $15 off eBay.  I ended up ordering 2 sets I was so pleased with them.  Here is the eBay link  Guy did great on shipping and cost was good.  Only issue I found was I can only connect 4 of these to the power pins on the netduino.  add the 5th and it drags the power supply down and it just keeps rebooting.



#14 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 16 January 2014 - 04:23 PM

Sorry I haven't posted in a while.  Got tied up on something else. Still working on this.  I tried using the edited code again (trying to remember exactly where I was in the trouble shooting process and something strange occurred.  I was running the other version of the MAX driver.  The one that has the 3 files and is BLOATED for what I need.  Then I overwrote what was running with your program and it began working.  I saw the led's count from 1, 2, 3, etc.  Well I rebooted the controller and then the LED's stopped.  All the leds came on and just stayed there.  No flashing or nothing.  I know the program was loaded.  So, in my limited experience, it seems that I need to look into initializing the chips.  That seems to be the trouble now.  I plan on reading the data sheet again this weekend and see if I can get an idea of what needs to be sent.



#15 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 17 January 2014 - 04:18 PM

Sorry I haven't posted in a while.  Got tied up on something else. Still working on this.  I tried using the edited code again (trying to remember exactly where I was in the trouble shooting process and something strange occurred.  I was running the other version of the MAX driver.  The one that has the 3 files and is BLOATED for what I need.  Then I overwrote what was running with your program and it began working.  I saw the led's count from 1, 2, 3, etc.  Well I rebooted the controller and then the LED's stopped.  All the leds came on and just stayed there.  No flashing or nothing.  I know the program was loaded.  So, in my limited experience, it seems that I need to look into initializing the chips.  That seems to be the trouble now.  I plan on reading the data sheet again this weekend and see if I can get an idea of what needs to be sent.

 

Yeah I can go for months at a time without playing with my code. Often days between looking at the Forums.

 

Great - so you have proven the hardware works.

Have you got one, or more devices attached?

 

It does sound like an initialisation issue.

There is a test mode in the display driver which I understand will turn on all the LEDs to verify they are working.

 

If your power supply is noisey or comes up to voltage slowly, it is possible the MAX chips have not come out of reset cleanly and the rgister values are not all the their reset state.

It maybe worth writing to all the registers to force them into a sensible state after power on....

 

Paul



#16 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 20 January 2014 - 10:45 PM

Well I tried a little more.  I read the SPI wiki and it suggested some SPI devices use individual CS pins as opposed to daisy chaining the CS pin.

 

I modified my code and created new instances of the chip addressing different CS pins, but still using the same Clock and MOSI pins.

 

No luck.  the code I am using does not like multiple instances of the chips and they fight.

 

I feel like I am dancing right on the edge of this.  Like the answer is behind a curtain and I keep poking the curtain looking for the slit to go in.

 

Still not opposed to tossing what I have for something better.  Still tinkering with the code earlier in this post as well.  It seems the issue is initializing the chip.  That is another place I feel I am right on the edge of getting right.



#17 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 21 January 2014 - 07:12 AM

Hmmm

 

Sounds like you need to control one device reliably then consider multiple devices.

Using separate CS lines should make controlling multiple devices really easy, each device will think it is the only device - so you only ever need to send out two bytes to control any device, rather than setting up a sequence of pairs with one pair for each device. To compensate, you have to sacrafice extra GPIO lines to use as CS pins, and the software needs to use multiple SPI configurations.

 

There must be something else (thats really obvious) going wrong.

Have you got the debugger display showing what the code is doing?

Is there a chance the Netduino is rebooting?

Where do the displays get their power from? (Hopefully NOT from the Netduino's regulated 5V pin - that many LEDs would overload the 5V regulator on the Netduino).

 

Its going to be something simple - Paul



#18 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 21 January 2014 - 04:46 PM

That is the hard part.  With the code I have acquired, I can accurately and successfully control 1 chip no problem.  It is the addition of more than one the causes the trouble.  And it isn't really "trouble", it is just all chips added output the same data and I would like them different.

 

I am still working on figuring out why the code above won't initialize the chip to run.  

 

I must admit, even though this is close to driving me to drink, it is fun ;)

 

As for power, sometimes I am powering from an external, sometimes off the Netduino.  When I power from external, I have had all 6 on.  From the Netduino, it maxes out at 4 chips.  Above 4, the entire system goes into cycle power up/dn.  So for test purposes I only run 2 chips when doing multiple.



#19 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 21 January 2014 - 05:04 PM

Ok, update.  the code you posted earlier is SOOO close.  If I can upload your code when the chip is already in an initialized state, it works perfectly.  chip 1 counts up, chip 2 counts down.

 

But to fully test, I used the deployment tool and wiped the deployment.  Start from scratch.  Loaded the above code, and nothing.  The displays are all dark.  Working to see the difference between yours and the other SPI initialization.  It is here, I just have to find it.



#20 vader7071

vader7071

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationDothan, AL

Posted 21 January 2014 - 05:12 PM

Question.  Where in the code above is the CS pin being triggered?  Is the xSPIConfig controlling that?

 

Also, I think I am on to something.  I am rereading the datasheet and it mentions setting the decode mode, scan limit and a few other variables.  Gonna tweak on that.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.