PDA

View Full Version : How to setup Bootloader



koossa
- 2nd January 2006, 18:12
<font size="2">
Hi Picers.

Can anyone with practical experience on bootloaders <b>PLEASE</b> give me steps to set-up "in circuit debugging".

I have gone through a lot of documentation, but just could not get it to work.

Now I want to start from scratch as this usually solve the problem.
I think it is something simple that I miss.

I have the following software and components:
- Picbasic pro
- Microcode studio plus
- 16F877 PIC
- 4Mhz Xtal
- Max232
- Picstart Plus
</font>

modifyit
- 7th January 2006, 05:11
You may want to use a 16F877a instead of the 877, I'm not sure if you can bootload to the 877 or not.

sincity337
- 7th January 2006, 06:17
Hi,

I can't answer your bootloader question, but how old your PicStart Plus? I found out the one I had was kind of old and had to get an upgrade card for it to get it to work properly. Just a thought....

James

ardhuru
- 7th January 2006, 06:48
Hi koossa,

What stage are you at? Do you need help with the bootloading, or the ICD?

Once you have correctly programmed the bootloader firmware into the PIC, your programmer (Picstart, or any other) is out of the picture.

Can you give some more details about where exactly you are stuck?

Regards,

Anand

koossa
- 7th January 2006, 08:57
My I ICD is working as well as serial communication from pic to PC, it is only my bootloader that I strugle with.

After I upload the bootloader hex file to my pic using the picstart plus, I put it back in the circuit, connect my serial cable to the circuit and in MicroCode Studio I click on the menu "PROJECT", "COMPILE AND PROGRAM" then I get the message:
"Reset Required, please reset the target microcontroller in order to access to the bootloader process... ".

I have tried to reset it then, but with no luck.

Thx

ardhuru
- 7th January 2006, 11:33
Since you have the ICD working, like you said the Pic to PC connection is intact.

Are you sure you dont have an incorrect bootloader file programmed for the clock speed you are using?

Also, make sure the baud rate chosen in the Microcode Loader is on Auto.

Regards,


Anand

Bruce
- 7th January 2006, 16:29
With the MCS loader & a 4MHz oscillator, make sure you're programming the 877 with the 877 MCS loader firmware for 4MHz.

Add these to the top section of your code;

DEFINE LOADER_USED 1
DEFINE OSC 4

Setup the MCS loader as the programmer. Then click the Compile/Program button from within MCS.

If you have not wired the auto reset circuit as shown in the MCS loader help schematic, then you need to cycle power when this message pops up, or have a switch to /MCLR to reset the PIC during the boot loading process.

Assuming you have wired the MAX232 correctly, have a good serial cable/connection, etc, it should work fine.

koossa
- 8th January 2006, 08:30
I am using MPLAB to program the 877 hex file onto the pic and not with the MCS loader firmware, I think that could be my problem?

ardhuru
- 8th January 2006, 12:16
No; how you load the bootloader hex file into the pic is immaterial. In fact, you cannot program the bootloader firmware itself using the MCS loader; that would be a chicken-and-egg situation.

Do you have another programmer at hand? Or, you could perhaps build a simple JDM type programmer for initially downloading the bootloader firmware into the PIC. After that, the bootloader should work, and you would not require the programmer (for that chip).

Regards,

Anand

Bruce
- 8th January 2006, 19:52
1. Start MPLAB.
2. From the Programmer menu. Select "Programmer\Select Programmer\PICSTART Plus". Then "Programmer\Enable Programmer".
3. Select the PIC16F877 using the "Configure\Select Device" menu.
4. Click "File\Import", and locate the MCS boot-loader firmware for the PIC16F877 at 4MHz. Import this .hex file to memory.

Important: Do not make any configuration fuse changes once you have imported the loader .hex file.

5. Place your 16F877 in the PICStart.
6. Click the Program button or "Programmer\Program" menu options.
7. Use the "Programmer\Disable Programmer" menu options to disconnect the PICStart once finished. This will free up the serial port for use with the loader.

You should now have the MCS boot-loader firmware programmed into your F877.

To use the MCS loader, you need the max232 interface to your PC serial port as shown in the loader help file.

Place the programmed F877 into your circuit or board with the max232 PC interface.

If you're compiling PBP code for use with the loader, then place;

DEFINE LOADER_USED 1
DEFINE OSC 4

in the beginning section of your code.

From within the MCS IDE, select the MCS loader as the programmer. Click the Compile\Program button. Your code will compile, and the MCS loader software screen should pop up, then program the PIC using the boot-loader.

If you're not using (shown in the MCS loader help file) the auto reset circuit, then cycle power to the board, or momentarily ground /MCLR to reset the PIC.

You can also use the loader with MCS ICD. With the PIC connected as above, use the ICD\Compile button. This will compile your code with the additional ICD code in your final .hex file. Then use the ICD control buttons to start, pause, stop, etc.