Forum Discussion
Altera_Forum
Honored Contributor
16 years agoHi Todd,
You will need to disconnect existing ports to all the pins (LED,I2C,BUTTON etc) which you want to use with GPIO. Then you will need to add a single gpio component, named as "gpio_0". You may read the verilog code to understand this trivial core. You will need to connect all the pins(LED,I2C ..etc) to gpio_0 in the top level design. Like this, .bidir_port_to_and_from_the_gpio_0 ( { SCL,SDA,LED[0],sw[1],sw[0] }), Next, you will need to assign the port indexes in the file arch/nios2/kernel/config.c, eg, the above example, static struct i2c_gpio_platform_data i2c_gpio_0_data = { .sda_pin = 3, /* FIXME: gpio pin assignment */ .scl_pin = 4, /* FIXME: gpio pin assignment */ Hope this help. Cheers, Hippo