[<<][staapl][>>][..]
Sat Feb 14 19:41:36 CET 2009

forget about bitbanged uart

Actually, at the expense of 2 pins I can just forget about bitbanged
serial and connect the uart+icd pins together and get on with writing
some software..  There is no general way to solve this: when the
serial port is necessary for something else, the console comm needs to
be incorporated into the whole app anyway, depending on the app's
need.  Timer-less / iterrupt-less bitbanged serial is really asking
for trouble apparently..

Maybe it's easier to get synchronous communication working over the
ICD2 connector.  Now that I do have the basic PK2 protocol figured out
and implemented in a C program, this step might not be as great..

The simplest way to do this is to use the AUX pin as a slave->master
interrupt.  Upon reception, the master can clock out the reply.  When
the message is finished, slave resets AUX pin.  Alternatively, after
writing a message the data pin could be used as an interrupt, and the
clock's falling edge would serve as an acknowledgement, with the
rising edge sampling the first bit.

But.. This is a still lot of work to get going.  Probably not worth
the trouble.

One more thing: PGC should then be connected to target's RX/DT and not
the CK input, so synchronous slave mode can only be used if these
wires are swapped..  Damn...

  ICD2    serial                 color

1 /MCLR                          white
2 VDD                            red
3 GND                            black
4 PGD     RX  (<- target TX/CK)  yellow
5 PGC     TX  (-> target RX/DT)  orange
6 PGM

Unidirectional transfer with PIC as slave seems simple enough
though.. But that's not very useful.

One last hack: After host has transmitted last message, client asserts
data line low.  Host starts reading out these low bits.  When client
is done, it waits for a clock signal and sends a single high bit, then
starts slave transmission of the message.  Host reads length byte, and
subsequent data bytes.



[Reply][About]
[<<][staapl][>>][..]