Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: HPS GPIO's ouputs stuck in high impedence?

  1. #1
    Join Date
    Jun 2015
    Posts
    8
    Rep Power
    1

    Default HPS GPIO's ouputs stuck in high impedence?

    I have an issue regarding a custom board the GPIOs where all the HPS IO’s are set to high impedance no matter to how they are set.

    I have tested the following:
    • GPIO system on linux enabling each of the GPIOs as an output through the controller... and writing values to them... (findings it changes to output state but the value doesn’t alter and reads back high - unchanged)
    • GPIO controller address read/write (findings values don’t change)
    • Pre-Linux Hardware GPIO Loaning Pins driving a value change on preloader startup to enable a LED (findings no value on GPIO changes value)


    So overall the pin mux is there just the GPIO is always set to high... no matter if the gpio output is enabled and values are written to it. All three methods work on our development board with or without Linux drivers included for the LEDs “gpio-leds” simple driver, but not on the custom board. Our PCB has the HPS GPIO LEDs that do not light or even the unconnected header pin doesn’t change value (in your experience does a open gpio pin change value (we think it should still be driven) – this would mean that it is not a driver issue)

    The LED output schematic and just applying a 1 or 0 would change this state no problem. It is a different type of Led than the one used on the development board. It uses a power driven led that has a dual red and green operation so should work.

    With the open gpio pins not changing state this points to high impedance for all gpio’s, which I am trying to see the differences.

    1) Our GPIO Controller has 67 I/O pins connected but none of the 14 input ony pins. (I will try searching for this configurable through u-boot?) – states if not connected need to be weak pull-up.

    2) Device Tree can be set without LED driver on the sockit to drive the simple LED’s or can be set accordingly without setting the GPIO through the altera software.
    With our leds requiring a power-supply are there special flags to use in the driver but the power is already been supplied, but even the open pin doesn’t drive a signal so I doubt this is the issue.

    3) Current Drive or signal circuitry?

    Please Advise on what could make the GPIO's not change state and become driven always at the 3.3V outputted voltage?

    Thanks

    Kyle

  2. #2
    Join Date
    Mar 2017
    Posts
    10
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Hi Kyle,

    even I was trying to access GPIO using DEO nano but faced issues...did you get any answer??..should we change the high impedance state in Linux boot if so how??

    --Ravi

  3. #3
    Join Date
    Jun 2015
    Posts
    8
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Hi Ravi,

    I've Fixed this issue for both the GPIO and LOAN IO.

    GPIO
    Just make sure when you enable the GPIO's in the peripheral pins in Qsys... that you update the Assignment editor page to include your linked pin
    eg.
    hps_io_hps_io_gpio_inst_GPIO49 => HPS_GPIO49 -- loans out to the Top level Port HPS_GPIO49 so add this to Assigments > Assignment editor
    To [HPS_GPIO49] Assignment Name [I/O Standard] Value [Voltage value of output]
    Recompile the project and the GPIO should be available.

    LOAN pins are different you need make sure from your Qsys design you export the loanio pins back into your top level design.
    hps_0_h2f_loan_io_in : out std_logic_vector(66 downto 0);
    hps_0_h2f_loan_io_out : in std_logic_vector(66 downto 0) := (others => '0');
    hps_0_h2f_loan_io_oe : in std_logic_vector(66 downto 0) := (others => '0');
    the inputs are assigned to the in... and the outputs to outputs... (when they are output make the oe vector for that pin 1 to enable it as an output)

    This is pretty much it... happy to help the documentation is brief but pretty much it works well once you do this.

    Good Luck

    Kyle

  4. #4
    Join Date
    Mar 2017
    Posts
    10
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    " Hi kyle,

    when you go to Assignment Editor there are 2 rows you see for each pins
    GPIO_1[0] Location( This is changed to HPS_IO) and select Enable(Yes)
    GPIO_1[1] I/O standard 3.3 V LVTTL

    Once I did this and compiled and flashed the .SOF then Pin 2 of GPIO_1 cannot be accessed. I have a C file which changes the Set bits and Clr bits..But I am not able to take control of the GPIO_1 pin.Is there any jumper which we need to change.also are my configurations correct.
    Once I get one pin I can map for others.
    Kindly let me know."

    regards
    Ravi

  5. #5
    Join Date
    Mar 2017
    Posts
    10
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Hi Kyle,

    Thanks for your support...also would like to know if there are any configurations in the Assignments->Device->Deviceandpinoptions->Unused pins (An input Tristated) to access the pin and see the output. I am using a C file which has hps.h through which I assign GPIO1_SWPORTA_DR_ADDR and configuring these registers to get the output.
    eg:
    #include <stdio.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <sys/mman.h>
    #include "hwlib.h"
    #include "soc_cv_av/socal/socal.h"
    #include "soc_cv_av/socal/hps.h"
    #include "soc_cv_av/socal/alt_gpio.h"

    #define HW_REGS_BASE ( ALT_STM_OFST )
    #define HW_REGS_SPAN ( 0x04000000 )
    #define HW_REGS_MASK ( HW_REGS_SPAN - 1 )

    #define USER_IO_DIR (0x01000008)
    #define BIT_LED (0x01000008)
    #define BUTTON_MASK (0x02000000)

    int main(int argc, char **argv) {

    void *virtual_base;
    int fd;
    uint32_t scan_input;
    int i;
    // map the address space for the LED registers into user space so we can interact with them.
    // we'll actually map in the entire CSR span of the HPS since we want to access various registers within that span
    if( ( fd = open( "/dev/mem", ( O_RDWR | O_SYNC ) ) ) == -1 ) {
    printf( "ERROR: could not open \"/dev/mem\"...\n" );
    return( 1 );
    }

    virtual_base = mmap( NULL, HW_REGS_SPAN, ( PROT_READ | PROT_WRITE ), MAP_SHARED, fd, HW_REGS_BASE );

    if( virtual_base == MAP_FAILED ) {
    printf( "ERROR: mmap() failed...\n" );
    close( fd );
    return( 1 );
    }
    // initialize the pio controller
    // led: set the direction of the HPS GPIO1 bits attached to LEDs to output
    alt_clrbits_word( ( virtual_base + ( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR) & ( uint32_t )( HW_REGS_MASK ) ) ), BIT_LED );
    alt_setbits_word( ( virtual_base + ( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR) & ( uint32_t )( HW_REGS_MASK ) ) ), USER_IO_DIR );


    so this should work..Let me know get some idea

    --Ravi

  6. #6
    Join Date
    Jun 2015
    Posts
    8
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Ravi,

    The Assignment editor needs to be set to Assignment Name [I/O Standard] this is a must is shouldn't be a "location" on the FPGA as there is no location it goes through into the preloader and is linked there.
    The Value is instead set to the Voltage level [3.3-V LVCMOS] your maybe less depending on the hps powered IO's it could be 2.5V or lower please check this. Enabled is yes too so that would be correct.

    Please try the linux commands from the HPS command line first (before memory mapping) to make sure that the GPIO's can be set... follow this tutorial for setting the GPIO's
    If there are LED's then you should be just write a active low or high signal to them from the command line....

    Follow this tutorial and see if the LED's light on the gpio then you can start to progress into the memory mapping application code..
    http://falsinsoft.blogspot.co.uk/201...ser-space.html

    It looks like your code is correct but you need to just make sure that the GPIO is controllable from the drivers in linux the following echo commands will help you enable an GPIO output (number is significant please find out the number of the GPIO from linux and cyclone V handbook for specifying the correct GPIO) here 192 is used as this is from the GPIO controller 2 and is the 1st one your number will be different please check for your correct one.

    echo 192 > /sys/class/gpio/export
    echo "out" > /sys/class/gpio/gpio192/direction
    echo 1 > /sys/class/gpio/gpio192/value
    echo 0 > /sys/class/gpio/gpio192/value

    The first echo line enables the gpio.... if you get problems here the gpio is already attached to a linux driver and will need removing (look into removing a driver)
    The second enables that channel to become an output as all gpio's are either in or output the default is always input so this enables you send the gpio as high or low...etc
    The next 2 lines will write a high or low value to that gpio you should see the light move on and off if it is correctly enabled.

    Best of luck

    Kyle

    Without finding problems you never learn.

  7. #7
    Join Date
    Mar 2017
    Posts
    10
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Hi kyle,

    Not able to get the GPIO toggle working for GPIO_1 any suggestions from your side where in assignment editor changes need to be made so that we can toggle the switch??.will really help if you reply.waiting for your response

    regards
    Ravi chandran

  8. #8
    Join Date
    Mar 2017
    Posts
    10
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Hi kyle,

    thanks for your reply.I tried the way you told using the Linux but this did not work.The GPIO was not accessible.so from linux itself I am not able to control.if we solve this then user space code will work.

    My Assignment editor looks like this the 2 rows for each pin
    original
    To:GPIO_1[1] Assignment name-> Location PIN_Name(value) Enabled(yes)
    GPIO_1[1] Assignment name-> I/O standard 3.3V LVTTL(value) Enabled(yes)

    My changed version
    To:GPIO_1[1] Assignment name-> HPS_IO ON(value) Enabled(yes)
    GPIO_1[1] Assignment name-> I/O standard 3.3V LVTTL(value) Enabled(yes)

    Is this correct ??.. Like this I need to enable for all other pins.Is there any thing I missed assigning here???..Let me know.Any configuration changes.
    In the device option also I have chooseb UNUSED pin as INPUT state TRIGERRED.

    created the .SOF and programmed and ran the linux command but did not work..Kindly let me know if you see any errors here

    thanks in advance

    --Ravi





    Quote Originally Posted by KIO View Post
    Ravi,

    The Assignment editor needs to be set to Assignment Name [I/O Standard] this is a must is shouldn't be a "location" on the FPGA as there is no location it goes through into the preloader and is linked there.
    The Value is instead set to the Voltage level [3.3-V LVCMOS] your maybe less depending on the hps powered IO's it could be 2.5V or lower please check this. Enabled is yes too so that would be correct.

    Please try the linux commands from the HPS command line first (before memory mapping) to make sure that the GPIO's can be set... follow this tutorial for setting the GPIO's
    If there are LED's then you should be just write a active low or high signal to them from the command line....

    Follow this tutorial and see if the LED's light on the gpio then you can start to progress into the memory mapping application code..
    http://falsinsoft.blogspot.co.uk/201...ser-space.html

    It looks like your code is correct but you need to just make sure that the GPIO is controllable from the drivers in linux the following echo commands will help you enable an GPIO output (number is significant please find out the number of the GPIO from linux and cyclone V handbook for specifying the correct GPIO) here 192 is used as this is from the GPIO controller 2 and is the 1st one your number will be different please check for your correct one.

    echo 192 > /sys/class/gpio/export
    echo "out" > /sys/class/gpio/gpio192/direction
    echo 1 > /sys/class/gpio/gpio192/value
    echo 0 > /sys/class/gpio/gpio192/value

    The first echo line enables the gpio.... if you get problems here the gpio is already attached to a linux driver and will need removing (look into removing a driver)
    The second enables that channel to become an output as all gpio's are either in or output the default is always input so this enables you send the gpio as high or low...etc
    The next 2 lines will write a high or low value to that gpio you should see the light move on and off if it is correctly enabled.

    Best of luck

    Kyle

    Without finding problems you never learn.

  9. #9
    Join Date
    Mar 2017
    Posts
    10
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Hi kyle,

    thanks for your reply.I tried the way you told using the Linux but this did not work.The GPIO was not accessible.so from linux itself I am not able to control.if we solve this then user space code will work.

    My Assignment editor looks like this the 2 rows for each pin
    original
    To:GPIO_1[1] Assignment name-> Location PIN_Name(value) Enabled(yes)
    GPIO_1[1] Assignment name-> I/O standard 3.3V LVTTL(value) Enabled(yes)

    My changed version
    To:GPIO_1[1] Assignment name-> HPS_IO ON(value) Enabled(yes)
    GPIO_1[1] Assignment name-> I/O standard 3.3V LVTTL(value) Enabled(yes)

    Is this correct ??.. Like this I need to enable for all other pins.Is there any thing I missed assigning here???..Let me know.Any configuration changes.
    In the device option also I have chooseb UNUSED pin as INPUT state TRIGERRED.

    created the .SOF and programmed and ran the linux command but did not work..Kindly let me know if you see any errors here

    thanks in advance

    --Ravi

  10. #10
    Join Date
    Jun 2015
    Posts
    8
    Rep Power
    1

    Default Re: HPS GPIO's ouputs stuck in high impedence?

    Hey Ravi,

    Looks like you have too many assignments.... please remove all...
    For the HPS pin outs... from the GPIO you need to make sure they are selected in the peripheral pin outs as exported GPIO (which you look to have done with GPIO_1).
    This is then built into the top level file with your pin as GPIO_1: INOUT STD_LOGIC in the port declarations and then mapped to the port map for the qsys ip. (part of the tutorial).
    Now this map is to hps_io_hps_io_gpio_inst_GPIO1 => GPIO_1 in your case... so the system is linked to the top level pin (specified as INOUT as this is normal for a GPIO).

    Now in order for the preloader to know you want that top level pin [GPIO_1] enabled you need set it once in the assignment editor...
    GPIO_1 Assignment name-> I/O standard 3.3V LVTTL(value) Enabled(yes) <- this is the only one you need... i think you might of named it in a vector or something but just trial one first to make sure your doing it right.

    I cannot help you any more than this. If it still not works out it may still be a hardware failure but unlikely.

    Best of luck

    Kyle

Similar Threads

  1. Replies: 1
    Last Post: January 14th, 2017, 06:17 AM
  2. gpio input stuck on high level '1'
    By shlomi_r6 in forum VHDL
    Replies: 1
    Last Post: September 19th, 2015, 05:49 AM
  3. Replies: 7
    Last Post: July 23rd, 2013, 06:14 AM
  4. A High Impedence Shift Register
    By NilRecurring in forum Quartus II and EDA Tools Discussion
    Replies: 26
    Last Post: June 1st, 2012, 01:22 PM
  5. Pins stuck high or low in Cyclone II
    By aakula in forum Quartus II and EDA Tools Discussion
    Replies: 5
    Last Post: September 2nd, 2011, 12:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •