Hey all,
So I'm making some pretty good progress on my board and learning a ton but I've hit a major road block I'm hoping you can help with... I'm using the DE2_70_NET project for the DE2-70 board found in the demonstrations folder of the Terasic provided CD. The project has a bunch of "PIO (Parallel I/O)" components for things like switches, LEDs, buttons, and an I2C bus (connected to a Wolfson audio chip). I'm trying to get the I2C driver working in an attempt to begin talking to the audio chip. I'm loosely following instructions found at http://www.nioswiki.com/gpio but the instructions are for a special component, a different development board, and aren't really instructions at all and are more like someone's posted posted files and a few words saying 'here you figure it out'. Not very helpful. So without dealing with the proprietary GPIO component there, I tried adding the driver for "GPIO Interface" in the Kernel Config: Processor Type and Features --> GPIO Interface. However when I compile it keeps stopping with an error on compilation of config.c saying:/home/todd/nios2-linux/linux-2.6/arch/nios2/kernel/config.c: In function `nios2_gpio_init':
/home/todd/nios2-linux/linux-2.6/arch/nios2/kernel/config.c:104: error: `na_gpio_0' undeclared (first use in this function)
/home/todd/nios2-linux/linux-2.6/arch/nios2/kernel/config.c:104: error: (Each undeclared identifier is reported only once
/home/todd/nios2-linux/linux-2.6/arch/nios2/kernel/config.c:104: error: for each function it appears in.)
make: *** Error 1
make: *** Error 2
I even went so far as to add a SOPC builder component called 'gpio_0' and it still fails compilation. Am I missing something? How does one properly compile a kernel with the standard GPIO Interface enabled in the kernel config? Do all of my GPIO pins in my design go through a single SOPC builder component like in the example: http://www.nioswiki.com/gpio ? Or can I use that same driver for each of my GPIO components? Thanks! Todd
链接已复制
2 回复数
Hi 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