PDA

View Full Version : bootloading to a multi-controller board



rossfree
- 15th February 2005, 13:08
Hi all,

I thought I'd share the resolution to a problem I had using a board we designed that included three PIC controllers. It was elusive and took quite some time fumbling around before the cause presented itself.

The board we use has two 16f876s and one 16f877, though the problem would have occured with any PICS connected the following way.

The TX and RX lines were tied to all three chips from a MAX232 circuit. The board was connected by serial cable to my computer and each of the pics had the MicroCode Bootloader installed.

An on-board three-position jumper chose which pic would receive the MCLR LOW signal to initialize the correct pic for programming. And for a while it would seem that everything worked. And that is what really led me astray. Why would it work one day and not the next.

Long story short...

The TRIS register for PORTC has to be set properly so that the TX and RX pins are made INPUTS (high impedance) on EACH of the PICS. In my case, the '876s defaulted to a HIGH output on the TX (or RX) pin. When trying to program one of the PICs, the data signals would fight going LOW because the other pics would be stubbornly trying to hold the TX or RX lines HIGH. This meant that the PICS could only be programmed with one on board at a time.

Once I realized the problem, I set the TRIS registers on all three PICS to make their TX and RX pins INPUT. Then I could install all three PICS without further problems. Now I can boot-load programs to any of the three PICS with only a jumper change (for MCLR).

Having multiple PICS on a circuit board may be seldom done but it can be done with the MicroCode bootloader and work well.

I hope this helps someone in the future. This forum has helped me a great deal.

CUDOS to the forum GODS!

Ross

mister_e
- 15th February 2005, 14:03
Nice tip Ross.

NavMicroSystems
- 15th February 2005, 18:12
Steve,

do you remember This (http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=1183)

mister_e
- 15th February 2005, 18:24
Yep for sure... but since you boot the PIC, all pins are set to input, IMO the booloader software set TX to output itself.

AND the link was about ICD problem, not bootloader problem(like i had few days ago... still feeling cheap of my mistake ;o] )

BUT... i'm not sure HSEROUT will work after that. AND case it's working... all TXs are tie together without any kind of isolation... short circuit's coming soon ;)

AND i'm really not going to use this kind of method. i'll prefer using one bigger PIC.

NavMicroSystems
- 15th February 2005, 19:40
Yep for sure... but since you boot the PIC, all pins are set to input, IMO the booloader software set TX to output itself.

I always set the registers "manually"


AND the link was about ICD problem, not bootloader problem(like i had few days ago... still feeling cheap of my mistake ;o] )

My reminder was just ment to make you smile ;-)


BUT... i'm not sure HSEROUT will work after that. AND case it's working... all TXs are tie together without any kind of isolation... short circuit's coming soon ;)

I fully agree. when connecting pins that have a chance to come up as output there should be some kind of protection (like diodes)


AND i'm really not going to use this kind of method. i'll prefer using one bigger PIC.

I also agree on this one, but sometimes there is no choice, since the PIC is only able to do one task at a time.

You can get some kind of "multi-tasking" by adding some PIC's .

mister_e
- 15th February 2005, 20:39
My reminder was just ment to make you smile ;-)


hehe that's what you did ;)

In case i'll have a board with multiple PIC to be updated, i'll probably use another method using Digital switches (4066 or else better) probably controlled by a dedicated 'firmware update PIC server' who'll do the switching for me.

nomada
- 15th February 2005, 23:58
Hi all

After reading the link provided by NavMicroSystems I remember what happened when I used the ICD for the first time and I must say it originated a "melting" problem.

I just programmed a small program in a 16F628 and didn't take care about TRIS, because has I though then the ICD isintelligent enough to take care of that.

The ICD fail to start the first time due to wrong schematic provided by MCSplus helpfile, after correction of circuit at my second attempt and while I was at the PC keyboard trying to find what is wrong, suddenly it started smelling that something is not OK, when I turn back I found that the heat at the PIC pins has melted the plastic of my breadboard and "believe it or not" I could not remove the PIC from the breadboard, result: PIC=1 - breadboard=0.

In the General forum under "Which PBP Compiler are you using?" I appreciated the help from mister_e, here I thanks the guidance of NavMicroSystems with that link.

Credit should be given to those who know how to enlarge our small ideas.

NavMicroSystems
- 16th February 2005, 01:21
nomada

we're glad to hear those threads have been of any use.