Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jesse

Pages: [1]
1
Support / Bluetooth out of range detection
« on: January 08, 2015, 06:20:54 PM »
Is there a way to detect if the bluetooth connection has been broken?

For instance, the phone is moved out of range of the RFduino.  Not disconnected purposely.

2
Software / Re: SPI Communication
« on: November 30, 2014, 04:59:24 PM »
Thanks Tolson.  I forgot about that libraries folder.

After moving the library there's still an error message about the RFDuino SPI library.

C:\Program Files (x86)\Arduino\hardware\arduino\RFduino\libraries\SPI\SPI.cpp and SPI.h are not working with the version you uploaded earlier and the original version that came with RFDuino on 11/28/2014.

Screenshot

Code: [Select]
Arduino: 1.5.8 (Windows 7), Board: "RFduino"

In file included from winbondflash.ino:3:0:
C:\Users\Jesse\Documents\Arduino\libraries\winbondflash/winbondflash.h: In constructor 'winbondFlashSPI::winbondFlashSPI()':
C:\Users\Jesse\Documents\Arduino\libraries\winbondflash/winbondflash.h:81:7: error: no matching function for call to 'SPIClass::SPIClass()'
 class winbondFlashSPI: public winbondFlashClass {
       ^
C:\Users\Jesse\Documents\Arduino\libraries\winbondflash/winbondflash.h:81:7: note: candidates are:
In file included from winbondflash.ino:1:0:
C:\Program Files (x86)\Arduino\hardware\arduino\RFduino\libraries\SPI/SPI.h:71:5: note: SPIClass::SPIClass(NRF_SPI_Type*, int, int, int)
     SPIClass(NRF_SPI_Type *_spi, int _pinSCK, int _pinMOSI, int _pinMISO);
     ^
C:\Program Files (x86)\Arduino\hardware\arduino\RFduino\libraries\SPI/SPI.h:71:5: note:   candidate expects 4 arguments, 0 provided
C:\Program Files (x86)\Arduino\hardware\arduino\RFduino\libraries\SPI/SPI.h:69:7: note: SPIClass::SPIClass(const SPIClass&)
 class SPIClass {
       ^
C:\Program Files (x86)\Arduino\hardware\arduino\RFduino\libraries\SPI/SPI.h:69:7: note:   candidate expects 1 argument, 0 provided
winbondflash.ino: At global scope:
winbondflash.ino:5:17: note: synthesized method 'winbondFlashSPI::winbondFlashSPI()' first required here
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

It appears that the "SPIClass spi;" object created by Winbond (winbondflash.h) line 84 is invalid when compared with the constructor.

3
Software / Re: SPI Communication
« on: November 30, 2014, 07:36:58 AM »
I'm having some trouble getting the RFDuino working over SPI with a Winbond memory chip.

Source code: https://code.google.com/p/winbondflash/source/browse/

Data sheet: http://www.buydisplay.com/download/manual/W25Q128FV_Datasheet.pdf

The code compiles for an Uno but not for RFDuino.  Tested with tolson's SPI .cpp and .h files.  Also tested with Arduino 1.5.7-r2 SPI .cpp and .h files.



4
Videos/Guides/Tutorials / Faster analogRead via external ADC
« on: November 28, 2014, 11:27:36 AM »
Fast analogReads using the MCP3201.  Ebay item: http://www.ebay.com/itm/141457779249

Here's a tutorial for getting started (with an Uno): http://www.speedlimit88.com/arduino/spi_adc/



SPI Pins are:
SS/CS -> GPIO6
MOSI -> GPIO5
MISO -> GPIO3
SCK -> GPIO4

Code: [Select]
#include <SPI.h>

const int chipSelectPinADC = 6;
unsigned int result = 0;
byte inByte = 0;

void setup(){
  Serial.begin(921600);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  //SPI.setClockDivider(SPI_CLOCK_DIV2);
  pinMode(chipSelectPinADC, OUTPUT);
  digitalWrite(chipSelectPinADC, HIGH);
}

void loop(){
  digitalWrite(chipSelectPinADC, LOW);
  result = SPI.transfer(0x00);
  result = result << 8;
  inByte = SPI.transfer(0x00);
  result = result | inByte;
  digitalWrite(chipSelectPinADC, HIGH);
  result = result >> 1;
  result = result & 0b0000111111111111;
  //result = map(result,0,4095,0,255);
  Serial.println(result);
  delay(1000);
}



The max speed is around 40,000 reads per second.  The analogRead function tops out at 13,000 reads per second.

5
Getting Started / Serial Baud Rates
« on: November 28, 2014, 11:13:45 AM »
Here's a list of Serial baud rates that work with the RFDuino.

Code: [Select]
1200
2400
4800
9600
14400
19200
28800
31250
38400
57600
76800
115200
230400
250000
460800
921600
1000000

Note that it's different from the Atmega 328p boards: http://i.stack.imgur.com/P8kN2.png

6
Software / Re: SPI Communication
« on: November 28, 2014, 10:59:25 AM »
Is the SPI max data rate on the RFDuino the same as the Arduino Uno?  I'm able to get about 40,000 one byte SPI reads per second on the Uno

Update: It's about the same or faster.

7
Software / Re: SPI Communication
« on: November 17, 2014, 05:28:11 PM »
Nope, with the files you attached it failed to compile.

8
Software / Re: SPI Communication
« on: November 16, 2014, 06:33:44 PM »
Thanks Tolson, it works now.  I copied the contents of /libraries/SD/src/* from Arduino version 1.5.6-r2 to Arduino version 1.5.8.

9
Software / Re: SPI Communication
« on: November 16, 2014, 08:31:05 AM »
The ZIP file I posted was generated from a download of Arduino 1.5.8 from the Arduino web site and RFDuino GitHub package.

Would someone please ZIP your Arduino IDE, upload it somewhere, and post the link?  I want to do a diff against mine to see what's different.

It seems like the RFDuino isn't compatible with the default SD card library.  However, there must be some way to get it working since there is an RFDuino micro SD shield.

10
Software / Re: SPI Communication
« on: November 15, 2014, 01:51:28 PM »
Did you edit the SPI pins in a config file somewhere?

This is a zip file of what I used for testing with 1.5.8 and 2.2: http://www.jbcse.com/downloads/arduino-with-rfduino-windows.zip.

This is the library.properties file:

Code: [Select]
name=SD
version=1.0
author=
email=
sentence=Enables reading and writing on SD cards. For all Arduino boards.
paragraph=Once an SD memory card is connected to the SPI interfare of the Arduino board you are enabled to create files and read/write on them. You can also move through directories on the SD card.
url=http://arduino.cc/en/Reference/SD
architectures=*

The same compile time errors occured from the screenshot.

Code: [Select]
Arduino: 1.5.8 (Windows 7), Board: "RFduino"

C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:27:8: error: 'SPISettings' does not name a type
 static SPISettings settings;
        ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp: In member function 'void Sd2Card::chipSelectHigh()':
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:163:7: error: 'class SPIClass' has no member named 'endTransaction'
   SPI.endTransaction();
       ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp: In member function 'void Sd2Card::chipSelectLow()':
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:169:7: error: 'class SPIClass' has no member named 'beginTransaction'
   SPI.beginTransaction(settings);
       ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:169:24: error: 'settings' was not declared in this scope
   SPI.beginTransaction(settings);
                        ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::init(uint8_t, uint8_t)':
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:261:3: error: 'settings' was not declared in this scope
   settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
   ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:261:53: error: 'SPISettings' was not declared in this scope
   settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
                                                     ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:267:7: error: 'class SPIClass' has no member named 'beginTransaction'
   SPI.beginTransaction(settings);
       ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:271:7: error: 'class SPIClass' has no member named 'endTransaction'
   SPI.endTransaction();
       ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSckRate(uint8_t)':
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:510:14: error: 'settings' was not declared in this scope
     case 0:  settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
              ^
C:\Users\Jesse\Desktop\arduino-1.5.8-windows\arduino-1.5.8\libraries\SD\src\utility\Sd2Card.cpp:510:66: error: 'SPISettings' was not declared in this scope
     case 0:  settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
                                                                  ^
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
[code]


Update

The SPI library included with RFDuino is lacking a class called SPISettings in SPI.h.  The AVR version has it.

11
Software / Re: SPI Communication
« on: November 15, 2014, 12:33:53 PM »
IDE Version: 1.5.7
RFDuino library version: v 2.2 (2014-11-12)

The sketch is in the example: File > Examples > SD > CardInfo

The SD Library appears to be by LadyAda 6/11/2014.

Code: [Select]
/*
  SD card test
   
 This example shows how use the utility libraries on which the'
 SD library is based in order to get info about your SD card.
 Very useful for testing a card when you're not sure whether its working or not.
 
 The circuit:
 * SD card attached to SPI bus as follows:
 ** UNO:  MOSI - pin 11, MISO - pin 12, CLK - pin 13, CS - pin 4 (CS pin can be changed)
  and pin #10 (SS) must be an output
 ** Mega:  MOSI - pin 51, MISO - pin 50, CLK - pin 52, CS - pin 4 (CS pin can be changed)
  and pin #52 (SS) must be an output
 ** Leonardo: Connect to hardware SPI via the ICSP header
  Pin 4 used here for consistency with other Arduino examples

 
 created  28 Mar 2011  by Limor Fried
 modified 9 Apr 2012   by Tom Igoe
 */
 // include the SD library:
#include <SPI.h>
#include <SD.h>

// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;

// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = SS;    //GPIO 6 on RFDuino

void setup()
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.print("\nInitializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
  pinMode(SS, OUTPUT);


  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  while (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
  }
 
  // print the type of card
  Serial.print("\nCard type: ");
  switch(card.type()) {
    case SD_CARD_TYPE_SD1:
      Serial.println("SD1");
      break;
    case SD_CARD_TYPE_SD2:
      Serial.println("SD2");
      break;
    case SD_CARD_TYPE_SDHC:
      Serial.println("SDHC");
      break;
    default:
      Serial.println("Unknown");
  }

  // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    return;
  }


  // print the type and size of the first FAT-type volume
  uint32_t volumesize;
  Serial.print("\nVolume type is FAT");
  Serial.println(volume.fatType(), DEC);
  Serial.println();
 
  volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
  volumesize *= volume.clusterCount();       // we'll have a lot of clusters
  volumesize *= 512;                            // SD card blocks are always 512 bytes
  Serial.print("Volume size (bytes): ");
  Serial.println(volumesize);
  Serial.print("Volume size (Kbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);
  Serial.print("Volume size (Mbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);

 
  Serial.println("\nFiles found on the card (name, date and size in bytes): ");
  root.openRoot(volume);
 
  // list all files in the card with date and size
  root.ls(LS_R | LS_DATE | LS_SIZE);
}


void loop(void) {
 
}

12
Software / Re: SPI Communication
« on: November 15, 2014, 11:56:36 AM »
Using the standard SD library on the CardInfo example sketch fails to compile.

Here are the errors:

The RFDuino has a micro SD shield so it must be possible somehow.


Pages: [1]