NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Multi-Panel LED Array with SPI

September 20, 2010
by ermias
ermias's Avatar

Hi all,

I have been working on two panel Led array using SPI and couldn't got it work. I have loaded the two MCU with the ledarray_slave.c code and the master MCU with ledarray_master.c code. I followed the schematic from the tutorial and connect all the pins as instructed. The result was unexpected. I have only the first column, rows 1-4 led turned on in both panel. The rest of the leds in each panel is not on. Does anyone know what might be the problem? I have been trying to get it work all day. I couldn't figured it out. Any thing will help.

Thanks, Ermias

September 21, 2010
by Rick_S
Rick_S's Avatar

Ermias,

It's really hard to say what the problem could be. If you are running un-modified code, then most likely the problem lies in the wiring. A good photo could help considerably. See the bottom of any forum page for instructions for inserting photo's.

In your post, you said you only have the 1st column rows 1-4 on. Do the led's flicker as if they are trying to do something?

Keep in mind, the LED Array projects are probably the most wiring intensive project there is in the tutorial section. That is the main reason I never built the multi panel array and just stuck with the standard array I did build.

I would probably recommend that you test your display boards with the single array code to see if the board works. If it still doesn't, your board wiring has an issue that you will need to address.

Good luck,

Rick

September 23, 2010
by ermias
ermias's Avatar

Hi Rick,

Thank you for your response. I checked each panel individually and both of the panel works fine. I didn't modify the code either. Right now none of the Leds turned on.

Thanks,

Ermias

September 23, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi ermias,

What did you expect to see when you turned on the multi panel SPI array? If you left the code completely unmodified it will just wait for input over the serial port. Did you try sending it data?

When getting started my suggestion is to modify the main loop to run a test pattern. The test function already exists you just have to call it from your main loop (I think it is just commented out). Make sure you understand the test function and what it is supposed to be doing. Let us know what you get when you try to run the test pattern.

Humberto

September 23, 2010
by ermias
ermias's Avatar

Hi Humberto,

In the master.c code I didn't find any test function; however I tried run two different test and it didn't work. My test codes are as follow:

The first test I create a simple for loop block inside a the main loop to test my LED display.

int main() { //ledarray_init(); master_init(); //activate interrupts sei();

uint8_t i, j;

for(i=0;i<ROWS;i++) { for(j=0;j<COLS;j++) { data_set(i,j,1); delay_us(30); } }

for(i=0;i<ROWS;i++) { for(j=0;j<COLS;j++) { data_set(i,j, 0); delay_us(30); }

// init serial port //uart_init(); // FILE uart_stream = FDEV_SETUP_STREAM(uart_putchar, uart_getchar, _FDEV_SETUP_RW); //stdin = stdout = &uart_stream;

// mode 1: test pattern //testpattern();

//do_scrolling_display(); while(1) {

} //this loop never executes, scrolling display should loop forever in this mode of operation //everythign exciting happens in the interrupt handler, and in do_scrolling display } return 0; }

When the above code didn't work I create another testpattern function outside the main loop as follow, and call it inside the main loop. That also didn't work. Do you see any wrong thing in my testing functions? And I didn't modify any of the slave code. Isn't that right?

void testpattern() { uint16_t i, j; blank_data();

for(i=0;i<ROWS;i++) { for(j=0;j<COLS;j++) { data_set(i,j, 1 - data_get(i,j)); delay_ms(30); } }

for(i=0;i<ROWS;i++) { for(j=0;j<COLS;j++) { data_set(i,j, 1 - data_get(i,j)); delay_ms(30); } } }

Thanks again,

Ermias

September 23, 2010
by ermias
ermias's Avatar

Hi all,

I finally got it work. The problem was from the hardware connection; not from the code. In the tutorial the schematic shows that each MCU's pin 17&19(the MOSI and SCK pins) are connected together, which then connected to the other MCU's 17&19 pins; however, I couldn't get it work that way. So I decided to connect each MCU's pin 17s together and each MCU's pin 19s together and test my multi panel array and it worked. Thanks for the help again.

Ermias

September 24, 2010
by Rick_S
Rick_S's Avatar

Glad to hear you got it going! The way that the schematic is drawn is common when denoting a bus of wires. While the configuration here with a two wire spi bus could have been drawn fairly easy with two separate lines, when a data bus grows to 8 or more lines, they become confusing. So instead, the bus is drawn in a heavier line than all others indicating it is multiple.

Now that you have it going, you'll have to post some pictures to show off your work!! I love to see everyone's creative take on a given project.

Rick

September 24, 2010
by ermias
ermias's Avatar

Hi Rick,

Thank you very much for your explanation about the common way of schematic drawing for bus wires. And I will post what I came up with once I am done with constructing the four panel. I am thinking to built one wide panel instead of four or five separate panels. I just ordered some LED lights. When I get them I will built the panel and post the final outcome, mean while I am trying to add some display effects on the original code.

Ermias

Post a Reply

Please log in to post a reply.

Did you know that our USB NerdKit works on Windows, Linux, and Mac OS X? Learn more...