Project

General

Profile

Help me check out the gpio Setup,It is not work.

Added by lijun yang almost 10 years ago

Hello.
Ask the same questions about the GPIO
I also try to use the DSP to communicate with FPGA
The follow is the VHDL code for gpio setup

/----------------------------------------------------------------------------/
--Gpio setup--
----------------------------------------------------
constant CORE_GPIO_MODULE : integer :=4; -- For Gpio core use defined in core_ids.h
constant CORE_GPIO_IRQ_LEVEL : integer :=1;-- level 1 is used for cores managed by the DSP
constant CORE_GPIO_IRQ_VECTOR :* integer :=0*;
------------------------------------------------------------------
--Gpio component define---
-------------------------------------------
gpio1 : gpio
generic map (
NUM_BANKS => 1,
NUM_IO_PER_BANK => 16
)
Port Map (
clk => ema_clk,
i_ABus => addr_r,
i_DBus => edi_r, * o_DBus => edo_arm(CORE_GPIO_MODULE),
i_wr_en => wr_r,
i_rd_en => rd_r,
i_cs => arm_cs5_r(CORE_GPIO_MODULE),
o_irq => irq_map(CORE_GPIO_IRQ_LEVEL)(CORE_GPIO_IRQ_VECTOR),
i_ilevel => conv_std_logic_vector(CORE_GPIO_IRQ_LEVEL, 2),
i_ivector => conv_std_logic_vector(CORE_GPIO_IRQ_VECTOR, 4),*
i_io => x"0000",
t_io => open,
o_io => o_diode,
i_initdir => x"FFFF",
i_initoutval => x"0000"
);
------------------------------------------------------
--------------------------------------------
The DSP code
------
-----------------------------------------------
MityDSP::tcDspFpgaGpio* mpGpio;

mpGpio = new tcDspFpgaGpio((void)0x66000080*); /* write the address*/
mpGpio->ConfigurePin(0,0,true,0,true,false); /* config the pin*/
while(1) {
mpGpio->WritePins(0,1,0x0);
for(int i=0;i<1000;i++); /*for delay*/
mpGpio->WritePins(0,1,0x3);
}
------------------------------------------
I just want to the gpio output the value 0x0 and 0x3
Who could help me check out whether I defined these variables right or not?

Thank you very much


Replies (2)

RE: Help me check out the gpio Setup,It is not work. - Added by Michael Williamson almost 10 years ago

The address for the constructor is not correct. The Address is: the CORE offset times 0x80 bytes + 0x66000000.

In your example, it should be 4*0x80 = 0x66000200.

The code looks OK, though you only need a 0x1 instead of a 0x3 for writing to 1 pin (bank 0, offset 0).

-Mike

RE: Help me check out the gpio Setup,It is not work. - Added by lijun yang almost 10 years ago

Thank you very much,Mike

    (1-2/2)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)