Moin, ich bin hier in der Hoffnung das schon jemand mal einen Kommunikation mit dem LMP92064 aufgebaut hat. Ich komme einfach nicht dahinter, wie eine Kommunikation aussehen kann. Wenn ich dem LMP92064 eine Anfrage stelle, z.B. einen Anfrage für ChipID (Darauf müsste ich mir ja mit einer definierten Antwort antworten) bekomme ich immer noch 255 zurück ... und das wars. Jetzt hoffe ich auf Codebeispiele oder ähnliches in C? Danke schonmal
:
Verschoben durch Admin
auf den Code müsste er mir doch eigentlich eine default Antwort geben und zwar 0x18. Ich bekomme allerdings 0xFF
1 | #include <bcm2835.h> |
2 | #include <stdio.h> |
3 | int main(int argc, char **argv) |
4 | {
|
5 | // If you call this, it will not actually access the GPIO
|
6 | // Use for testing
|
7 | // bcm2835_set_debug(1);
|
8 | |
9 | if (!bcm2835_init()) |
10 | return 1; |
11 | |
12 | bcm2835_spi_begin(); |
13 | bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST); // The default |
14 | bcm2835_spi_setDataMode(BCM2835_SPI_MODE0); // The default |
15 | bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_65536); // The default |
16 | bcm2835_spi_chipSelect(BCM2835_SPI_CS0); // The default |
17 | bcm2835_spi_setChipSelectPolarity(BCM2835_SPI_CS0, LOW); // the default |
18 | |
19 | |
20 | char buf[] = { 0x80, 0x00}; // Data to send |
21 | bcm2835_spi_transfern(buf, sizeof(buf)); |
22 | // buf will now be filled with the data that was read from the slave
|
23 | printf("Read from SPI: %02X %02X \n", buf[0], buf[1]); |
24 | |
25 | bcm2835_spi_end(); |
26 | bcm2835_close(); |
27 | return 0; |
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.