Bluefruit Le Uart Friend and Arduino

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Bluefruit Le Uart Friend and Arduino

Post by ktownsend »

The modules don't ship with the latest firmware installed. You need to update to the latest version using the Bluefruit LE Connect app. Let me know if the DFU Factory Reset works as well? Thanks.

User avatar
dina91
 
Posts: 18
Joined: Tue Feb 28, 2017 1:01 am

Re: Bluefruit Le Uart Friend and Arduino

Post by dina91 »

I checked it and it is updated to the recent update. Still didn't work. It couldn't do a factory reset or at command.
This is the error I got from atcommand.

C:\Program Files (x86)\Arduino\libraries\AdafruitBluefruitLEnRF51master\Adafruit_BLE.cpp: In member function 'int Adafruit_BLE::readBLEUart(uint8_t*, int)':
C:\Program Files (x86)\Arduino\libraries\AdafruitBluefruitLEnRF51master\Adafruit_BLE.cpp:543: error: invalid conversion from 'uint8_t*' to 'char*'
C:\Program Files (x86)\Arduino\libraries\AdafruitBluefruitLEnRF51master\Adafruit_BLE.cpp:543: error: initializing argument 1 of 'size_t Stream::readBytes(char*, size_t)'

I have a project demo this week and I want to get this working. It looks like this Bluetooth is not working. Can you send me another one asap?

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Bluefruit Le Uart Friend and Arduino

Post by ktownsend »

Can you please post the results of the ATI command? It's hard to help without providing the information we need to understand what's happening. Thanks!

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Bluefruit Le Uart Friend and Arduino

Post by ktownsend »

Those errors have nothing to do with the HW, BTW, they appear to be a SW config issue and some sort of conflict with the setup on your Arduino IDE or board selection.

Have you tried updating the library to the latest version? https://learn.adafruit.com/introducing- ... d/software

It can't be a HW issue since it's failing at the compilation stage, which is completely independent of anything with the HW, but again, seeing the actual ATI command response will help understand what is happening here.

Sorry to keep insisting on this, but it's important or we don't have the information we need to help you here.

What version of the Arduino IDE are you using as well? Make sure you are running a recent version.

User avatar
dina91
 
Posts: 18
Joined: Tue Feb 28, 2017 1:01 am

Re: Bluefruit Le Uart Friend and Arduino

Post by dina91 »

I have the libraries and Arduino IDE to the most updated version.
How do I perform the ATI command? I don't find a sketch example. All I find is this link but I don't know how to preform this.

https://learn.adafruit.com/introducing- ... tandard-at

User avatar
dina91
 
Posts: 18
Joined: Tue Feb 28, 2017 1:01 am

Re: Bluefruit Le Uart Friend and Arduino

Post by dina91 »

Please let me know asap. I have a project demo on Tuesday and I want to get this working. I am trying to use the bluefruit app uart so I can transfer the data by using data mode and command mode and I am still facing the same problem.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Bluefruit Le Uart Friend and Arduino

Post by ktownsend »

You can connect something like an FTDI cable to the UART pins on the board, open a terminal emulator at 9600 baud with HW flow control enabled (CTS + RTS), and then just type the 'ATI' command.

Alternatively, you can simply power the UART board up, and it should start blinking with the red light meaning that it is advertising. You can then use our Bluefruit LE Connect app for either iOS or Android, and then connect to your device and go to the 'Information' part of the app where every service and characteristic on the device is listed. If you post a screenshot of the contents of the Device Information Service values, that is the same information as the ATI command.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Bluefruit Le Uart Friend and Arduino

Post by ktownsend »

Information on wiring up an FTDI cable is available in the learning guide here: https://learn.adafruit.com/introducing- ... ftdi-cable

Links to the Bluefruit LE Connect apps are available here: https://learn.adafruit.com/introducing- ... -resources

I believe you have the wrong setup in the Arduino IDE based on the errors you are getting, though. Perhaps try completely reinstalling the Arduino IDE and the Bluefruit BSP, as described here: https://learn.adafruit.com/introducing- ... d/software

From there, make sure that you have the right development board selected (ex. Tools > Board > Arduino Uno).

You should be able to compile any Bluefruit demo code at that point, and it's not obvious to me at all why you are getting the errors you are at build time except having an incorrect board selected (???). This doesn't appear to be a HW issue since compilation is completely independent of the HW itself.

If this is a school project, is there any assistance available locally to help you with the initial setup, since the problem seems to be there? Sorry I can't be more precise, but in the many thousands of theses boards we've sold this is the first time I've seen this issue.

User avatar
dina91
 
Posts: 18
Joined: Tue Feb 28, 2017 1:01 am

Re: Bluefruit Le Uart Friend and Arduino

