Arduino Nano 33 BLE SPI Comunikation.

OP #7296617
Lesenswert?

Hallo,

ich habe ein Problem und bin mir nicht sicher, wie ich das lösen kann.

Ich verwende Arduino NANO 33 BLE und möchte eine SPI Kommunikation zu 
einem DW1000 UWB Modul aufbauen und auch die Bibliothek DW1000 nutzen.
Jedoch bin ich mir nicht sicher, wie ich dies hinbekomme.
Da der Arduino NANO 33 BLE eine Frequenz von 16MHz hat, müsste die 
Kommunikation funktionieren.

Mein CODE wäre:
```
#include <SPI.h>
#include "DW1000Ranging.h"

// connection pins
const uint8_t PIN_RST = D4; // reset pin
const uint8_t PIN_IRQ = D8; // irq pin
const uint8_t PIN_SS = SS;   // spi select pin

void setup()
{
    Serial.begin(115200);
    delay(1000);
    //init the configuration
    SPI.begin();
    DW1000Ranging.initCommunication(PIN_RST, PIN_SS, PIN_IRQ); //Reset, 
CS, IRQ pin
    //define the sketch as anchor. It will be great to dynamically 
change the type of module
    DW1000Ranging.attachNewRange(newRange);
    DW1000Ranging.attachNewDevice(newDevice);
    DW1000Ranging.attachInactiveDevice(inactiveDevice);
    //Enable the filter to smooth the distance
    //DW1000Ranging.useRangeFilter(true);

    //we start the module as a tag
    DW1000Ranging.startAsTag("7D:00:22:EA:82:60:3B:9C", 
DW1000.MODE_LONGDATA_RANGE_LOWPOWER);
}

void loop()
{
    DW1000Ranging.loop();
}

void newRange()
{
    Serial.print("from: ");
    Serial.print(DW1000Ranging.getDistantDevice()->getShortAddress(), 
HEX);
    Serial.print("\t Range: ");
    Serial.print(DW1000Ranging.getDistantDevice()->getRange());
    Serial.print(" m");
    Serial.print("\t RX power: ");
    Serial.print(DW1000Ranging.getDistantDevice()->getRXPower());
    Serial.println(" dBm");
}

void newDevice(DW1000Device *device)
{
    Serial.print("ranging init; 1 device added ! -> ");
    Serial.print(" short:");
    Serial.println(device->getShortAddress(), HEX);
}

void inactiveDevice(DW1000Device *device)
{
    Serial.print("delete inactive device: ");
    Serial.println(device->getShortAddress(), HEX);
}
```

kann mir jemand einen Tip geben.
Gast #7296649
Lesenswert?

Wolei schrieb:
> kann mir jemand einen Tip geben.

Wofür denn bzw. was wäre denn deine Frage.

Wolei schrieb:
> Da der Arduino NANO 33 BLE eine Frequenz von 16MHz hat

Welche Frequenz denn? Der Controller selbst hat jedenfalls 64 MHz.

Wenn du Probleme hast dann beschreibe was du machst, was du an
Ergebnis bekommst und wie das erhaltene Ergebnis von dem abweicht
was du erwartest. Einen Schaltplan zu liefern wäre auch hilfreich.

Siehe auch netiquette
Gast #7296684
Lesenswert?

Wolei schrieb:
> Mein CODE wäre:

... schlecht da du nicht die Hinweise zum Posten von Code beachtest.
Dein Code ist grenzwertig lang/kurz sodass er eigentlich als Anhang
gepostet gehört. Codeschnipsel gehören mit [c]-Tags eingeklammert
wie es beim Posten von Beiträgen beschrieben ist.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren