Hallo, ich versuche verzweifelt ein Programm zu kompilieren auf Basis vom Pigpio C Interface http://abyz.co.uk/rpi/pigpio/cif.html und Beispiel http://abyz.co.uk/rpi/pigpio/cif.html#bbSPIOpen siehe auch unten. Ich kriege aber immer folgende Errors: pi@raspberrypi:~ $ gcc -Wall -pthread -o bbSPIx_test bbSPIx_test.c -lpigpio /tmp/ccQ7bgsH.o: In function `main': bbSPIx_test.c:(.text+0x9c): undefined reference to `bbSPIOpen' bbSPIx_test.c:(.text+0xc0): undefined reference to `bbSPIOpen' bbSPIx_test.c:(.text+0xf4): undefined reference to `bbSPIXfer' bbSPIx_test.c:(.text+0x120): undefined reference to `bbSPIXfer' bbSPIx_test.c:(.text+0x154): undefined reference to `bbSPIXfer' bbSPIx_test.c:(.text+0x1ac): undefined reference to `bbSPIClose' bbSPIx_test.c:(.text+0x1b4): undefined reference to `bbSPIClose' collect2: error: ld returned 1 exit status Die Hardware SPI (spiXfer..) funktioniert einwandfrei auf meinem Raspberry pi 3 mit jessie. Wieso gehen die bit banged SPI Funktionen nicht? Example // gcc -Wall -pthread -o bbSPIx_test bbSPIx_test.c -lpigpio // sudo ./bbSPIx_test #include <stdio.h> #include "pigpio.h" #define CE0 5 #define CE1 6 #define MISO 13 #define MOSI 19 #define SCLK 12 int main(int argc, char *argv[]) { int i, count, set_val, read_val; unsigned char inBuf[3]; char cmd1[] = {0, 0}; char cmd2[] = {12, 0}; char cmd3[] = {1, 128, 0}; if (gpioInitialise() < 0) { fprintf(stderr, "pigpio initialisation failed.\n"); return 1; } bbSPIOpen(CE0, MISO, MOSI, SCLK, 10000, 0); // MCP4251 DAC bbSPIOpen(CE1, MISO, MOSI, SCLK, 20000, 3); // MCP3008 ADC for (i=0; i<256; i++) { cmd1[1] = i; count = bbSPIXfer(CE0, cmd1, (char *)inBuf, 2); // > DAC if (count == 2) { count = bbSPIXfer(CE0, cmd2, (char *)inBuf, 2); // < DAC if (count == 2) { set_val = inBuf[1]; count = bbSPIXfer(CE1, cmd3, (char *)inBuf, 3); // < ADC if (count == 3) { read_val = ((inBuf[1]&3)<<8) | inBuf[2]; printf("%d %d\n", set_val, read_val); } } } } bbSPIClose(CE0); bbSPIClose(CE1); gpioTerminate(); return 0; }
frag einfach Joan im Raspberryforum, sobald pigpio im Text vorkommt meldet die sich zu Wort
Beitrag #5049703 wurde von einem Moderator gelöscht.
Christoph K. schrieb: > frag einfach Joan im Raspberryforum, sobald pigpio im Text > vorkommt > meldet die sich zu Wort tatsächlich, hyperschnell - habe eine Email gemacht, hier die Antwort: The most likely explanation is 1. You have an old version of pigpio 2. You have an old version of the pigpio library in your path. See http://abyz.co.uk/rpi/pigpio/faq.html#Library_update_fails and in particular "However the wrong libraries may be linked during the compilation. If this is the case remove the /usr/lib entries for libpigpio.so , libpigpiod_if.so, and libpigpiod_if2.so". Ich habe neues Image genommen, pigpio installiert und voilà es geht :-)) Danke viel mal!!!
Ja die geheimnisvolle Joan... http://www.rpitips.com/python-libraries-pigpio/ "I don’t know much about the author beside that he or she uses a nickname joan and is very active on the Raspberry Pi forum and on the stackexchange.com. It’s a very mysterious person."
:
Bearbeitet durch User
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.