Ping to CC2540 Host Test App from Arduino?

Hi Arduinoistas!

I am unable to get a response from a CC2540. I would appreciate any assistance. Thanks, in advance.

I am building a new home entertainment system called Votsh Waves (Details at http://www.votsh.com). I have constructed a custom pc board that has an Atmel ATmega256RFR2 and TI BLE CC2540. The CC2540 has the HostTestAPP installed. The pin connections are:

2540 ATmega256RFR2

37 P1_7 TX1 <--> PD3

38 P1_6 RX1 <--> PD2

I wrote a sketch in Arduino IDE as:

#include <Arduino.h> // Arduino main libraries
#include <SPI.h> // Serial Device Interface
#include <Wire.h> // TWI/I2C library for Wiring & Arduino

unsigned long time = 0;
int firsttime = 1;

void setup(){

Serial1.begin( 115200 );

Serial.begin( 115200 );

time = millis();

}

void loop(){

while ( Serial1.available() )
{
Serial.print( "Received " );
byte data0 = Serial1.read();
Serial.print( data0 );
Serial.println( "." );
}

if ( firsttime )
{
firsttime = 0;
Serial.println( "BLE Experiment Started" );
}

// Do this every 1 second
if ( ( time + 2000 ) < millis() )
{
time = millis();

Serial.println("Sending command");
byte buf[] = { 0x01, 0x09, 0x10, 0x00 };
Serial1.write(buf, 4);

}
}

I chose the commands (x01, x09, x10, x00) from notes I found at http://e2e.ti.com/support/wireless_connectivity/f/538/t/206742.aspx. These command bytes should return the board address, according to the forum page.

I download the sketch to the Arduino, open the Serial Monitor and see:

BLE Experiment Started
Sending command
Sending command
Sending command
Sending command

There is no response from the 2540.

Any assistance would be greatly appreciated. Thank you.

-Frank

The above sketch is correct.
The mistake was mine, the crystal for the CC2540 was 16MHz and should have been 32Mhz.

Hello,

Could you please tell us what do you mean?
You went to the build.cfg file of cc2540 and you comment the SET_32KHz_OSC();

as the following : ???

#define HAL_BOARD_INIT()
{
/* Set to 16Mhz to set 32kHz OSC, then back to 32MHz /
START_HSOSC_XOSC();
SET_OSC_TO_HSOSC();
/SET_32KHZ_OSC();/
SET_OSC_TO_XOSC();
STOP_HSOSC();

/
Enable cache prefetch mode. */
PREFETCH_ENABLE();
}

Could you please help us how it worked with cc2540 ?
Thank you,