Toggle GPIO pins of MYS-8MMX Single Board Computer
Hello @everyone
I'm kundan from india, i just bought a single board computer board (MYS-8MMX). I dont know how can i start. I just want to check the maximum GPIO toggle speed.
In Rpi difference between rising and falling edge in 30ns i am getting, same thing i want to test in this board. Rpi is not suitable for my project.
__ __ __ __
___| |____| |____| |___| |___
| | <-- 30ns difference
So, please suggest me how can i start coding in this board, i am using ubuntu 18 image.
Thank you
Kundan jha
Hii,
Now i can toggle gpio pin, but toggle speed is very slow, can you suggest me how can do more fast toggling. Actually i am getting GPIO rising and falling edge difference is ~1microsecond and i need in ~20 nanosecond. i am attaching my current code for the reference.
gpiod_line_set_value(line, val); //This function call taking more time, how can i reduce.
hi @Sanket_Parekh ,
can you please help me how can i get the line number for MYS-8mmx sbc,
example :
Hello @kundan,
I hope you are doing well.
"can you please help me how can i get the line number for MYS-8mmx sbc,"
->Please correct my understanding if it's wrong, you want to get the unsigned line_num that is gpio pin, basically you wanna perform toggling on, right?
If yes, then one can refer to the below link in which there are a few examples given one can take reference from.
https://blog.lxsang.me/post/
https://community.nxp.com/t5/
I hope this helps!
Thanks & Regards,
Sanket Parekh
Hi @Sanket_Parekh ,
Thanks for your suggestions!!
I am going with this link : https://blog.lxsang.me/post/id/33.
This is compiled properly.
Now i am getting this:
root@bionic-arm64:/root/test# vi openchr_device.c
root@bionic-arm64:/root/test# gcc openchr_device.c
root@bionic-arm64:/root/test# ./a.out
Usage: ./a.out options dev_name.
Options:
-i: print gpio chip info
-r <offset>: Read GPIO value at offset (INPUT mode)
-w <offset>: Write GPIO value at offset (OUTPUT mode). Option -v should be set
-v <0|1>: value that should be written to the GPIO, used only with option -w
-p <offset>: Polling raising event on the GPIO at offset
then next i provided below command and got
root@bionic-arm64:/root/test# ./a.out -i /dev/gpiochip0
Chip name: gpiochip0
Chip label: 30200000.gpio
Number of lines: 32
offset: 0, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 1, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 2, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 3, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 4, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 5, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 6, name: , consumer: . Flags: [OUTPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 7, name: , consumer: . Flags: [OUTPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 8, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 9, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 10, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 11, name: , consumer: . Flags: [OUTPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 12, name: , consumer: . Flags: [OUTPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 13, name: , consumer: reset. Flags: [OUTPUT] [ACTIVE_LOW] [...] [...] [KERNEL]
offset: 14, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 15, name: , consumer: sd1_regulator. Flags: [OUTPUT] [ACTIVE_HIGHT] [...] [...] [KERNEL]
offset: 16, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 17, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 18, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 19, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 20, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 21, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 22, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 23, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 24, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 25, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 26, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 27, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 28, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 29, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 30, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
offset: 31, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT] [...] [...] []
Now i want to write 0 & 1 on the gpio pins. What should i do next.
Hello @kundan,
I hope you are doing well.
Please accept my apology for the delayed response.
"i don't know GPIO pin number, is it offset?"
Yes based on the link you have followed it would look like given below.
offset: 0, name: , consumer: . Flags: [INPUT] [ACTIVE_HIGHT]
So here please try with the pin number you wanted to check with.
It should work according to the command I suggested.
I hope it helps!
Thanks & Regards,
Sanket Parekh
Thanks for your response, I was waiting.
Using this process I am not able to write on GPIO pin, I'm getting error "Unable to open".
Now I moved and using libgpiod. Using this method i can toggle gpio but speed not matching my requirement. I mentioned already. Please see my previous reply.
Hello @kundan,
I hope you are doing well.
"can you suggest me how can do more fast toggling."
->Please refer to the below link.
https://community.nxp.com/t5/
I hope it helps!
Thanks & Regards,
Sanket Parekh
Hello @Sanket_Parekh
Thank you for this suggestions!!
Now i can able to toggle the GPIO pin. But only toggle using command "echo 1 > value" from sys/class/gpio path. and also in script to toggle a GPIO pin. But in this way i am not able to achieve the maximum toggle speed. Can you suggest me another way.
Thanks & Regards,
Kundan Jha
Hello @kundan,
I hope you are doing well.
Please follow the below-given links thoroughly, It will help you understand the board's functioning.
https://www.myirtech.com/list.
Please find the product guide below.
https://www.myirtech.com/soft.
For more details on NXP i.MX8M mini MPU
Datasheet -> https://www.nxp.com/docs/en/
Reference manual -> https://www.nxp.com/webapp/
Please refer to the below link to toggle Gpio.
https://community.nxp.com/t5/
Please also find the knowledge base link given below for more details on toggling Gpio.
https://community.nxp.com/t5/
I hope it helps!
Thanks & Regards,
Sanket Parekh