Go Down

Topic: [solved] Programming Atmel328 SMD over bluetooth (Read 388 times) previous topic - next topic

MagicBoots

Apr 12, 2013, 01:51 am Last Edit: Apr 13, 2013, 04:07 am by MagicBoots Reason: 1
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: [Select]

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

MagicBoots

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.

hiduino


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.


MagicBoots


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!

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview