0

So Im moving my code to a new pi4 from my old pi4 because i think the old one has some hardware problems. but when i ran my code on the pi 4 two of the functions that i heavily rely on does not work anymore these two functions from the pigpio library

gpioHardwareClock() - So the behaivor is very odd because when i ran gpioHardwareclock() on any of the clock supported pins it does nothing. So i tried starting the hardware clock using a different code and it does turn on so i know its not broken. And when i ran gpioHardwareclock() on a pin that already running a harwareclock it actually turns the clock off.

gpioSetAlertFunc() - As for this one it just simply does not work. It does not capture the state changes

I even went as far as swapping the SD card of both pi to see if im not crazy, both identical code (but on different sd card) was able to output a clock on the old pi, and both sd card is not able to output a clock on the newer pi even though the newer pi is totally capable of outputting a clock. The pigpio library are not throwing errors when executing both of those functions.

Test Code

#include <stdio.h>
#include <pigpio.h>

int main(){

    int error_code;

    error_code = gpioInitialise();
    printf("Initialise: %d\n", error_code);

    error_code = gpioHardwareClock(4,5000000);
    printf("Clock0: %d\n", error_code);

    error_code = gpioHardwareClock(5,5000000);
    printf("Clock1: %d\n", error_code);

    error_code = gpioHardwareClock(6,5000000);
    printf("Clock2: %d\n", error_code);

}

Executed by

$ gcc -o main main.c -lpigpio
$ sudo ./main

Prints

Initialise: 79
Clock0: 0
2021-03-24 04:48:37 gpioHardwareClock: Need password to use clock 1 (5)
Clock1: -99
Clock2: 0

Hardware and versions

old pi 4
$ cat /proc/cpuinfo 
Hardware    : BCM2711
Revision    : c03111
Serial      : 10000000e1b06f41
Model       : Raspberry Pi 4 Model B Rev 1.1

New Pi 4
$ cat /proc/cpuinfo    

Hardware    : BCM2711
Revision    : c03111
Serial      : 100000002b794a51
Model       : Raspberry Pi 4 Model B Rev 1.1


$ uname -a
Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux

$ pigpiod -v
79

I have managed to somehow make clock 0 (GPIO4) to work normally and im not sure what i did. Clock 2 how ever remains not functioning.

enter image description here

heres proof that clock2 does indeed works. The code i used to run clock2 is fairly long so wont post it, but if you need it ill post it here

enter image description here

after running the test code again with clock 2 running, it will turn clock2 off

Initialise: 79
Clock0: 0
2021-03-24 05:07:30 gpioHardwareClock: Need password to use clock 1 (5)
Clock1: -99
Clock2: 0

enter image description here

2
  • Please provide a small but complete code example as a program we can compile and run to see the problem. Please also provide details of the operating system and pigpio versions. – joan Mar 23 at 20:36
  • @joan i have updated the question, please check it out. – Jack Mar 23 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.