Go Down

Topic: Optiboot with FTDI Problems.. (Read 12621 times) previous topic - next topic

Coding Badly


You will need to adjust the baud rate in the boards.txt file.  115200 * 20 / 16 = 144000

WiredUp

uno.upload.speed=115200   Is this the line I am changing in the boards.txt file? I changed the value to 144000, and now I can upload to a chip.. well it completes the upload, but it responds back:

avrdude: serial_baud_lookup(): unknown baud rate: 144000

Ok, now the real problem is that even though it said it completed the upload.. there is no change in the programming.. tested against the simple blink program.. no difference if I change the time high or low.

Weird, but this is progress! So, Coding Badly... where did you come across that bit of info?

tim7

The baud-rate generator is derived from the system clock, so if the CPU frequency is too high the baud rate will also be proportionally too high.  Since avrdude apparently can't deal with intermediate baud rates, you'll need to recompile Optiboot for a 20MHz CPU clock frequency.

WiredUp

Good deal.. I found a forum post that explained some of this.. do you know where I can find any detailed information on how to recompile optiboot?

tim7

Actually it looks like more recent versions of avrdude can handle odd baud rates ok.  Try using the v1.0r1 IDE.

Coding Badly

uno.upload.speed=115200   Is this the line I am changing in the boards.txt file?


Yes.

Quote
I changed the value to 144000, and now I can upload to a chip.. well it completes the upload, but it responds back: avrdude: serial_baud_lookup(): unknown baud rate: 144000


I suggest trying a newer version of avrdude...
http://savannah.nongnu.org/patch/?6828

Or a newer version of the GCC AVR toolset...
http://arduino.cc/forum/index.php?topic=37965.0

WiredUp

Brilliant! I will try it out, and post back.. thanks guys!

WiredUp

Ok, so I tried the installing WinAVR and grabbing the avr directory and swapping it with the ones for the Arduino's toolset.. well, now the IDE will respond:

avrdude: stk500_getsync(): not in sync: resp=0x00

Any other suggestions?

Coding Badly


There is a possibility that one of the previous problems is still a problem...

Does auto-reset appear to be working?

Are you confident you have TX and RX the right way around?

Did you leave the baud rate at 144000 or put it back to 115200?

madworm

#24
Oct 02, 2011, 02:33 pm Last Edit: Oct 02, 2011, 02:37 pm by madworm Reason: 1
Was that a rhetorical question?

If not, then the answer is still yes. The serial speed is hard-coded into the bootloader and depends on clock frequency.

Edit: what just happened here... so many posts before this one. Seems like I've lost half an hour... Odd.

Coding Badly


Did @WiredUp delete something?

madworm

I don't know. Maybe I was distracted with something else for waaay too long.

WiredUp

#27
Oct 02, 2011, 10:40 pm Last Edit: Oct 02, 2011, 10:59 pm by WiredUp Reason: 1
Well I am thoroughly confused.. I tried moving over the avr toolset from winavr, and using it didn't solve my problem.. it actually caused some issues with uploading to a regular UNO board.. I dunno, but I made sure while I was using that toolset I checked out my wiring making sure tx/rx were in their respective places.. and the auto-reset circuit was setup properly.. but no dice still. I switched back to the original toolset.. and broke down..

I built a barebones circuit with a 16 MHz. crystal and (2) 22pF caps instead of the 20MHz. resonator. I checked the boards.txt file and made sure it was back at a baud rate of 115200.. and I can't upload to the chip via the FTDI cable.. same errors in the IDE as before..

I'm not a great programmer and all this information I am finding about recompiling the optiboot is severely confusing.. working and in school I just need a working solution.. it doesn't make since at this point. I just need a working solution without having to swap the chip back and forth to the arduino each time.

If I can accomplish my goal in another IDE.. thats an option.. AVRstudio looks cool, but learning curve seems a little fun, and figuring out how to reuse all my arduino libraries in AVRstudio seems like another problem in itself.

I'm just lost at this point.. I have tried so much and not accomplished anything.. ever got lost in what your doing and don't know where to go next?... yyeeppp.. thats me.

tim7

It sounds like you've got in a muddle, so it's time to simplify!  You can do everything you need with the latest version of the Arduino IDE, so I suggest getting rid of all other Arduino or AVR software (for now) and installing Arduino IDE v1.0r1 from http://code.google.com/p/arduino/wiki/Arduino1.

Since you've got the pieces to make a 16MHz breadboard-Arduino, I recommend starting with that: no recompiling bootloaders, and no strange baud rates.  Firstly, I suggest re-loading the bootloader in case something went wrong the first time.  The easiest (and best) way to do that is with Bill Westfield's Optiloader sketch, from https://github.com/WestfW/OptiLoader.  You'll need to change the first line of optiLoader.h from #include <WProgram.h> to #include <Arduino.h>, then compile the sketch and load it onto your Uno.

Then connect up the Uno as an ISP programmer, as shown here:


One everything is connected, hit reset on the Uno and wait a few seconds for it to do its thing.  Note that you are not using the IDE to load the bootloader - the Uno will do everything itself.  However you can monitor output from the Uno on the serial terminal window.

With that done you can remove the programmer, connect the breadboard to a serial interface, and try uploading a sketch.  You can use the Uno board (with microcontroller removed), as in the image below.  Or you can use your FTDI cable - don't forget to connect power, and Reset (pin 1) to DTR.  In both cases, select "Uno" as the board in the IDE and try uploading the Blink sketch.


Let us know if you get things working at 16MHz, and then we'll have a go at 20MHz.

(images taken from the Arduino web pages at http://arduino.cc/en/Tutorial/ArduinoISP and http://arduino.cc/en/Tutorial/ArduinoToBreadboard)

WiredUp

Thanks alot.. that really unwound my mind a little.. should have seemed obvious that I could use the UNO straight up to program a chip.. but it works!

So I downloaded IDE v1.0r1, and the Optiloader sketch and followed the instructions.. works great with the UNO itself, but I still can't get the FDTI cable to work.. with a LED on pin 19 I can see it trying to upload the sketch. It blinks a couple of times and then is off until the IDE gives up and errors.. then it blinks again.

At least I have a solution that will save me the one thing I have too little of.. time :)  All the help is greatly appreciated!

I do wish I could figure out how to get the FTDI working.. but if its going to be that much trouble I don't know if it is really worth using.

I still can't get the 20 MHz. resonator to work even with the UNO.. I went into the boards.txt folder and changed the baud rate to 144000, and nothing. So hopefully there is more to that..

Thanks again  :)

Go Up