gpiod | native Go library for accessing GPIO lines
kandi X-RAY | gpiod Summary
kandi X-RAY | gpiod Summary
A native Go library for Linux GPIO. gpiod is a library for accessing GPIO pins/lines on Linux platforms using the GPIO character device. The goal of this library is to provide the Go equivalent of the C libgpiod library. The intent is not to mirror the libgpiod API but to provide the equivalent functionality. :warning: v0.6.0 introduces a few API breaking changes. Refer to the release notes if updating from an older version.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gpiod
gpiod Key Features
gpiod Examples and Code Snippets
Community Discussions
Trending Discussions on gpiod
QUESTION
I am working on STM32F4 and I noticed some strange behaviors with Timers.
I need three timer : the first one must generate an interrupt every 1ms (I chose TIMER 1, an advanced control timer), the second one must generate an interrupt every 10ms (TIMER2, general purpose interrupt) and the third one must have its CNT counter incremented every 1µs (so interrupt is generated every 65.535 ms, as I am using TIMER 3 for this one and CNT is 16 bits).
In order to compute PSC (prescaler) and ARR (period) values, I used this thread. So the formula I am using is (for a period in ms):
...ANSWER
Answered 2021-Oct-15 at 09:45Timer1 is the advanced timer and timer2 & 3 are general purpose timer. Timer1 is from APB2 and timer 2,3 from APB1. You can check reference book or check your clock setting to see more details.
QUESTION
I'm conducting a preliminary study for a new project. I've purchased a Raspberry Pi 3B and I'm trying to run a small program to check all our requisites:
- SQL Server connection.
- Save configuration files on disk.
- Configure and use some DI/DO in Raspberry GPIO.
By now I've installed Mono libraries on it and I'm using Visual Studio 2019 in my windows machine to build a WinForms application.
...ANSWER
Answered 2021-Aug-11 at 12:39WinForms is only designed to run on Windows. It may work with Mono, but you would probably want to compile it on a Windows machine. It seems that Mono is, as of now, supporting up to .NET Framework 4.7 — so this is probably where the message comes from.
If you don't want to compile on Windows, try targeting 4.7 or use dotnet core and write a command line app to test your backend requirements.
QUESTION
I'm a beginner when it comes to using STM chips, and I have a project where I have to use all three USART terminals in Uvision.
I am using an STM32F103RB chip, and I already got the first two USART_init functions working, but I can't get the third one to work for some reason. I would really appreciate any help Here are my USART_init functions:
...ANSWER
Answered 2021-May-31 at 07:34Your first line for the USART3 initialization is wrong :-)
RCC->APB2ENR |= 1; // enable clock for AF
must be (without a clock the USART doesn't work)
RCC->APB1ENR |= (1<<18); // enable clock for USART
And as an additional hint, do not use all these magic numbers for the bits. This is much more readable (and the needed defines are already done in the CMSIS:
RCC->APB1ENR |= RCC_APB1ENR_USART3EN; // enable clock for USART
QUESTION
I am working on a project that will require timer interrupts.
Using STM32cubeIDE, I generated code that should work with timer-interrupts. Here is a truncation of what my main.cpp looks like: (htim1
is a global handle)
ANSWER
Answered 2021-Mar-22 at 23:38I would never use HAL library to set up the timers. It makes no sense for me. In the example below I will omit clock (in my case 168MHz) & GPIO settings. As you did not state what model of STM32F4 you use, this code was tested using STM32F446RET uC. Other STM32F4 have identical timers.
- Setting the timer:
QUESTION
Good afternoon,
I am a newbie in the programing of stm32. Just working on a project, where is a serious problem with timing. Trying to implement FOC on the PMSM motor where I need to do a calculation in 50us loop, which is fast to communicate with angle sensor via SPI and HAL. Let me explain the situation.
I tried to work with HAL, but as I read everywhere and explored by myself: if you need speed put it away. So my plan is to use CubeMX to configure all necessary registers and read data directly from the register DR. One small thing, that sensor communicates with a 16-bit frame.
Code that I produce:
...ANSWER
Answered 2021-Feb-02 at 22:06You have two mistakes:
First, you are reading the data register in the wait loop. You should have an empty loop that does nothing repeatedly until RXNE becomes 1, then read the data.
Second you don't do anything to trigger the clock. In master mode the clock starts when you write data for transmission. After driving the chip-select low, write something to DR:
QUESTION
I am getting the below error 50% of the time during startup on an STM32 based processor (OSD32MP15x).
I've tried over 40 versions configs and setups none work and I am under high pressure to deliver this piece of hardware to a client. To me this looks like some kind of timing issue because it doesn't always happen.
I've tried to disable USB related configs, change DTS files and strip out everything that is not needed and last but not least change power config in the linux config and DTS.
Questions: How can I debug the below? What does this error look like to you?
...ANSWER
Answered 2020-Nov-04 at 18:22It looks like the problem was introduced by the patch: regulator: stpmic1: Usb boost over-current protection workaround.
- The "boost" interrupt handler
stpmic1_boost_irq_handler
callsregulator_lock(usb_data->boost_rdev);
- The "boost" interrupt handler (
stpmic1_boost_irq_handler
) is set up by thestpmic1_boost_register
function, butusb_data->boost_rdev
is still null at this time. usb_data->boost_rdev
is set to the return value of thestpmic1_boost_register
function by thestpmic1_regulator_probe
function.- If the "boost" interrupt handler
stpmic1_boost_irq_handler
gets called beforeusb_data->boost_rdev
has been set by thestpmic1_regulator_probe
function, then the crash occurs.
A workaround would be to set usb_data->boost_rdev = rdev;
in the stpmic1_boost_register
function after it has set rdev
but before it sets up the interrupt handler.
This should be reported to the author of the patch. See the "Signed-off-by:" line in the patch for the email address.
QUESTION
I am currently installing swupdate
but
getting an error while running make command
in swupdate file.
I followed the following steps to first install it -
sudo apt-get install libgpiod-dev
Ran make command in the swupdate file
Even after installing gpiod following error was shown
error
...ANSWER
Answered 2020-Nov-03 at 17:10libgpiod has rather changed its API and the signature of that function. To fix this, you have to set (or unset, it depends on the installed libgpiod) CONFIG_UCFW_OLD_LIBGPIOD in SWUpdate configuration.
QUESTION
Thanks for 0andriy asking the question on mailing list. And Alexandre Courbot aka Gunurou answered my question!
I have to thank 0andriy again! Your are the true hero behind this question.
Old Question:This question seems like typo in documentation, but I want to double check.
My question is the last two paragraphs in the last section of GPIO Descriptor Consumer Interface.
the following two functions allow you to convert a GPIO descriptor into the GPIO integer namespace and vice-versa:
...
ANSWER
Answered 2020-Oct-21 at 16:21All the same, a GPIO number passed to gpio_to_desc() must have been properly acquired, and usage of the returned GPIO descriptor is only possible after the GPIO number has been released.
Shouldn't after be changed to before?
Probably neither of them. I guess that the sentence wants to express not to mix legacy gpio_XXX
and modern gpiod_XXX
APIs. E.g. to release gpio
resources before working with gpiod
ones.
You are right, that using the descriptor after gpio_free()
is wrong.
In practice, the kernel violates the stated sentence itself because nearly every gpio
operation uses gpio_to_desc()
. E.g.
QUESTION
I am trying to enable UART for STM32 Nucleo - F429ZI. I have gone through user manual and it says by default USART 3 can be configured for virtual com port purpose. Here is my code. I can see that USART 3 has pins D8 and D9. Here is my code. What am I doing wrong here, I don't see prints on my com port.
Data sheet refered - https://www.st.com/resource/en/data_brief/nucleo-f429zi.pdf https://www.st.com/resource/en/user_manual/dm00244518-stm32-nucleo-144-boards-stmicroelectronics.pdf
...ANSWER
Answered 2020-Jun-25 at 08:53you forgot to set what AF mode to be used (there are possible 16 AF modes for every pin). At the moment AF registers are set to the 0 and it is wrong. You need to make it 7
.
How can it be archived using the SPL library (depreciated and not supported anymore) I do not know.
Here is the register version
QUESTION
i've been having some issue with my fread function. everything reads nicely but my error checker goes off on the first value of fread and i have absolutely no idea to as why.
if i've rewinded back to the begining of the file, and it prints my value correctly then what failed ?
...ANSWER
Answered 2020-Apr-17 at 08:01You have a number of subtle errors and then are checking the return of fread
against an improper value. In your call to fread
, there is no need to precede Buffer4Can
with the &
(address of) operator. Buffer4Can
is an array, and will be converted to a pointer to the first element on access (see: C11 Standard - 6.3.2.1 Other Operands - Lvalues, arrays, and function designators(p3))
When you take the address of Buffer4Can
you change the pointer type you provide to fread
from uint8_t*
(without the &
) to uint8_t (*)[120000)
(with the &
the type becomes a pointer-to-array-of uint8_t[120000]
). Now by happy coincidence being that Buffer4Can
is an array, both the pointer-to uint8_t
and *pointer-to-array-of uint8_t[120000]
will both resolve to the same address (but are of vastly different types).
Since they resolve to the same address and since fread()
takes a parameter of void*
for its first parameter, the error goes silently unnoticed. (suffice it to say if you attempted fread (&Buffer4Can + 1, ...
things would not work out well...)
The other issue pointed out by @Domenic is your comparison of the fread()
return. The prototype for fread()
is:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gpiod
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page