Pigpio在启动时失败,在程序重新启动中工作

发布于 2025-01-29 05:39:13 字数 854 浏览 4 评论 0原文

我正在使用Pigpiod_if2.h来读取运行BuildRoot发行版的Raspberry Pi 4b上的屏蔽版本,因为我需要同时与GPIO进行多个C程序 - 初始化使用PigPio_Start,但在启动时返回错误代码-2003。

initGPIO = pigpio_start(NULL, NULL); // Initialise pigpio
    if (initGPIO >= 0) {
        printf("Initialised GPIO for HWConfig [pigpio]\n"); 
    } 
    else { 
        printf("Failed to initialise GPIO for HWConfig [pigpio]\n");
        printf("PIGPIO error code: %d\n", initGPIO);
    }

根据文档(从我能告诉的)-2000以某种方式指的是Pigpiod标头,尽管没有细节:

#define PI_PIGIF_ERR_0       -2000

-3是指不正确的GPIO PIN数字:

#define PI_BAD_GPIO          -3 // GPIO not 0-53

但是,我认为此错误可能是红色的鲱鱼,当重新启动过程(不重新启动机器)时,它可以完美地工作,并通过成功的实例化消息和硬件读取的正确版本。

我非常感谢故障排除帮助尝试确定此问题的根本原因。到目前为止,我已经包含了一个脚本,该脚本检查Pigpio是否在此程序之前运行(是),除了Pigpio守护程序检查外,还删除了此程序之前对Pigpio的所有引用。

谢谢你, h

I am using pigpiod_if2.h to read the version of a shield on a Raspberry Pi 4B running a Buildroot distro as I need to have multiple C programs interacting with GPIO simultaneously -- the initialization uses pigpio_start, but returns error code -2003 on startup.

initGPIO = pigpio_start(NULL, NULL); // Initialise pigpio
    if (initGPIO >= 0) {
        printf("Initialised GPIO for HWConfig [pigpio]\n"); 
    } 
    else { 
        printf("Failed to initialise GPIO for HWConfig [pigpio]\n");
        printf("PIGPIO error code: %d\n", initGPIO);
    }

According to the documentation (from what I can tell) -2000 refers to the pigpiod header in some way, though there is no detail:

#define PI_PIGIF_ERR_0       -2000

And -3 refers to incorrect GPIO pin numbers:

#define PI_BAD_GPIO          -3 // GPIO not 0-53

However, I think this error may be a red herring, as when the process is relaunched (without rebooting the machine) it works perfectly, with a successful instantiation message and the correct version of the hardware read.

I would greatly appreciate troubleshooting help to try and identify the root cause of this issue. I have so far included a script that checks if pigpio is running before this program (it is), and removed all references to pigpio before this program, apart from the pigpio daemon check.

Thank you,
H

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦行七里 2025-02-05 05:39:13

事实证明,这个问题与Pigpio初始化的放置有关。我正在我的BuildRoot Init.d/etc boot Directory中初始使用脚本编号S30-S39的必要外围设备。将脚本编号移至S60-S69解决了问题(HWCONFIG和其他外部。按预期工作)。

虽然我仍然不清楚导致失败的原因,但我的工作理论是,在启动序列中的那一刻尚未初始化所需的驱动程序(例如我从Pigpio使用的SPI代码,这是从在上方显示随机字符OLED到预期的功能)。

It turns out this issue is related to placement of the PIGPIO initialisation within the boot sequence. I was initialising the requisite peripherals with script numbers S30-S39 in my Buildroot init.d/etc boot directory. Moving the script numbers to S60-S69 fixed the issue (HWConfig and other periphs. working as expected).

While it is still unclear to me exactly what caused the failure, my working theory is that required drivers had not been initialised at that point in the boot sequence (such as the SPI code I was using from PIGPIO, which went from displaying random characters on an OLED to functioning as expected).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文