Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

DE2 Expansion Header

:confused: Hi,

I'm trying to do a parallel communication between the CycloneII of the DE2 kit and an external uC. Getting signals out of the DE2 kit on the expansion header is not a problem, but reading from the expansion header doesn't work at all. I have no problems with CycloneII inputs that are already connected with switches or pushbutton on the DE2. Is there any difference with PIO pins that we use as inputs? Is there any special configuration I have to do when I am programming (simulations works perfectly)?

Thanks in advance.

17 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    module project (KEY,GPIO_0);

    // input [3:0] SW;

    input [3:0] KEY;

    output [19:0] GPIO_0;

    assign GPIO_0[10] = KEY[0]; //pin 13 for KEY0 (up)

    assign GPIO_0[12] = KEY[1]; //pin 15 for KEY1 (down)

    assign GPIO_0[14] = KEY[2]; //pin 17 for KEY2 (left)

    assign GPIO_0[16] = KEY[3]; //pin 19 for KEY3 (right)

    endmodule

    --- Quote End ---

    --- Quote Start ---

    set_global_assignment -name FAMILY "Cyclone II"

    set_global_assignment -name DEVICE EP2C35F672C6

    set_global_assignment -name TOP_LEVEL_ENTITY project

    set_global_assignment -name ORIGINAL_QUARTUS_VERSION 10.0

    set_global_assignment -name PROJECT_CREATION_TIME_DATE "15:12:27 MARCH 09, 2011"

    set_global_assignment -name LAST_QUARTUS_VERSION 10.0

    set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0

    set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85

    set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 1

    set_global_assignment -name VERILOG_FILE project.v

    set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top

    set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top

    set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top

    set_global_assignment -name LL_ROOT_REGION ON -section_id "Root Region"

    set_global_assignment -name LL_MEMBER_STATE LOCKED -section_id "Root Region"

    set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "3.3-V LVTTL"

    set_location_assignment PIN_J24 -to GPIO_0[19]

    set_location_assignment PIN_J23 -to GPIO_0[18]

    set_location_assignment PIN_H24 -to GPIO_0[17]

    set_location_assignment PIN_H23 -to GPIO_0[16]

    set_location_assignment PIN_G25 -to GPIO_0[15]

    set_location_assignment PIN_K22 -to GPIO_0[14]

    set_location_assignment PIN_G24 -to GPIO_0[13]

    set_location_assignment PIN_G23 -to GPIO_0[12]

    set_location_assignment PIN_P18 -to GPIO_0[11]

    set_location_assignment PIN_N18 -to GPIO_0[10]

    set_location_assignment PIN_F26 -to GPIO_0[9]

    set_location_assignment PIN_F25 -to GPIO_0[8]

    set_location_assignment PIN_J20 -to GPIO_0[7]

    set_location_assignment PIN_J21 -to GPIO_0[6]

    set_location_assignment PIN_F23 -to GPIO_0[5]

    set_location_assignment PIN_F24 -to GPIO_0[4]

    set_location_assignment PIN_E25 -to GPIO_0[3]

    set_location_assignment PIN_E26 -to GPIO_0[2]

    set_location_assignment PIN_J22 -to GPIO_0[1]

    set_location_assignment PIN_D25 -to GPIO_0[0]

    set_location_assignment PIN_W26 -to KEY[3]

    set_location_assignment PIN_P23 -to KEY[2]

    set_location_assignment PIN_N23 -to KEY[1]

    set_location_assignment PIN_G26 -to KEY[0]

    set_global_assignment -name MISC_FILE "C:/altera/10.0/project/project.dpf"

    set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

    --- Quote End ---

    Here you go. There are always different results when I program it into the DE2. Now that I'm home and using my PC. there's not reaction from the keys whether I press it or not, compared to previously
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There are a couple of variations of the DE2, for example I have the DE2-70. It looks like you have the original: http://www.terasic.com.tw/cgi-bin/page/archive.pl?language=english&categoryno=53&no=30

    Assuming that, both files look correct, so perhaps GPIO_0[10] etc isn't where you think they are?

    As a general debugging technique, I recommend that you _also_ assign those keys to four LEDs. If you see the LEDs react to key presses as expected, then you know that

    1) your design was loaded correct and

    2) the problem isn't with the KEY input.

    Tommy
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi there, many thanks for your help! (^^)/ Was able to learn alot. I found out what is wrong so thanks very much for your guidance during these days :)

    Have a great day!! XD
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'm curious, could you share what ultimately was the problem?

    Thanks

    Tommy
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Apparently there were some shortage issues on the circuit as it was too small of a space to work on >< so it's hardware issues. I wasn't too sure what happened previously when I had no shortage issue (I believe this arise because I re-solder some of the wires) and that I couldn't get the solution either.

    However, since it's miraculously done, perhaps the older issue could be due to the pin assignments which I might have carelessly assigned (or perhaps seeing the wrong set of pin assignments). This is a very embarrassing mistake I've made >.< Sorry for all the trouble I made you go through :(
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Nah, it's fine. I myself have been ramming my head against a particular problem for weeks now so I understand such frustration.

    The key lesson I was trying to convey was a general debugging technique (starting from a known good point and working towards the problem in small steps).

    Glad you got over this particular hurdle.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi all,

    I have a DE2 board and I´m developing a project that use de Expansion Header GPIO_1 to connect two boards, so I have the follow situation :

    When I configure the board_2 to be a receiver and the board_1 to be a sender, all is in correctly execution (the board_1 set the GPIO_1 and the board_2 light the LEDR according the values of the pins).

    My problem is: when I configure the both boards like sender/receiver, the datas are not transfered through the GPIO_1 pins, even that the write happens in a different moments.

    Can you help me??? Do you know if a have to use a bus management???

    Any idea??

    :confused: