Author Topic: Failed To Autobaud  (Read 68557 times)

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 1916
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Failed To Autobaud
« on: July 07, 2009, 09:55:29 PM »
If you are reading this you probably received an error message from Flash Magic telling you that autobauding failed. This is by far the most common problem that people run into and this post will provide some pointers.

Read this post entirely before posting a new topic or contacting us for help.

Because hardware and microcontrollers vary I will first give you the bad news - there is no magic one-size-fits-all answer to your problem. The solution depends on your situation and you will have to do a bit of investigating and understand what is happening. This is always the case when hardware is involved.

For People in India

We have a lot of people in India who have difficultly with autobauding. From trying to solve this problem with several people we have come to the conclusion that there are small shops selling microcontrollers that are not brand new and might have an unknown past. Only puchase brand new microcontrollers from authorized NXP distributors, otherwise you might be wasting a lot of your time.

Overview of Autobauding

What is autobauding? When the ISP bootloader in the microcontroller is started it waits for a special character (called the autobaud character) to be received on UART0. The character used varies depending on the device. Generally 8051 and XA devices use a 'U' while ARM devices use a '?'.

When the character is received the bootloader uses it to measure the baudrate you are using in Flash Magic. It then configures UART0 to use the same baudrate. Finally it sends a response back to Flash Magic.

In 99.9% of cases the error you are getting is caused by Flash Magic not receiving a response from the microcontroller. What could cause this? Some possible reasons are:

  • Using wrong COM port
  • Serial cable is faulty or not connected to PC and RS232 transceiver on your hardware
  • You are using a USB to RS232 cable which doesn't work properly
  • A USB driver is causing problems
  • There is a bad solder joint on your hardware stopping the autobaud character from arriving at UART0 RXD
  • The ISP bootloader failed to start
  • The microcontroller cannot execute code because of no running oscillator, insufficient power supply, glitches on the power supply, etc.
  • The baud rate you are using is too high or too low
  • You are using a P89V51Rx2 or P89LV51Rx2 and the autobaud character is not being sent in time

Let's examine each of these in turn and how you can check them. They are in no particular order.

Using wrong COM port

Make sure you are using the correct COM port. If you are using a USB to RS232 cable or Future Designs USB interface then unplug the cable, go to Control Panel -> System -> Hardware-> Device Manager  -> Ports (COM & LPT) and see which COM ports are available. Then plug your cable back in and see which new one appears.

Serial cable is faulty or not connected to PC and RS232 transceiver on your hardware

Put an oscilloscope on the RIN pin of the RS232 transceiver. Click on Start in Flash Magic and watch for the autobaud character. If it doesn't appear then try a different PC and serial cable. Try putting the oscilloscope on the COM port connector on your PC and checking there.

Check for an electrical connection between the ground, TXD and RXD pins of the cable at each end. Note that a problem with the ground can stop communications from working (Thanks Jan for this one).

If you don't have an oscilloscope then get one. They are required for developing with embedded systems and are necessary to see what is happening in the circuit. Without one you will run into constant problems and frustration that will waste days of your life.

You are using a USB to RS232 cable which doesn't work properly

We have had a LOT of reports of problems with these cables. Some work well and some don't. There is no list of what does and doesn't work. This would be one one of the things we would suspect. Obtain a PC with a COM port. It is also possible to buy PCI cards with COM ports for desktop PCs.

A USB driver is causing problems

If you are using a USB to RS232 cable or Future Designs USB interface and you have tried the above, then try the following steps:

Go to Control Panel -> System -> Hardware Tab -> Device Manager
Expand Ports (COM & LPT) in the list
Right click over the COM port assigned to your USB cable
Choose "Uninstall" from the menu
Unplug the cable and plug it back in
Go through the driver installation steps

If that doesn't help then try:

Go to Control Panel -> System -> Hardware Tab -> Device Manager
Expand Ports (COM & LPT) in the list
Right click over the COM port assigned to your USB cable
Choose "Properties" from the menu
Click on the Port Settings tab then Advanced...
Choose a new COM port number, for example COM17. Don't pick one that it says is in use, even if it really isn't in use.
Click on OK then OK.
Unplug your USB cable and plug it back in.
Make sure the cable is assigned the new COM port number

There is a bad solder joint on your hardware stopping the autobaud character from arriving at UART0 RXD

Put an oscilloscope on the RXD pin of the microcontroller. If the pin is not accessible put the scope on the RXD signal as close as possible to the pin. Click on Start in Flash Magic and watch for the autobaud character. If it doesn't appear then start checking at various points in the circuit working your way from the microcontroller to the RS232 transceiver.

The ISP bootloader failed to start

This is a common cause. The user manual for your device will describe all the conditions necessary to start the bootloader. You must check and make sure all of them are being met. Measure voltages and timing at the pins of the microcontroller.

The microcontroller cannot execute code because of no running oscillator, insufficient power supply, glitches on the power supply, etc.

Check all electrical aspects with an oscilloscope and make sure your circuit meets the AC and DC specifications in the data sheet for the microcontroller.

The baud rate you are using is too high or too low

The baud rates that can be used to communicate with the bootloader vary depending on the frequency of the oscillator being used. It is recommended to use at least 10MHz and 9600 baud. Try different baud rates. However the bootloader will only attempt to autobaud once after a reset so be sure to reset it between attempts.

You are using a P89V51Rx2 or P89LV51Rx2 and the autobaud character is not being sent in time

These devices are different in how the bootloader is activated and it is important to understand these differences. They are not like other devices with similar names. Do not make assumptions about any particular device and how it works based only on the part number. Read the data sheet and user manual.

These devices must receive the autobaud character within a specific time after reset to enable the bootloader. Flash Magic can reset the device for you (with support in the hardware) or you must do it manually. This setting can be found in Options -> Advanced Options -> Hardware Config. Uncheck/untick the "Use DTR to control RST" for manual resets. When clicking on the Start button a window will open telling you to reset the device. While the window is open Flash Magic is sending out a constant stream of autobaud characters. This is when you reset the device.

Before attempting to use the DTR option get it working without DTR. This simplifies the situation and reduces the potential for problems.

If you still cannot get one of these devices to communicate with Flash Magic then use an oscilloscope to check that a constant stream of 'U's are arriving at the RXD pin of the microcontroller. This will look like a square wave. Then check if anything is being output on the TXD pin.

Additional Notes

Get the User Manual for your device from http://www.nxp.com/microcontrollers

Try communicating with the device using Hyperterminal. Use 8 bits, no parity, 1 stop bit, no flow control. Send the autobaud character and see if anything is echoed back. If it isn't then the problem is likely not with Flash Magic.

If communications work with Hyperterminal but not with Flash Magic then a possible cause is in how DTR and RTS are used. For example the Keil MCB900 board requires proper control of DTR to enable the outputs of the RS232 transceiver. Other boards may do something similar. Check the schematic diagram for your board and understand the requirements. Contact the vendor of the board if needed. In Flash Magic under Options -> Advanced Options -> Hardware Config try checking/ticking and unchecking/unticking the "Assert DTR and RTS while COM port open" option to see if that helps.

Some users have reported having PCs where DTR and RTS are inverted for some reason. It is always worth trying another PC of a different make or model to see if the problem appears there.

A good way of getting to a "known state" is to buy a tried and tested board from places like www.lpctools.com. These boards are low cost and if you buy a Keil board then typically the schematic diagrams are available on www.keil.com. Contact Keil for details on the diagrams. We typically use Keil boards in-house for developing and testing Flash Magic. If you contact us with a problem the first thing we will usually do is grab the appropriate Keil board and test with it.

Ultimately the best person in a position to track down and solve the problem is you. You have the PC, microcontroller, cables and hardware in front of you.

If you have gone through and checked everything in this posting and still feel you need help then we need a detailed email or posting on this forum with everything you know and understand about the problem. It is difficult for us to diagnose problems remotely and without detailed information your request for help will likely only result in us asking questions.
« Last Edit: April 30, 2010, 03:10:44 PM by Andy Ayre »
Embedded Systems Academy, Inc.
support at esacademy dot com

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 1916
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed To Autobaud
« Reply #1 on: May 12, 2010, 05:02:06 PM »
These are from Steve H (thanks Steve!):

Loopback check serial cable

Jumper pins 2 and 3 together then run Hyperterminal and see if you get an echo. If so, most likely your serial port and cabling are working fine.

Verify if you need a null modem or straight through cable

Some boards will require a null modem, while others need a straight though. It should be stated in the documentation. You sort of allude to this in the "additional notes" section, but you don't come right out and say it.
Embedded Systems Academy, Inc.
support at esacademy dot com

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 1916
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed To Autobaud
« Reply #2 on: March 17, 2014, 02:01:33 PM »
This is from Sanket H (thanks!):

FTDI USB to RS232

The issue was with ftdi chip (As I mentioned I am using USB to serial converter using FT232RL). The thing was that the version of FTDI chip that I was using (1213C) was not compatible with the latest drivers available on  the official website http://www.ftdichip.com/FTDrivers.htm. I had to download version 2.04.06 to get it working. After a week long struggle I had almost given up hopes until I hit upon this article https://www.olimex.com/forum/index.php?topic=2031.0
Embedded Systems Academy, Inc.
support at esacademy dot com