Open tato123 opened 10 years ago
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?
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
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.
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.
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.