PDA

View Full Version : DEBUG baud rates



btaylor
- 22nd January 2006, 05:51
What is the maximum reliable speed that a PIC16F88 can bi-directionally communicate with a PIC16F877A when both have 20 MHz crystals? The manual says DEBUG is the smallest and fastest comms routine but fails to mention anything about the maximum data rates.

I need reliable comms between four PICs on the same PC board. They all run at 20 MHz.

I cannot use the USART as this is reserved for debugging and I have experienced startup problems when two PICs, both running bootloaders, are joined together via the hardware USART

Cheers
Brian.

mat janssen
- 22nd January 2006, 11:05
Normally I use a baudrate of 9600. With no problems on comunication.
And when the 4 ic's are on the same printed circuitboard use then shiftin/ shiftout for communications betweem them. It's fast and reliable.

mister_e
- 22nd January 2006, 11:39
DEBUG must work up to 115200 @20MHZ without too much problem. i'd never tested it higher than 115200, maybe it work, maybe not.

What kind of problem did you have ?

How it was connected?

keithdoxey
- 22nd January 2006, 13:29
And when the 4 ic's are on the same printed circuitboard use then shiftin/ shiftout for communications betweem them. It's fast and reliable.

Hi Mat,

I am interested in inter PIC communications but something I cant see from the manual is how ShiftIn/ShiftOut would work.

As I read it, both ShiftIn and ShiftOut DRIVE the clock signal. There doesnt seem to be an option to allow the clock to be external. It almost seems as if there should be a ClockIn/ClockOut command which was effectively the same bu used external clock, or just some added modes to the existing commands the set the clock pin as an input for external clock

Could you please expand on how you have implemented the above idea.

Regards

mat janssen
- 22nd January 2006, 16:48
Yes, ofcourse I know that. And it is also a problem of knowing if the other chip was ready for recieving data.
That's why I used a HEF4731 in between. With oring the clock.
I made also a line that i have data for my neighbour.
When sending I write the data into the 64 bit register. And when the slave got a signal that I have data for him I read the 64 bit register.

Serout and serin commands are also usable but I don't know what happens if the masterchip has to communicate at the same time with its hardware uart.

btaylor
- 22nd January 2006, 23:33
Thanks for the insights guys. I will restate my problem.

I have two PIC16F88 and two PIC16F877A on a single 100 mm square board. I have been using serin/out2 with the mode number set to 16390 which gives 38,400 bps. I use an RTS/CTS system to pace the communications and send every packet with a checksum. This has been a reliable means of communicating between the PICs but I now need it faster. I don't care what the speeds are as long as they are faster and preferably up around 100,000 bps.

The boards are built and shiftin/shiftout traces are not on it. I also don't see how shiftin/shiftout can easily work in a peer to peer system. Shiftin/out needs a master to provide the clock. I cannot, or don't want to, use the USART HSERIN/OUT as this is reserved for the bootloaders and physically wired on the PCB to the bootloader ports. In a previous project I had intermittent trouble at startup with USART to USART comms where both PICs had MCSP bootloaders running. I think that on occasions the bootloaders would see each other and think mother was calling. They appeared to start a brief but merry dance between themselves and the system would then crash. The boot code was never overwritten thankfully.

From a peek at the SERIN2 tables on the Melabs web site it seems that there are only certain speeds available to SERIN2. I don't know what happens if you just pick mode numbers at random but I doubt it will be pleasant.

Because the baud rates are the result of some unknown (to me) math operations, and we have integer math divisor truncations, I am pretty sure there will be a few optimum and many sub-optimum baud rates with DEBUGIN and DEBUG. I don't care if the speeds are 'non-standard', I just want fast reliable comms.

Does anyone have a table of preferred DEBUG/IN speeds similar to the SERIN/OUT2 speeds on the melabs web site or can they point me to an algorithm that computes this?

Cheers
Brian

Dave
- 23rd January 2006, 13:00
btaylor, Why not use the HSERIN/OUT commands? That way you can use the full speed of the hardware UART. At 20 Mhz. crystal rate and SPBRG set to 1 with the BRGH bit set to 1 you should get about 125000 baud.

Dave Purola,
N8NTA