Pages: [1]   Go Down
Author Topic: [solved] Programming Atmel328 SMD over bluetooth  (Read 330 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Beep Boop
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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);
    }
    
    
  }
}


* BT.png (29.25 KB, 921x663 - viewed 20 times.)

* Level.png (7.9 KB, 743x334 - viewed 17 times.)

* Reset.png (26.66 KB, 651x587 - viewed 17 times.)

* reset_wave.jpg (520.02 KB, 2048x1536 - viewed 17 times.)
« Last Edit: April 12, 2013, 09:07:17 pm by MagicBoots » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
Beep Boop
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 29
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
Beep Boop
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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... smiley-red
Thank you, I can't believe I missed that!
Logged

Pages: [1]   Go Up
Jump to: