[solved] Programming Atmel328 SMD over bluetooth

Hello,

I have recently been trying to program an Atmel328 (TQFP) over bluetooth and have run into some problems. I've already loaded the bootloader (optiboot) and it will run arduino sketches with no issue when they are uploaded via ISP. However when I attempt to upload over bluetooth it never syncs correctly. I am currently supplying the reset pulse from the 328 itself using one of the digital pins, an RC filter holds the reset pin low for a few milliseconds and this does successfully reset the 328. I breadboarded this entire setup using the through-hole PDIP version of the 328 and it works fine, I delivered the reset pulse when the serial interrupt triggered and was able to load sketches over bluetooth. However when I switched to the TQFP package (with the exact same circuit layout, just all surface mount) it no longer works! I've attached the schematics for the reset RC filter, the level shifter on the serial line (328 operates on 5V, BT on 3.3V), and the circuit diagram of the bluetooth module. I've also included the sketch I'm using and the waveform generated on the reset pin.

As far as I can tell there are no significant differences between the QFP and PDIP packages electrically and I can't figure out why switching to the QFP would break this. Any help would be greatly appreciated!

Note: the reset filter is a high pass, so I generate a transition from HIGH to LOW on one side to get the spike on the reset pin.

code:

int rxPin = 0;
int resetPin = 4;

void setup() {
  Serial.begin(115200);
  
  pinMode(resetPin, OUTPUT);
  digitalWrite(resetPin, LOW);
}

void loop() {
  
}


void serialEvent(){
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    Serial.print(inChar);
    
    //reset
    if (inChar == 'R') {
      Serial.println("\ngetting ready to reset");
      Serial.end();
      pinMode(resetPin, OUTPUT);
      digitalWrite(resetPin, HIGH);
      pinMode(rxPin,INPUT_PULLUP);
      delay(100);
      while(digitalRead(rxPin));
      delay(10);
      digitalWrite(resetPin,LOW);
    }
    
    
  }
}

I forgot to mention, the bluetooth module's baud rate is set to 115200. This is the same as what is listed in arduino-1.0.4\hardware\arduino\boards.txt for the 328 using optiboot.

MagicBoots:
Hello,

I have recently been trying to program an Atmel328 (TQFP) over bluetooth and have run into some problems. I've already loaded the bootloader (optiboot) and it will run arduino sketches with no issue when they are uploaded via ISP. However when I attempt to upload over bluetooth it never syncs correctly.

Just checking, you are aware of when you upload a sketch via ISP you overwrite the bootloader? Just remember to reload the bootloader afterwards.

hiduino:
Just checking, you are aware of when you upload a sketch via ISP you overwrite the bootloader? Just remember to reload the bootloader afterwards.

O, for the love of... :blush:
Thank you, I can't believe I missed that!