PDA

View Full Version : Using the Mecanique Bootloader without the DTR reset signal



picnaut
- 11th September 2005, 05:56
Hi,

I can't believe it took me so long to figure this out.
Now I can upgrade the firmware in my PICs (using the MCSP bootloader) without having to wire up the DTR.

The only thing you have to do is make sure that your firmware is constantly looking at the serial port at either 19200 or 115200 baud. When the PIC receives the null character (which has an ASCII value of ZERO) you simply jump to the start of memory and the bootloader code gets run.

Here's an example:

Main:
HSERIN 1, HserinTimedOut, [Char]
IF Char = $00 THEN 'Bootloader must be trying to communicate
CLEAR
@ GOTO 0
END IF
GOSUB DoSomethingWithChar 'jump to your regular data handling routine

HserinTimedOut:
Goto Main


Now, if you're not handling serial port communication all of the time, you are going to have to at least check the receive buffer every second or so to see if the "request-to-send" character has been received (the bootloader software will send if many times).

Also, if you're operating at a different baud rate, you will need to first send the PIC a command to jump to the "Listen for Bootloader" code, which must first change the baud rate to match your bootloader and then listen. This is a bit more complicated.

Anyway, give it a try and let me know how it works for you.

Cheers!

picnaut
- 11th September 2005, 18:49
Now, if you're not handling serial port communication all of the time, you are going to have to at least check the receive buffer every second or so to see if the "request-to-send" character has been received (the bootloader software will send if many times).

Actually, I did some more experimenting and found that you can go up to a minute without checking the serial port. The bootloader sends out the request for quite a while. However, to be on the safe side, I would check for that character at least every 30 seconds.

Regards,

modifyit
- 14th September 2005, 03:39
very nice! I just tried it on a project of mine and it works like a champ. Thanks alot for the info