This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Netra GPIO

I am just learning how to manipulate GPIO. I have my kernel set up to use the sysfs interface, for now. I am looking for a GPIO on the 816x EVM (rev E) that will let me "play around". I'd like at least 1 GP attached to a switch that I can toggle, and another attached to an LED that I can toggle.

Secondly, is the schematic the only way to map GP_IO numbers to pins on the chip? Or is there another document?

Thirdly, playing around from the command line use sysfs is not the way I want to do this long term. Are there source code examples? I saw the plethora of gpio.c and gpio.h files in the EZSDK. How do I know which one to use? Are these built into a library somewhere that I link in to my CCS5 project?

Any help would be greatly appreciated.  I have already started looking through Documentation/gpio.txt, and not sure that gets me what I need. Or maybe it does, and I just don't know enough to know it does.

  • I did not work on Ne gpio before. But, regarding documentation, typically, you can find the gpio number to pin mapping in datasheet. Go to ti.com to see if you can download datasheet of Ne.

    What kind of source code example are you looking for? If you search kernel, you will find the examples to use gpio in kernel space.

    Regards,

    Yan




  • Yan,

    Thanks. I am looking to control GPIO from user space. I'd rather not have to develop a kernel mode driver.

  • FYI

    After searching through several other entries within the community, I have come up with the solution to my problem. Basically, it starts with this entry, which has sample code for a kernel module that provides user mode application IOCTL access to the GPIO pins (instead of using the sysfs interface).

                     http://e2e.ti.com/support/embedded/f/354/p/7633/30198.aspx#3019  (DavinciGPIOExample.zip)

    The rest was:

    1) Figuring out how to modify the kernel pin mux config and build the kernel to set pins up for GPIO. The key files in my environment for doing that are:

                      $(EZSDK_HOME)/board_support/<linux_version>/arch/arm/mach-omap2/board-ti816evm.c  (update board_mux structure to set pins of interest to proper mode)

                      $(EZSDK_HOME)/board_support/<linux_version>/arch/arm/mach-omap2/mux81xx.c (ti816x_muxmodes structure contains definitive list of all pins and their mux modes, indicating which pins can be configured for GPIO. Node that the "mux mode" is also determined from this structure by the location of the assignment. So, first location is mode 0, second location is mode 1, etc.)

    2) Figuring out how to build user_gpio.ko in my environment (DM816x EZSDK 5_03_01_15). Required minor changes to user_gpio.c.

    3) Figuring out how to install /dev/user_gpio at boot time. That information came mostly from the following article. The most troublesome and critical piece is ensuring that when /dev/user_gpio is created, that it is created with the same major and minor number as when installed in the kernel with insmod (or modprobe). If this is not done correctly, the user mode application will not be able to open the device.

                      http://e2e.ti.com/support/embedded/linux/f/354/p/41722/145921.aspx#145921

    If anyone is interested in more details, please do not hesitate to contact me directly. I am on the hook for developing an internal blog post that details everything I did to get this working, and I may also post that here at a later time.

    Hope this helps others.