cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
black_flowers
Adventurer
Adventurer
6,832 Views
Registered: ‎06-27-2009

what are the port names of fpga I/O nets in microblaze?

Jump to solution

i have done a simple application with XPS using BaseSystemWizard for Spartan3EStarterKit board using Microblaze. I have only added the LEDS peripheral. But i'm unable to make a led blink. I have two test applications, one for memory test, another for peripheral test. The one for "peripheral test" is what i'm trying to modify for blinking leds but i cannot find what are the "name" the "leds net" have in the processor.

 

I have seen in the .ucf file there are some lines for defining the nets, like this:

Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<0> LOC=F9  |  IOSTANDARD = LVCMOS33;

but i cannot find the corresponding name of  "fpga_0_LEDs_8Bit_GPIO_IO_O_pin<0>", for using it with microblaze.

 

thanks a lot.

0 Kudos
1 Solution

Accepted Solutions
shuns
Explorer
Explorer
8,670 Views
Registered: ‎10-01-2008

Hi,

 

The first part is clearly wrong. You don't control the IO ports this way in a C file.

 

The GpioOutputExample() is the right part of the code. If you look elsewhere in the C file, you should fine the definition of this function in which it toggles the data register of the GPIO core which in turns toggle the IO ports connected to the LED's.It is the GPIO core's register that actually drives the IO ports. Would this make sense to you? You can need to read the GPIO core's data sheet to understand the internal working.

 

You may also have a read through EDK Concepts, Tools, and Techniques to get some more ideas how EDK (or embedded system design in general) works.

 

Hope this will help you again.

 

Thanks,

Yan Shun LI

 

View solution in original post

8 Replies
cnakaji
Observer
Observer
6,804 Views
Registered: ‎08-16-2007

Hello,

 

In the MHS you should have an 8bit vector

 

 PORT fpga_0_LEDs_8Bit_GPIO_IO_O_pin = fpga_0_LEDs_8Bit_GPIO_IO_O_pin, DIR = O, VEC = [0:7]

 

In the UCF this will relate to 8 individual bits

 

Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<0> LOC=F9  |  IOSTANDARD = LVCMOS33;
Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<1> LOC=E9  |  IOSTANDARD = LVCMOS33;
Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<2> LOC=D11  |  IOSTANDARD = LVCMOS33;
Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<3> LOC=C11  |  IOSTANDARD = LVCMOS33;
Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<4> LOC=F11  |  IOSTANDARD = LVCMOS33;
Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<5> LOC=E11  |  IOSTANDARD = LVCMOS33;
Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<6> LOC=E12  |  IOSTANDARD = LVCMOS33;
Net fpga_0_LEDs_8Bit_GPIO_IO_O_pin<7> LOC=F12  |  IOSTANDARD = LVCMOS33;

 

--cjn

 

 

0 Kudos
black_flowers
Adventurer
Adventurer
6,778 Views
Registered: ‎06-27-2009

yes, i knew that, but i still don't know how to call led ports from c code in microblaze:

 

fpga_0_LEDs_8Bit_GPIO_IO_O_pin<0>=1;     //with this i get an error

fpga_0_LEDs_8Bit_GPIO_IO_O_pin(0)=1;       //it reports an error too

fpga_0_LEDs_8Bit_GPIO_IO_O_pin[0]=1;       //reports an error too

 

how should be the correct syntax for turn on the led?

0 Kudos
shuns
Explorer
Explorer
6,760 Views
Registered: ‎10-01-2008

Hi,

 

Remember an embedded (or a processor) system is memory based, so every peripheral or IO port need to be controlled by memory-map registers.

 

Like in this case, for controlling the LED's, most likely those ports would be connected to a GPIO peripheral (check your MHS). Then in your C program, you can turn on and off an IO port by writing into the corresponding bits in the data register of that GPIO core.

 

If you are generating this design through the base system builder, then you should find some part of the code testing the GPIO ports in the TestApp_Peripherals application project.

 

Hope this will help you. 

 

-Yan Shun Li

black_flowers
Adventurer
Adventurer
6,753 Views
Registered: ‎06-27-2009

in the mhs file the gpio for leds appears like this:

PORT fpga_0_LEDs_8Bit_GPIO_IO_O_pin = fpga_0_LEDs_8Bit_GPIO_IO_O_pin, DIR = O, VEC = [0:7]

 

but whatever i tryed in the c code, reports me an error.(the error reported is below the instruction)

 

fpga_0_LEDs_8Bit_GPIO_IO_O_pin=1; 

'fpga_0_LEDs_8Bit_GPIO_IO_O_pin' undeclared

 

fpga_0_LEDs_8Bit_GPIO_IO_O_pin<0>=1;

'fpga_0_LEDs_8Bit_GPIO_IO_O_pin' undeclared

 

fpga_0_LEDs_8Bit_GPIO_IO_O_pin(0)=1;

 invalid lvalue in assignment

 

 

 

in the testapp peripheral it's using some functions for flashing leds, but i cannot find the specific instructions for turning the led on. I think maybe it's this function for managing the leds:

 

Status = GpioOutputExample(GPIO_OUTPUT_DEVICE_ID, GPIO_BITWIDTH);

 

i don't know what else can i try.

0 Kudos
shuns
Explorer
Explorer
8,671 Views
Registered: ‎10-01-2008

Hi,

 

The first part is clearly wrong. You don't control the IO ports this way in a C file.

 

The GpioOutputExample() is the right part of the code. If you look elsewhere in the C file, you should fine the definition of this function in which it toggles the data register of the GPIO core which in turns toggle the IO ports connected to the LED's.It is the GPIO core's register that actually drives the IO ports. Would this make sense to you? You can need to read the GPIO core's data sheet to understand the internal working.

 

You may also have a read through EDK Concepts, Tools, and Techniques to get some more ideas how EDK (or embedded system design in general) works.

 

Hope this will help you again.

 

Thanks,

Yan Shun LI

 

View solution in original post

black_flowers
Adventurer
Adventurer
6,684 Views
Registered: ‎06-27-2009

well, i'm almost reaching the solution, thank you, but still have a doubt, ¿where can i find gpio core datasheet? I'm using xps and i cannot find it in the environment.

 

thank you very much, excuse me for my numerous questions but i'm newbie with embedded processors.

0 Kudos
htsvn
Xilinx Employee
Xilinx Employee
6,677 Views
Registered: ‎08-02-2007

Here is the location wherein you can find the GPIO datasheet.

 

$EDK_Install\hw\XilinxProcessorIPLib\pcores\xps_gpio_v1_00_a\doc

 

Thnx

 

 

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
black_flowers
Adventurer
Adventurer
6,635 Views
Registered: ‎06-27-2009

ok, so the key is the GpioInputExample(Xuint16 DeviceId, Xuint32 *DataRead); function. I will not go deeper in this function, it's very difficult to manage a simple i/o port.

0 Kudos