This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
/sys/class/gpio ?
#1
i have export gpio2(connect to pin 3 on board)  , use led blink for experiment .
root@rk3288:/sys/class/gpio/gpio2 # echo low > direction 
root@rk3288:/sys/class/gpio/gpio2 # echo high > direction      

seems it does not blink..   
 my question is is the the number of gpio match pin number of board ?  i ref the diagram in attachment


Attached Files Thumbnail(s)
   
Reply
#2
(12-19-2017, 02:41 AM)leonzhangzhang Wrote: i have export gpio2(connect to pin 3 on board)  , use led blink for experiment .
root@rk3288:/sys/class/gpio/gpio2 # echo low > direction 
root@rk3288:/sys/class/gpio/gpio2 # echo high > direction      

if you want ot change direction:
you can try "echo in > direction" or "echo out > direction".
if you want to pull high/low: 
you can try "echo 1 > value" or "echo 0 > value"

(12-19-2017, 02:41 AM)leonzhangzhang Wrote: seems it does not blink..   
 my question is is the the number of gpio match pin number of board ?  i ref the diagram in attachment 

1. you can find some string like GP7C1_I2C4_SDA,... in my attachment.

2. please check the table as below, 

A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
0   1   2   3   4   5   6   7   8   9  10 11 12 13 14  15 16 17  18 19 20 21 22 23  24  25 26 27 28  29 30 31

so, redefine "GP7C1_I2C4_SDA" to "gpio7-17"

3. sudo cat  /sys/kernel/debug/pinctrl/pinctrl/pins
pin 229 (gpio7-13)                                                                                                                                                      
pin 230 (gpio7-14)
pin 231 (gpio7-15)
pin 232 (gpio7-16)
pin 233 (gpio7-17)
pin 234 (gpio7-18)


Attached Files Thumbnail(s)
   

Reply
#3
(12-19-2017, 09:30 AM)scorpiochang Wrote:
(12-19-2017, 02:41 AM)leonzhangzhang Wrote: i have export gpio2(connect to pin 3 on board)  , use led blink for experiment .
root@rk3288:/sys/class/gpio/gpio2 # echo low > direction 
root@rk3288:/sys/class/gpio/gpio2 # echo high > direction      

if you want ot change direction:
you can try "echo in > direction" or "echo out > direction".
if you want to pull high/low: 
you can try "echo 1 > value" or "echo 0 > value"

(12-19-2017, 02:41 AM)leonzhangzhang Wrote: seems it does not blink..   
 my question is is the the number of gpio match pin number of board ?  i ref the diagram in attachment 

1. you can find some string like GP7C1_I2C4_SDA,... in my attachment.

2. please check the table as below, 

A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
0   1   2   3   4   5   6   7   8   9  10 11 12 13 14  15 16 17  18 19 20 21 22 23  24  25 26 27 28  29 30 31

so, redefine "GP7C1_I2C4_SDA" to "gpio7-17"

3. sudo cat  /sys/kernel/debug/pinctrl/pinctrl/pins
pin 229 (gpio7-13)                                                                                                                                                      
pin 230 (gpio7-14)
pin 231 (gpio7-15)
pin 232 (gpio7-16)
pin 233 (gpio7-17)
pin 234 (gpio7-18)



cheers scorpiochang,
it works , is there any way same as GPIO test for PWM ?
Reply
#4
Hi leonzhangzhang

here is example as below,
https://github.com/TinkerBoard/gpio_lib_...ples/pwm.c

for more detail:

Hardware PWMvoid pwmWrite(int pin, int value)

pwmWrite function creates a pwm with (high-level x value PWM clock) per period.
This function is only used for PIN 32 and PIN 33 in physical pin numbering scheme which is setted as the PWM_OUTPUT mode.
The range of parameter value is between 0 and the setted period value.

void pwmSetRange(unsigned int range)

pwmSetRange function sets the period of PWM Output to the parameter range.
The default range is 1024.

void pwmSetClock(int divisor)

pwmSetClock function sets the divisor which effects the frequency of the PWM clock to the parameter freq.
The range of parameter divisor is between 0 and 255.

Reply
#5
(12-21-2017, 02:30 AM)scorpiochang Wrote: Hi leonzhangzhang

here is example as below,
https://github.com/TinkerBoard/gpio_lib_...ples/pwm.c

for more detail:

Hardware PWMvoid pwmWrite(int pin, int value)

pwmWrite function creates a pwm with (high-level x value PWM clock) per period.
This function is only used for PIN 32 and PIN 33 in physical pin numbering scheme which is setted as the PWM_OUTPUT mode.
The range of parameter value is between 0 and the setted period value.

void pwmSetRange(unsigned int range)

pwmSetRange function sets the period of PWM Output to the parameter range.
The default range is 1024.

void pwmSetClock(int divisor)

pwmSetClock function sets the divisor which effects the frequency of the PWM clock to the parameter freq.
The range of parameter divisor is between 0 and 255.


