Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20693 Discussions

Help: Altera DE2 Board

Altera_Forum
Honored Contributor II
2,021 Views

Hello, after i program the board using Programmer from QII, suppose all the lights including LED and 7-seg-display should be off but somehow, there is a light at the 7-seg-display on board. pls see attachment. why? should it be the error in my code? compilation is successful. pls help. previously, all lights are off but i did a slight change in my code then the red light on 7-seg-dis appears as in pic in attachment.

0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
576 Views

Two possibilities: 

- the signals driving the 7seg behave differently because of you code changes; is the 7seg is supposed to display anything or is hardwired off? 

- you changed something in the pin assignments and the 7seg signals are no more connected to the right pins 

 

I don't have the DE2 board schematics on my current location, so I can't tell you which pin drives that specific segment.
0 Kudos
Altera_Forum
Honored Contributor II
576 Views

hi, no, 7-seg-dis is not included in SOPC because i dont use 7-seg-dis in my system. pls check the attachment for the board pins. i changed the code because i add in SRAM part. previously, it was ok.

0 Kudos
Altera_Forum
Honored Contributor II
576 Views

Are all the signals in your design assigned to a pin? 

Usually this happens when you have an unassigned signal and the router connects it to a different pin every time you recompile the design.
0 Kudos
Altera_Forum
Honored Contributor II
576 Views

I second Cris' advice. 

And make sure that unused pins are set as inputs tri-stated instead of outputs driving ground.
0 Kudos
Altera_Forum
Honored Contributor II
576 Views

Cris72: Yes, there is an unassigned pin in my system for SRAM, address pin number 18. For DE2 Board, the number of address pin is 18 in total, from 17downto0. But in my TCL file for SRAM, i set the number of address input to 18, as in attachment, but the SOPC generates it to be 19 pins, from 18downto0, 1 pin extra after generation. so pin 18 is left unassigned. i am not sure why SOPC generates 19 pins. is it because of my TCL file? 

 

AndrewS6: Yes, i already set all unused pins to inputs tri-stated. 

 

P/S: I think there is sth wrong with my TCL file for SRAM (attachment). can someone help me to check if everything in TCL is similar to the Pin Table for SRAM as in attachment previous post in this thread. thanks!
0 Kudos
Altera_Forum
Honored Contributor II
576 Views

Besides, if possible, I need help with DMA too. I have lost idea of how to debug anymore. My DMA Controller setting in SOPC is Width of the DMA Register Length is set to 32bit and the rest is left at default. However, my system stucks (infinite loop) at  

 

while (!txrx_done); 

printf ("Transfer successful!\n"); 

 

I dont know why. i just follow the code exactly without editing anything.. but the creator can run it but i cant. i dont know what's the prob, i tried msg in the thread but no one replies. 

 

my code (taken from one of the threads in the forum) 

 

 

--- Quote Start ---  

# include <stdio.h># include <stdlib.h># include <stddef.h># include <string.h> 

# include <system.h># include <io.h> 

# include <alt_types.h># include "sys/alt_dma.h"# include "sys/alt_cache.h"# include "sys/alt_alarm.h"# include "alt_types.h" 

 

static volatile int txrx_done = 0; 

 

//callback function when DMA transfer done 

static void txrxDone(void * handle, void * data) 

txrx_done = 1; 

void initMEM(int base_addr,int len) 

for (int i=0;i<len;i++) 

IOWR_8DIRECT(base_addr,i,i); 

int main() 

printf("testing ssram & sdram : dma operation\n"); 

 

alt_16 buffer[10]; 

//memset((void *)SSRAM_0_BASE,0x7a,0x10);//this write base on byte 

initMEM(SDRAM_1_BASE,0x10); 

memset((void *)(SDRAM_1_BASE+0x10),0x33,0x10); 

 

printf("content of sdram_1:before DMA operation\n"); 

for (int i=0;i<0x10;i++) 

printf("%d: %x\n",i,IORD_8DIRECT(SDRAM_1_BASE,i)); 

 

printf("content of sdram_1(offset 0x10):before DMA operation\n"); 

for (int i=0;i<0x10;i++) 

printf("%d: %x\n",i,IORD_8DIRECT(SDRAM_1_BASE+0x10,i)); 

 

int rc; //request 

alt_dma_txchan txchan; 

alt_dma_rxchan rxchan; 

 

void* tx_data = (void*)SDRAM_1_BASE; /* pointer to data to send */ 

void* rx_buffer = (void*)(SDRAM_1_BASE+0x10); /* pointer to rx buffer */ 

 

/* Create the transmit channel */ 

if ((txchan = alt_dma_txchan_open("/dev/dma_0")) == NULL) 

printf ("Failed to open transmit channel\n"); 

exit (1); 

 

/* Create the receive channel */ 

if ((rxchan = alt_dma_rxchan_open("/dev/dma_0")) == NULL) 

printf ("Failed to open receive channel\n"); 

exit (1); 

 

/* Post the transmit request */ 

if ((rc = alt_dma_txchan_send (txchan, 

tx_data, 

0x10, 

NULL, 

NULL)) < 0) 

printf ("Failed to post transmit request, reason = %i\n", rc); 

//exit (1); 

 

/* Post the receive request */ 

if ((rc = alt_dma_rxchan_prepare (rxchan, 

rx_buffer, 

0x10, 

txrxDone, 

NULL)) < 0) 

printf ("Failed to post read request, reason = %i\n", rc); 

//exit (1); 

 

/* wait for transfer to complete */ 

while (!txrx_done); 

printf ("Transfer successful!\n"); 

 

printf("content of sdram_1:after DMA operation\n"); 

for (int i=0;i<0x10;i++) 

printf("%d: %x\n",i,IORD_8DIRECT(SDRAM_1_BASE,i)); 

 

printf("content of sdram_1(offset 0x10):after DMA operation\n"); 

for (int i=0;i<0x10;i++) 

printf("%d: %x\n",i,IORD_8DIRECT(SDRAM_1_BASE+0x10,i)); 

 

 

return 0; 

}  

 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
576 Views

Hello. 

soonph87 have solved the problem with the file tcl srma? 

The additional pin. 

 

I'm in the same situation. 

 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
576 Views

sorry, I think I solved. 

Everything is explained in CAP5, par 5.3 of Avalon Interface Specifications 

 

Thanks.
0 Kudos
Reply