On Sun, 14 Mar 2021 04:08:20 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Vivek Yadav
<[email protected]> wrote:
>I have set the direction of these 2 pins after going under
>/sys/class/gpio/gpioxx/direction as OUT and IN as per requirements.
>But I am not able to get data from HX711. So I debug and Find out that I am
>taking one time than required. Typically my SCK pin must remain high1-2
>mico Seconds but I am taking 5-6 mico Seconds. Which is not desirable. *All
>this Code is in C language.*
>
The first thing to understand is that the BBB is not a microcontroller
with deterministic timing (the PRU modules, however, ARE microcontrollers).
The documentation for that chip assumes a microcontroller.
You are going through the LINUX file system to access kernel modules
for GPIO. LINUX is not real-time. Essentually, each time you issue a set
(write) or read of a GPIO, your process is suspended, while the OS
schedules your I/O. If there are other processes suspended, of equal
priority, one of them may be woken up next.
The actual read-back of a sample is close to the SPI protocol, but the
odd timings needed for configuring the chip are not...
>Now I need Your suggestions that How can I speed up my GPIO pin reading and
>Writing Time.
>
Avoid the sysfs calls if possible (you don't show your code so it is
difficult to make suggestions). Write a driver using the PRU, and an
interface to the application running on Linux (remoteproc/rpmsg).
>I have seen some example where writers trying to Show the GPIO
>configuration. using mmap(). But no one talking about the GPIO speed.
>
mmap() is bypassing the sysfs kernel calls by running as a privileged
process with direct access to the processor registers controlling GPIO.
--
Dennis L Bieber
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/51j15gp5gv1490cvi22pv4cnso66vmk70a%404ax.com.