Hello !
Trying to enable multiple bluetooth connections, I tried to enable the multplexing in the WT11 (bluetooth) chip.
Now I am screwed ! I can't upload anymore sketches to the board
--> the classical error below raises each time I try to upload something !
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
I still can connect to the board with Bluetooth. I can also connect with the terminal, but it seems the board does not answer !
program loaded:
/*
#include <EEPROM.h>
#include <stdlib.h>
#include <string.h>
#include <avr/sleep.h>
#define LED_PIN 13
#define WAKE_PIN 2
#define RESET 7
void setup(){
pinMode(LED_PIN,OUTPUT);
pinMode(WAKE_PIN, INPUT);
Serial.begin(115200);
// Reset the bluetooth interface
//digitalWrite(RESET, HIGH);
//delay(10);
//digitalWrite(RESET, LOW);
//delay(2000);
//configure the bluetooth module
//Serial.println(SET BT PAGEMODE 3 2000 1);
//Serial.println(SET BT NAME BTSWITCH);
//Serial.println(SET BT ROLE 0 f 7d00);
//Serial.println("SET CONTROL ECHO 0");
//Serial.println(SET BT AUTH * 12345);
Serial.println("SET CONTROL MUX 0");
//Serial.println(SET CONTROL ESCAPE - 00 1);
}
static int ledState = 0;
char buffer[50];
char c;
int waitTime;
void loop(){
// If there is something to read in the serial
if(Serial.available() > 0){
c = Serial.read();
Serial.print("Received ");
Serial.println(c);
processData();
}
if(ledState){
digitalWrite(LED_PIN,HIGH);
}else{
digitalWrite(LED_PIN,LOW);
}
}
void processData(){
switch(c){
case 'i':
{
const char cmd[] = {'S','E', 'T', ' ','C','O','N','T','R','O','L', ' ','M','U','X', ' ','0'};
sendMuxCommand(cmd, '0xFF');
sendMuxCommand(cmd, '0x00');
break;
}
case 'n':
{
const char cmd[] = {'S','E', 'T', ' ','B','T',' ','N','A','M','E', ' ','T','E','S','T'};
sendMuxCommand(cmd, '0xFF');
sendMuxCommand(cmd, '0x00');
break;
}
case 'e':
{
break;
}
case 'f':
{
break;
}
default:
{
break;
}
}
}
void sendMuxCommand(const char cmd[], unsigned char link){
int cmdLen;
for(cmdLen =0; cmd[cmdLen] != 0x00; cmdLen++){
if(cmdLen > 100){
cmdLen = 0;
break;
}
}
//Serial.print("sof ");
Serial.print((unsigned char) 0xBF); //Start of Frame
//Serial.print("link ");
Serial.print((unsigned char) link); //Link id ( 0x00-0x08 pour les connecs (data), control = 0xFF)
//Serial.print("frameflag ");
Serial.print((unsigned char) 0x00); //Frame flags
//Serial.print("length ");
Serial.print((unsigned char) cmdLen); // Data length
int i;
for(i=0;i<cmdLen;i++){
Serial.print((unsigned char) cmd[i]); // data
}
//Serial.println("");
//Serial.print("nLink ");
Serial.print((unsigned char) (link^0xFF)); //nLink
}
any Help would be appreciated ....
PS. I don't have any cable to upload my sketches, only Bluetooth connection ...
Should I buy a AVR ISP mkII programmer ?