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.
In Source/ti_tools/ipnc_psp_arago/u_boot/board/ti/dm38x/evm.c
In the function 'static void gpio_init(void)' , code for glowing BB_Led2 in CSK was added. Thus on power on the led glows.
Now a new function 'void led_glow(void)' is written and declared the same in evm.h
I was trying to call this function in a .c file at Source/ipnc_rdk/ipnc_app/...
By including evm.h(with path) in that .c file which I want the led glow function to be called.
But on building it shows an error of No files found for ../evm.h
Can this be done by including headers in makefile ?
What is the correct procedure to achieve this? Please assist.
Thanks n regards.
Nithin Dominic said:So we cannot call u-boot function from user application part? Can't we achieve this by including header files with proper makefile for that?
No, you can not use u-boot.
As Dwarakesh states, you should use GPIO sysfs for user space access. See below wiki pages for more info:
Regards,
Pavel
Thank you Dwarakesh and Pavel,
I was going through the documents and tried as mentioned by Dwarakesh " Export the GPIO(to which LED is connected) to the user space using sysfs and then write the code to access this sysfs entry."
to export the GPIO pin to glow led;
$ echo 56 > /sys/class/gpio/export
$ echo "out" > /sys/class/gpio/gpio56/direction
$ echo 1 > /sys/class/gpio/gpio56/value
Here the LED turns ON.
Then you have mentioned "write the code to access this sysfs entry", where I should write the code? Please explain
How to write the LED glow code anywhere In the code as required?
Regards.
Thank you Pavel,
From following link,
In Driver Usage/ Kernel Level..
I can add the following code in user space:
err = gpio_request(56, LED2);
gpio_direction_output(56, 1);
gpio_export(56, true);
As mentioned in:
please tell me which header file i have to include in my GPIO APIs applications. - Processors forum ...
I was getting similar errors, here the posts suggest to make changes in the makefile
to get rid of the errors. But I got a confusion to make changes in:
../ti/ipnc_rdk-3.9.0/Source/ti_tools/ipnc_psp_arago/kernel/drivers/gpio/Makefile
or the place where I'm trying to use GPIO funtion
../ti/ipnc_rdk-3.9.0/Source/ipnc_rdk/ipnc_app/network/dhcpcd/Makefile
Nithin Dominic said:../ti/ipnc_rdk-3.9.0/Source/ti_tools/ipnc_psp_arago/kernel/drivers/gpio/Makefile
Nithin Dominic said:../ti/ipnc_rdk-3.9.0/Source/ipnc_rdk/ipnc_app/network/dhcpcd/Makefile
None of both. You can not use C application with these functions (gpio_request(), gpio_direction_output(), gpio_export()), you should use external kernel module (.ko file) which should be loaded (with insmod/modprobe) from user space.
You should create your own directory (gpio test directory), where you should place your C code (structured as kernel module, not as user space application) and create your own Makefile, fill it and place it in that directory.
Regards,
Pavel
Nithin Dominic said:So you are saying I cannot call the functions in:
/ti/ipnc_rdk-3.9.0/Source/ti_tools/ipnc_psp_arago/kernel/drivers/gpio/gpiolib-sysfs.c
where we have;
gpiod_export(struct gpio_desc *desc, bool direction_may_change), etc
into my application?
Yes
You can also use C application, but you should export the GPIO functions to user space. All this explained in details in my previous replies.
Nithin Dominic said:So I should use external kernel module loaded from user space
Yes
Nithin Dominic said:How can I create .ko files
There is nothing TI specific in this. You might search in google how to create and use external kernel modules. Example tutorial you can find in the below link:
Nithin Dominic said:To access GPIO pins, I should develop a new GPIO C code?
Where I should place the code, in kernel?
Is it possible to call gpio function into application if I write desperate GPIO code?
I am not able to understand these question, hence I can not provide answers.
Regards,
Pavel
Thank you Pavel,
Now, I'm trying to use C application to access sys/class/gpio from user space.
Let me make the steps to be followed clear;
Can I use the same C code mentioned in the above post, it contains a while(1), I can modify that and use the same for my purpose?
Please help with the proper steps and clear my doubts.
Regards
Hello Pavel,
First of all I thank you for your patience in helping me out.
This document helped: falsinsoft.blogspot.bg/.../access-gpio-from-linux-user-space.html
../Manage GPIO from application
Everything was clear with code to be used, to export and control. Now I am able use GPIOs from my application. :-)
Thank you and Regards