Grove - BLE: Problem with AT commands

Hello,
I use the module Grove BLE with Arduino Mega 2560, to communicate with my Android 4.3 phone (Galaxy S3 with HMBLEComAssistant.apk).

The problem is that the name of the BLE module (default: HMSoft) doesn’t change with the command “AT+NAMEnew_name” and I don’t receive feedback from the AT commands sent via serial interface (such as “AT+ADDR?”).
I tried to send commands with and without carriage return.

Any idea?

The code I use:

void setup()
{
  Serial.begin(9600);
  setupBleConnection();
}
 
void loop()
{
  char recvChar;
 
  if(Serial1.available()) {
    recvChar = Serial1.read();
    Serial.print(recvChar);
  }
 
  if(Serial.available()) {
    recvChar  = Serial.read();
    Serial1.print(recvChar);
  }
}
 
void setupBleConnection()
{
  Serial1.begin(9600); //Set BLE BaudRate to default baud rate 9600
  Serial1.println("AT+CLEAR"); //clear all previous setting
  Serial1.println("AT+NAMEnew_name"); //set new name
  Serial1.println("AT+ROLE0"); //set the bluetooth name as a slaver
  Serial1.println("AT+SAVE1");  //don't save the connect information
}

I solved the problem by adding a small delay when sending the AT command (without using the carriage return).

void setup() 
{ 
  Serial.begin(9600);
  setupBleConnection();
  // feedback from BLE: OK+CLEAROK+Set:0OK+Set:new_nameOK+Set:1
} 

void loop() 
{ 
  char recvChar;

  if(Serial1.available()){
    recvChar = Serial1.read();
    Serial.print(recvChar);
  }

  if(Serial.available()){
    recvChar  = Serial.read();
    Serial1.print(recvChar);
  }
}

void setupBleConnection()
{
  Serial1.begin(9600); //Set BLE BaudRate to default baud rate 9600
  delay(1000);

  sendAT("AT+CLEAR"); //clear all previous setting
  sendAT("AT+ROLE0"); //set the bluetooth name as a slaver
  sendAT("AT+NAMEnew_name"); //set new name
  sendAT("AT+SAVE1");  //don't save the connect information

  Serial1.flush();
}

void sendAT(String command)
{
  Serial1.print(command);
  delay(50);
}