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
Why is the Tinker Board GPIO ports so slow?
#1
On the Tinker Board , I have tested a simple GPIO application using preinstalled wiringPi C library. I also ran the same application on Raspberry Pi using preinstalled wiringPi C library, but I noticed that the Tinkerboard GPIO speed is very slow. I wonder why this is the case. I would appreciate, if someone share opinion about it. I've added the C program and attached  oscilloscope screen-display for GPIO port speed for both Tinker Board and Raspberry Pi.

 I tested Tinker Board with  2018-02-22-tinker-board-linaro-stretch-alip-v2.0.5  image. GPIO speed is about 158 Khz
 I tested  Raspberry PI 3 Model B with  2018-03-13-raspbian-stretch image. GPIO speed is about 1.92 Mhz

#include <stdio.h>
#include <wiringPi.h>

#define LED     0

int main (void)
        {
        printf ("TB blink\n");

        wiringPiSetup ();
        pinMode (LED, OUTPUT);

        for (;Wink
        {
                //printf ("led on\n");
                digitalWrite (LED, HIGH);
                //delay (500);
                //printf ("led off\n");
                digitalWrite (LED, LOW);
                //delay (500);
         }
        return 0;
}

/* #define LED 0 matches with ASUS_GPIO 164! 
 This can be checked with command 'sudo gpio readall'.

To compile the script run the command:
sudo gcc -o blink blink.c -lwiringPi

To run the newly compiled led run the command:
sudo ./blink
 
*/


Attached Files
.bmp   Raspberry Pi.BMP (Size: 46.99 KB / Downloads: 78)
.bmp   Tinker.BMP (Size: 46.99 KB / Downloads: 78)
Reply
#2
Did you try to fix the CPU frequency?

I remember the Tinker is use ondemand this cpu governor, to dymanice the CPU's frequency.
Try to fix the min scale range or as the performance mode.

(04-09-2018, 03:13 AM)Craz_tyle Wrote: Try this, it can keep CPU at the performance mode (1.8GHz)
Code:
echo performance | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_governor

But need to make sure the temperature, because if when higher than 70C, would start throttling to keep safe?

Or you can just change MIN and MAX freq at CPU scaling range.
e.g. MAX 1.8GHz
Code:
echo 1800000 | sudo tee sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
e.g. MIN 1.2GHz
Code:
echo 1200000 | sudo tee sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
from: https://tinkerboarding.co.uk/forum/threa...ml#pid5473
Reply
#3
(04-22-2018, 11:49 AM)frankwu100 Wrote: Did you try to fix the CPU frequency?

I remember the Tinker is use ondemand this cpu governor, to dymanice the CPU's frequency.
Try to fix the min scale range or as the performance mode.

Thanks for your response.
Yes You are right, Tinker is use ondemand this cpu governor, to dymanice the CPU's frequency. I watched CPU speed using below command, I get 1.8 Ghz while C test program was runnig.

watch -n 1 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

maybe, someone said that, the tinkers wiringPi has a 'fallback' to sysFS (/sys/class/gpio) and RPis wiringPi is based on gpiomem (writing direct to the SoCs registers). sysFS in known to be slower than gpiomem.
Reply
#4
Hi promate

two things:
1. gpio_clk_disable and gpio_clk_recovery take too much time.
2. i don't know how to do gcc optimize about | and & operation, so i replace those with assemble code.

please check https://github.com/TinkerBoard/gpio_lib_...4b51351a2b
 
finally, can you try the latest version of https://github.com/TinkerBoard/gpio_lib_c.git?
i test it at my side, freq can reach to 2.4Mhz.
if you can patch attachment to newest kernel, it can up to 7.4MHz.

thank you.


Attached Files
.gz   0001-up-GPIO-clock-to-74.25Mhz.patch.tar.gz (Size: 1.08 KB / Downloads: 17)

Reply
#5
(05-17-2018, 03:20 AM)scorpiochang Wrote: Hi promate

two things:
1. gpio_clk_disable and gpio_clk_recovery take too much time.
2. i don't know how to do gcc optimize about | and & operation, so i replace those with assemble code.

please check https://github.com/TinkerBoard/gpio_lib_...4b51351a2b
 
finally, can you try the latest version of https://github.com/TinkerBoard/gpio_lib_c.git?
i test it at my side, freq can reach to 2.4Mhz.
if you can patch attachment to newest kernel, it can up to 7.4MHz.

thank you.

Thank you for your response.

I recompiled  gpio_li_c  on tinker board, right now I got gpio speed about  2.4Mhz.
But when I use other my GLCD program that uses wiringPI gpio library c. The system has shut down and even the power LED on the card is off.


When I recompile your modified code I got a warning "wiringPi.c:2207:2: warning: implicit declaration of function ‘gpio_clk_enable’ [-Wimplicit-function-declaration] gpio_clk_enable();"

linaro@tinkerboard:~/gpio_lib_c$ sudo ./build
wiringPi Build script
=====================

WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringTB.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
wiringPi.c: In function ‘wiringPiSetup’:
wiringPi.c:2207:2: warning: implicit declaration of function ‘gpio_clk_enable’ [-Wimplicit-function-declaration]
  gpio_clk_enable();
  ^~~~~~~~~~~~~~~
[Compile] softPwm.c
[Compile] softTone.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Compile] wpiExtensions.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
[Compile] readall.c
[Compile] pins.c
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringPi, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

linaro@tinkerboard:~/gpio_lib_c$
Reply
#6
Hi promate

i want to reproduce this issue.
Can you share glcd program to me?
What OS you use?
Does Tinkerboard shutdown immediately every time after you execute glcd program?
Does any error message output to debug console(UART)?

P.S. please also check your adapter can supply 5V/3A. if current lower than 2.5A, device will be unstable in some case.

Reply
#7
(05-22-2018, 11:27 PM)scorpiochang Wrote: Hi promate

i want to reproduce this issue.
Can you share glcd program to me?
What OS you use?
Does Tinkerboard shutdown immediately every time after you execute glcd program?
Does any error message output to debug console(UART)?

P.S. please also check your adapter can supply 5V/3A. if current lower than 2.5A, device will be unstable in some case.

Hi scorpiochang,

Thank you for your interest.

There is no problem with the power supply. I checked the voltage levels and it's OK.
I think I found the problem. When I write data  to the 7th GPIO pin, the system goes into error and the power LED of the card turned off.

When I use your modified Gpio _Lib_C library,
the code that caused the error is digitalWrite (7, HIGH);

thank you
Reply
#8
Hi promate

i am not sure why high operation frequency of PMU_GPIO0C1 causing PMU abnormal.
i will feedback it to Chip Vendor, and i update gpio_lib_c to prevent this issue temporary.
thank you.

Reply
#9
(05-24-2018, 05:13 AM)scorpiochang Wrote: Hi promate

i am not sure why high operation frequency of PMU_GPIO0C1 causing PMU abnormal.
i will feedback it to Chip Vendor, and i update gpio_lib_c to prevent this issue temporary.
thank you.

Hi scorpiochang,


The system problem has resolved , but my GLCD program still does not work. 
It was working as a very slowly  before the gpio_lib_c was modified.

Thank you
Reply
#10
The Tinkerboard GPIO speed is still very slow. I wonder why this is the case. I would appreciate, if someone share opinion about it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)