thanks ,  does PIN 32 and PIN 33 in physical pin support PWM_IN  ?
i want to read IR senser which the data transfer interface should set pwm in & use analogRead(pinNo); 
how to ?

(12-21-2017, 02:30 AM)scorpiochang Wrote: Hi leonzhangzhang

here is example as below,
https://github.com/TinkerBoard/gpio_lib_...ples/pwm.c

for more detail:

Hardware PWMvoid pwmWrite(int pin, int value)

pwmWrite function creates a pwm with (high-level x value PWM clock) per period.
This function is only used for PIN 32 and PIN 33 in physical pin numbering scheme which is setted as the PWM_OUTPUT mode.
The range of parameter value is between 0 and the setted period value.

void pwmSetRange(unsigned int range)

pwmSetRange function sets the period of PWM Output to the parameter range.
The default range is 1024.

void pwmSetClock(int divisor)

pwmSetClock function sets the divisor which effects the frequency of the PWM clock to the parameter freq.
The range of parameter divisor is between 0 and 255.


thanks ,  does PIN 32 and PIN 33 in physical pin support PWM_IN  ?
i want to read IR senser which the data transfer interface should set pwm in & use analogRead(pinNo); 
how to ?

(12-21-2017, 07:48 AM)leonzhangzhang Wrote:
(12-21-2017, 02:30 AM)scorpiochang Wrote: Hi leonzhangzhang

here is example as below,
https://github.com/TinkerBoard/gpio_lib_...ples/pwm.c

for more detail:

Hardware PWMvoid pwmWrite(int pin, int value)

pwmWrite function creates a pwm with (high-level x value PWM clock) per period.
This function is only used for PIN 32 and PIN 33 in physical pin numbering scheme which is setted as the PWM_OUTPUT mode.
The range of parameter value is between 0 and the setted period value.

void pwmSetRange(unsigned int range)

pwmSetRange function sets the period of PWM Output to the parameter range.
The default range is 1024.

void pwmSetClock(int divisor)

pwmSetClock function sets the divisor which effects the frequency of the PWM clock to the parameter freq.
The range of parameter divisor is between 0 and 255.


thanks ,  does PIN 32 and PIN 33 in physical pin support PWM_IN  ?
i want to read IR senser which the data transfer interface should set pwm in & use analogRead(pinNo); 
how to ?

(12-21-2017, 02:30 AM)scorpiochang Wrote: Hi leonzhangzhang

here is example as below,
https://github.com/TinkerBoard/gpio_lib_...ples/pwm.c

for more detail:

Hardware PWMvoid pwmWrite(int pin, int value)

pwmWrite function creates a pwm with (high-level x value PWM clock) per period.
This function is only used for PIN 32 and PIN 33 in physical pin numbering scheme which is setted as the PWM_OUTPUT mode.
The range of parameter value is between 0 and the setted period value.

void pwmSetRange(unsigned int range)

pwmSetRange function sets the period of PWM Output to the parameter range.
The default range is 1024.

void pwmSetClock(int divisor)

pwmSetClock function sets the divisor which effects the frequency of the PWM clock to the parameter freq.
The range of parameter divisor is between 0 and 255.


thanks ,  does PIN 32 and PIN 33 in physical pin support PWM_IN  ?
i want to read IR senser which the data transfer interface should set pwm in & use analogRead(pinNo); 
how to ?


thanks ,  does PIN 32 and PIN 33 in physical pin support PWM_IN  ?

i want to read IR senser which the data transfer interface should set pwm in & use analogRead(pinNo); 
how to ?
Reply
#6
Hi leonzhangzhang

I am not sure, but i think Tinker Board doesn't support analogRead().
BTW, does LIRC satisfy your requirement?

Reply
#7
(12-21-2017, 10:07 AM)scorpiochang Wrote: Hi leonzhangzhang

I am not sure, but i think Tinker Board doesn't support analogRead().
BTW, does LIRC satisfy your requirement?

(12-22-2017, 03:01 AM)leonzhangzhang Wrote:
(12-21-2017, 10:07 AM)scorpiochang Wrote: Hi leonzhangzhang

I am not sure, but i think Tinker Board doesn't support analogRead().
BTW, does LIRC satisfy your requirement?


actually  i want use Sharp IR for distance detect(see attachement) , the distance data should analogRead


Attached Files Thumbnail(s)
       
Reply
#8
(12-22-2017, 03:01 AM)leonzhangzhang Wrote:
(12-21-2017, 10:07 AM)scorpiochang Wrote: Hi leonzhangzhang

I am not sure, but i think Tinker Board doesn't support analogRead().
BTW, does LIRC satisfy your requirement?

(12-22-2017, 03:01 AM)leonzhangzhang Wrote:
(12-21-2017, 10:07 AM)scorpiochang Wrote: Hi leonzhangzhang

I am not sure, but i think Tinker Board doesn't support analogRead().
BTW, does LIRC satisfy your requirement?


actually  i want use Sharp IR for distance detect(see attachement) , the distance data should analogRead

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)