cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jbasseri
Newbie
Newbie
8,911 Views
Registered: ‎02-29-2008

Microblaze freezing with custom peripherals

Hello,

I'm having a pretty basic problem working with MicroBlaze on a Spartan 3E starter board.

I made a simple microblaze application to read the dip switches and display that value on the leds. When I try to run that application with a custom peripheral attached to the chip, it doesn't work.

My custom peripheral just sends some timing signals to the VGA pins on the board. The pins are constrained in data/system.ucf. The timing signals are correctly generated, but the microblaze itself stops executing my program after maybe a couple hundred instructions (the blink of an eye). I can reset the microblaze, and the leds will change to whatever the dip switches read, but then stops responding.

And it works properly if I remove my peripheral.

Does anybody know what I am doing wrong?

Thanks,
Jonathan
0 Kudos
3 Replies
goran
Xilinx Employee
Xilinx Employee
8,889 Views
Registered: ‎08-06-2007

Hi,
 
It's very hard to tell you what the issue is with so little information.
 
How does your system look like?
How did you create your peripheral?
How does your program look like?
 
Göran
0 Kudos
jbasseri
Newbie
Newbie
8,882 Views
Registered: ‎02-29-2008

Hi, sorry for the vague problem description. I've had more time to experiment now. Here is my story:

1) I created a new microblaze project and wrote a program to read the dip switches and write that to the leds. It worked.
2) I then created a custom peripheral with 1x32bit register. I let the wizard generate the OPB Slave register read/write code.
3) I modified my program to write the dip switch value to my peripheral then read it out again before writing it to the leds. It still worked.
4) I added some extra logic to my peripheral to drive five output ports for vga signals. I added the port definitions to both user_logic.vhd and my_periph.vhd, then I reimported it using the wizard.
5) I deleted my peripheral from the system assembly and put the new one in. I made the ports external, then I added these lines to data/system.ucf:
Net my_periph_0_VGA_HSYNC_pin LOC=F15;
Net my_periph_0_VGA_HSYNC_pin IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;
Net my_periph_0_VGA_VSYNC_pin LOC=F14;
Net my_periph_0_VGA_VSYNC_pin IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;
Net my_periph_0_VGA_RED_pin LOC=H14;
Net my_periph_0_VGA_RED_pin IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;
Net my_periph_0_VGA_GREEN_pin LOC=H15;
Net my_periph_0_VGA_GREEN_pin IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;
Net my_periph_0_VGA_BLUE_pin LOC=G15;
Net my_periph_0_VGA_BLUE_pin IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST

6) Now I rebuilt everything without modifying my program. The vga signals were correct and I displayed solid red on a monitor (the intended effect for this exercize). However, the leds would not change with the dip switches. Each time I pressed reset (button south) the leds would change to the current value of the switches. If I kept pressing reset enough, the leds would stop turning on altogether.
7) Finally, I changed the ports on my_periph to "no connection" and commented out those lines in system.ucf. The program worked like normal again.

Please let me know if there's any detail you're interested in that I forgot to mention.
0 Kudos
jbasseri
Newbie
Newbie
8,873 Views
Registered: ‎02-29-2008

Hello all, I fixed the problem.

For those who are wondering, I had to make my c code use "volatile" variables where the dip switches were concerned. I don't know why making ports external made this a problem, but volatile fixes it.

Cheers,
Jonathan
0 Kudos