Post by dina91 »

I did uninstall ardunio and re-install again as well as the adafruit libraries im usibg Mega, so i made sure the connected board Mega. I also attached the picture of the AtI command. Still not working.
Attachments
IMG_4428.PNG
IMG_4428.PNG (73.82 KiB) Viewed 816 times

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Bluefruit Le Uart Friend and Arduino

Post by ktownsend »

The HW is clearly functioning correctly, so it's purely a config issue.

I justed tested using Arduino IDE 1.8.1 on OS X, selecting Tools > Board > Arduino/Genuino Mega or Mega 2560', using the 'Factory Reset' sketch, and it compiles perfectly here:

Code: Select all

Sketch uses 6982 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 450 bytes (5%) of dynamic memory, leaving 7742 bytes for local variables. Maximum is 8192 bytes.
I'll check if anyone else has any ideas why your specific setup if failing, but I truly don't have any idea at this point, but I'm 99.9% sure this is purely a local config issue and not the HW itself. :/

User avatar
dina91
 
Posts: 18
Joined: Tue Feb 28, 2017 1:01 am

Re: Bluefruit Le Uart Friend and Arduino

Post by dina91 »

This is the code for blufruitconfig.h

Code: Select all

// COMMON SETTINGS
// ----------------------------------------------------------------------------------------------
// These settings are used in both SW UART, HW UART and SPI mode
// ----------------------------------------------------------------------------------------------
#define BUFSIZE                        160   // Size of the read buffer for incoming data
#define VERBOSE_MODE                   true  // If set to 'true' enables debug output


// SOFTWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins that will be used for 'SW' serial.
// You should use this option if you are connecting the UART Friend to an UNO
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SWUART_RXD_PIN       9    // Required for software serial!
#define BLUEFRUIT_SWUART_TXD_PIN       10   // Required for software serial!
#define BLUEFRUIT_UART_CTS_PIN         11   // Required for software serial!
#define BLUEFRUIT_UART_RTS_PIN         8   // Optional, set to -1 if unused


// HARDWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the HW serial port you are using. Uncomment
// this line if you are connecting the BLE to Leonardo/Micro or Flora
// ----------------------------------------------------------------------------------------------
#ifdef Serial1    // this makes it not complain on compilation if there's no Serial1
  #define BLUEFRUIT_HWSERIAL_NAME      Serial1
#endif


// SHARED UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following sets the optional Mode pin, its recommended but not required
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_UART_MODE_PIN        12    // Set to -1 if unused


// SHARED SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for HW and SW SPI communication.
// SCK, MISO and MOSI should be connected to the HW SPI pins on the Uno when
// using HW SPI.  This should be used with nRF51822 based Bluefruit LE modules
// that use SPI (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_CS               8
#define BLUEFRUIT_SPI_IRQ              7
#define BLUEFRUIT_SPI_RST              4    // Optional but recommended, set to -1 if unused

// SOFTWARE SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for SW SPI communication.
// This should be used with nRF51822 based Bluefruit LE modules that use SPI
// (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_SCK              13
#define BLUEFRUIT_SPI_MISO             12
#define BLUEFRUIT_SPI_MOSI             11
Is there any thing I need to change for atcommand code with Mega board?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Bluefruit Le Uart Friend and Arduino

Post by adafruit_support_rick »

You're on a Mac? You can try deleting the Arduino15 folder.
First, close the Arduino application, and move it to the Trash.
Then, in Finder, open the 'Go' menu, and select 'Go to Folder...'
In the box, type ~/Library. That will open a new finder window to the Library folder.
In the Library folder, you'll see a folder called 'Arduino15'. Move that folder to the trash.
Now download and re-install the Arduino application. See if your compile issues have gone away.

User avatar
dina91
 
Posts: 18
Joined: Tue Feb 28, 2017 1:01 am

Re: Bluefruit Le Uart Friend and Arduino

Post by dina91 »

I use Windows 7 not mac.There is no file called Arduino15.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Bluefruit Le Uart Friend and Arduino

Post by adafruit_support_mike »

The Arduino IDE has a folder named Arduino15 on all platforms. On Windows, it should be located at C:\Users\(username)\AppData\Local\Arduino15

Delete that folder, reinstall the board support packages, and see if that helps.

User avatar
dina91
 
Posts: 18
Joined: Tue Feb 28, 2017 1:01 am

Re: Bluefruit Le Uart Friend and Arduino

Post by dina91 »

Still, I don' t see anything called Appdata. I also searched in the menu search for Appdata or Arduino 15, nothing pop up. I want to clarify that my Arduino IDE is running okay with the code I am using. But when I upload it with Blurfruit Uart Friend, the error appear.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”