Main Site Documentation

Sparkfun LED Matrix and Panda: Getting started question


#1

Apologies for the noob question.

I am using a panda II and the sparkfun led matrix: http://www.sparkfun.com/products/759

I see the sample code here:
http://code.tinyclr.com/project/327/sparkfun-led-matrix/

and the earlier discussion here:
http://tinyclr.com/forum/2/3398/

For resources, I am using the panda doc:

And the SPI tutorial here:
http://wiki.tinyclr.com/index.php?title=SPI_-_MP3_Decoder

I am now out of ideas, and need to ask:
How do I communicate with the LED matrix?

More specifically, what are the physical connections needed to make the sample code function?
http://code.tinyclr.com/project/327/sparkfun-led-matrix/

What I am doing now:

VCC = I have this hooked to 5 volt on the panda.
VCC
SCLK = SCK / pin 13 on panda
CS = I have tried panda pins digital 0, 1 and 10
MISO = Should this go to panda MOSI or MISO ? // I have tried both
GND = I have this hooked to ground on panda

Thank you!


#2

Sam,

from the sample on the codeshare:

SPI SPIBus = new SPI(new SPI.Configuration(Cpu.Pin.GPIO_NONE, false, 0, 0, false, false, 1000, SPI.SPI_module.SPI1));            
SparkfunLEDMatrix Panel1 = new SparkfunLEDMatrix((Cpu.Pin)FEZ_Pin.Digital.Di10, SPIBus);      

The first line of code says it uses the SPI1 set of pins.
The second says it uses Di10. So that means you can change things as you need, but SPI1 (which is MOSI/MISO/SCK) and Di10 as CS is how Dat did it initially.

I have no idea whether this requires 5v or 3v3, that might be something else to try - careful though, 5v might have damaged stuff…

You must make sure SCK and CS are connected as required, so that the device can be addressed. Then try MISO/MOSI reversal until it works - I notice on SF’s site the last comment was about these being reversed, but that might actually be just a misunderstanding - is the Fez the “master” or is the cpu on the backpack of that device being considered the master?


#3

Thanks!

The device, afaik, is 5v.

Here is what I have tried:

VCC = I have this hooked to 5 volt on the panda.
VCC
SCLK = SCK / pin 13 on panda
CS = digital 10
MISO = Should this go to panda MOSI or MISO ? // I have tried both
GND = I have this hooked to ground on panda

Still no joy.


#4

Sam, saw that before :slight_smile:

So how are you powering the Fez? Perhaps that’s also taking a toll?

VCC - do you have BOTH of them hooked up to the Panda?
Pin13, do you mean Di13? If so, then that seems correct to me.
GND - seems good.

CS to Di10 seems correct IF you have that in your code?!

MOSI of the device most likely goes to MISO on the Panda. So you should have MOSI / MISO crossed, and both connected. If you saw the other thread (the one you pointed to me) the person there had to connect both MOSI/MISO for the device to work. MOSI1=Di11, MISO1=Di12.


#5

Thank you!

No joy yet.

VCC = I have this hooked to 5 volt on the panda. // panda powered via usb
VCC = going to same 5 volt on panda // panda powered via usb
SCLK = SCK / pin di13 on panda, labelled sck1
CS = digital 10
MISO = panda MOSI
GND = I have this hooked to ground on panda

CS to Di10 seems correct IF you have that in your code?!

MOSI of the device most likely goes to MISO on the Panda.

Device only has MISO, so I have that going to MOSI on panda.

Thanks a ton for the assistance. Would be smoking to get this thing working.


#6

It has two ports, an input and an output. MOSI on one side, MISO on the other. Well according to this it does anyway… http://dlnmh9ip6v2uc.cloudfront.net/images/products/00759-02.jpg (image 4 on the SF page)


#7

@ Brett,

Yes, it does have this.

Is it reqd that I hit both the MISO and the MOSI?

I thought that since I am just sending data, that hitting the device’s MISO would be appro…

Just say the word, and I will wire it up. This is my first experience with SPI

(the SPI output side of the board is used when daisy chaining multiple boards together)


#8

I was just saying that, because it seemed exactly like what the other poster said in the thread you originally quoted. Do I know this is the secret sauce, heck no. Do I think it’s worth a try, heck YES!

Once you’ve tried it, and if it still doesn’t work, swap MISO/MOSI on the Fez end. If it still doesn’t work then I give up :slight_smile:

edit: theory as to why. The code running on the uC on the backpack may not move to a state where it processes anything unless there’s operable comms, including both MOSI/MISO. This could just be a startup condition or an operating mode decision, I don’t know. That code is a black box [I assume] so you can’t accurately predict this. If this was just a SPI device, then it should be true that you don’t need both connected - or at the very least you should be told that on the datasheet.


#9

Brett,

I was just saying that, because it seemed exactly like what the other poster said in the
thread you originally quoted. Do I know this is the secret sauce, heck no.
Do I think it’s worth a try, heck YES!

A winner!

Thank you!

I would not have thought of this, and I did not interpret/understand that other thread to refer to the SPI output of the matrix.

Here is a complete doc, that I hope is understandable to all:

Working connectivity from Panda II to the SparkFun LED Matrix: http://www.sparkfun.com/products/759

This is my working setup. It is possible that I have an extra connection, as I have not reduced connections (yet), but this for sure works. Note, if you have the GHI ethernet shield on your Panda, the pins are named slightly differently on the silk screen. Refer to the picture of the Panda II here if you can’t see your actual Panda board: http://www.ghielectronics.com/downloads/FEZ/Panda_II/FEZ_Panda_II_UserManual.pdf

This wiring relates to the example driver posted here:
http://code.tinyclr.com/project/327/sparkfun-led-matrix/

Note, the main pin change that is done via code is for the CS.

Power source: USB to Panda

SPI INPUT SIDE OF LED MATRIX
----------------------------
VCC  -- 5v pin on Panda
VCC  -- 5v pin on Panda
SCLK -- D13 / SCK1
CS   -- D10 // new SparkfunLEDMatrix((Cpu.Pin)FEZ_Pin.Digital.Di10, SPIBus);
MISO -- D12 / MISO  // hmmm, seems like it should be MISO -> MOSI, that didn't work...
GND  -- Gnd pin on Panda


SPI OUTPUT SIDE OF LED MATRIX
-----------------------------
MOSI -- D11 / MOSI


#10

Attention when using SPI1 with the GHI ethernet shield. The Wiz chip uses the same SPI port. Change to SPI2 (Sclk Di35, MOSI2 Di38 if I remember correctly) or without the shield.


#11

SPI is able to share the bus, as long as you have unique CS lines, so your warning isn’t quite right.


#12

Will be combining the matrix with ghi ethernet soon enough… !


#13

If the bus allows sharing fine if all goes well. In case of problems I would prefer to separate and test both. Only when both work fine I would try to actually share them.