-->
Page 1 of 2

Interfacing with DWM1000

PostPosted: Tue Sep 26, 2017 3:51 pm
by werty37
Hi

I am trying to interface ESP8266 WeMos D1 Mini to DWM1000 in Arduino. Has anyone successfully implemented this before?

I am using the Decawave DWM1000 Wayne Breakout Board for this.
https://www.oshpark.com/shared_projects/95789Glk

My Pin connection is as follows:

DWM1000 Breakout Board - ESP8266 WeMos D1 Mini
RST - RST
3.3v - External 3.3v LM2596 1A
GND - GND
IRQ - D1 (330 Ohm in parallel to ground)
CLK - D5
MISO - D6
MOSI - D7
CS - D8

I am trying to interface the DWM1000 using SPI. Here is the code (arduino-dw1000 by thotro)
https://github.com/thotro/arduino-dw100 ... tyTest.ino

Here is the error message i am getting:

Code: Select allets Jan  8 2013,rst cause:2, boot mode:(7,6)

waiting for host


Any pointers please?

Thanks
S

Re: Interfacing with DWM1000

PostPosted: Tue Sep 26, 2017 4:38 pm
by QuickFix
Have you correctly set the board to "Tools" -> "Board: " - "WeMos D1" in Arduino before flashing?
It looks like you're looking at some (old) firmware output.

You should see a debug log like:
Code: Select allDW1000 initialized ...
Committed configuration ...
(Don't forget to set the speed of the monitor to 9600 Baud) :idea:

Re: Interfacing with DWM1000

PostPosted: Tue Sep 26, 2017 6:12 pm
by werty37
Hi

Yes i do. These are the settings.

Board: WeMos D1 R2 & mini
Flash size: 4M (3M SPIFFS)
CPU Frequency: 80 Mhz
Upload Speed: 921600
Port: /dev/cu.wchusbserial1410

I have been able to flash code to WeMos with these settings. I tested the blink example and it works fine.
This is the arduino-dw1000 code which i am trying to flash:

Code: Select all/*
 * Copyright (c) 2015 by Thomas Trojer <thomas@trojer.net>
 * Decawave DW1000 library for arduino.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @file BasicConnectivityTest.ino
 * Use this to test connectivity with your DW1000 from Arduino.
 * It performs an arbitrary setup of the chip and prints some information.
 *
 * @todo
 *  - move strings to flash (less RAM consumption)
 *  - make real check of connection (e.g. change some values on DW1000 and verify)
 */

#include <SPI.h>
#include <DW1000.h>

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

void setup() {
  // DEBUG monitoring
  Serial.begin(9600);
  // initialize the driver
  DW1000.begin(PIN_IRQ, PIN_RST);
  DW1000.select(PIN_SS);
  Serial.println(F("DW1000 initialized ..."));
  // general configuration
  DW1000.newConfiguration();
  DW1000.setDeviceAddress(5);
  DW1000.setNetworkId(10);
  DW1000.commitConfiguration();
  Serial.println(F("Committed configuration ..."));
  // wait a bit
  delay(1000);
}

void loop() {
  // DEBUG chip info and registers pretty printed
  char msg[128];
  DW1000.getPrintableDeviceIdentifier(msg);
  Serial.print("Device ID: "); Serial.println(msg);
  DW1000.getPrintableExtendedUniqueIdentifier(msg);
  Serial.print("Unique ID: "); Serial.println(msg);
  DW1000.getPrintableNetworkIdAndShortAddress(msg);
  Serial.print("Network ID & Device Address: "); Serial.println(msg);
  DW1000.getPrintableDeviceMode(msg);
  Serial.print("Device mode: "); Serial.println(msg);
  delay(10000); // wait a bit
}


Thanks
S

Re: Interfacing with DWM1000

PostPosted: Wed Sep 27, 2017 4:27 am
by gdsports
There are discrepancies between the hardware hook up and source code.

1) RST to RST means to me that software cannot control RST. It is all hardware control. Therefore, I would not define and pass PIN_RST. Also GPIO09 is not usable. If you want software control over DWM1000 reset, connect the DWM1000 RST to a different pin.

2) IRQ - D1 does not match PIN_IRQ=2. Wemos/NodeMCU pin D1 is GPIO05. I would change PIN_IRQ=5.

3) The hardware connection to D8/GPIO15 is correct but I would check to make sure SS is really equal to 15.

Code: Select allDWM1000 Breakout Board - ESP8266 WeMos D1 Mini
RST - RST
3.3v - External 3.3v LM2596 1A
GND - GND
IRQ - D1 (330 Ohm in parallel to ground)
CLK - D5
MISO - D6
MOSI - D7
CS - D8

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

  DW1000.begin(PIN_IRQ, PIN_RST);
  DW1000.select(PIN_SS);