Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to include latest nordic sdk and ARM support #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tato123
Copy link

@tato123 tato123 commented May 25, 2014

This modifies the Adafruit nrf8001 driver code as well as minor modifications to the Adafruit Bluetooth UART service code.

Modifications include receiving boolean status of whether a byte or buffer was actually sent (original code assumed that if no exception was thrown then write was succesful).

Includes nordic sdk message queue for reads and writes (can probably remove articial 35 ms delay).

Support for Teensy and non-avr hardware.

Supports Teensy3 as well as arduino and chipkit
@microbuilder
Copy link
Contributor

Sorry for the delay testing this. When I try to build the callbackEcho demo on a canned Uno this doesn't compiled as-is. What platform(s) did you use testing this?

@tato123
Copy link
Author

tato123 commented Jun 5, 2014

I've been testing on a teensy 3.1 using arduino IDE 1.0.5 with teensyduino support version 1.18. The new nordic sdk included several preprocessor commands for AVR, PIC32MX, and I added arm support. (sorry got half way through my response and realized the problem isn't in there but figured it was worth mentioning.)

If you are seeing the __c problem then here's what I realize fixes it:

So I switched to an Arduino UNO board in the arduino IDE and did a verify and the problem is around the F() macro, it's an issue with storing the strings in flash memory. For some reason it's not finding the PSTR macro used by F() even though it should be defined in

<avr/pgmspace.h>

I validated that I could fix the problem just a moment ago by adding the following at the top of the Adafruit_BLE_UART.cpp file and it compiled

#include <SPI.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <stdlib.h>
#include <lib_aci.h>
#include <aci_setup.h>
#include "uart/services.h"
#include "uart/uart_over_ble.h"

#include "Adafruit_BLE_UART.h"

#if defined __AVR__
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
#endif

@microbuilder
Copy link
Contributor

Give me a bit of time to properly test this out and if everything it OK I'll be happy to merge the changes in, but I need to kick the tires in since there are a lot of changes here. Thanks for the pull request, though.

@tdicola
Copy link
Contributor

tdicola commented Aug 4, 2014

Was just taking a look and pulled the change in to a separate branch so I could apply the fix for PSTR above: https://github.com/adafruit/Adafruit_nRF8001/tree/arm_sdk Also added a few small changes to default debug mode to false since there's a lot of debug output, and put any Serial prints behind the same debug mode check.

I tried the code on an Uno/Nano (ATmega328p) and unfortunately it doesn't send or receive any data. I can connect with an iphone, but when data is sent from either device it doesn't show up. For example if I send a string from the Arduino I see the debug output saying that the bytes are being written, but the iPhone unfortunately doesn't receive the message. Likewise for sending from the iphone--it appears to send from the nRF client, but doesn't show up on the Arduino.

Probably need to do more investigation to see what's the issue, perhaps the ARM support changes could be pulled out separately from the new SDK changes to see if the problem is with one of those? Also curious if anyone else with an uno can grab the branch above and check if they also see problems sending/receiving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants