[<<][pk2][>>][..]
Sat Mar 26 20:00:46 EDT 2011

Read a packet

What's too bad is that this mode is host-polled.  Ideally, you'd want
a ping-pong protocol, letting the target do the timing for commands
that are not immediate.

So we need a protocol that take this into account.  The problem is
that if the target wakes up during a host poll, it doesn't know at
what clock pulse it has arrived.

The simplest way to do this seems to be to have the host poll the data
line.  If it makes a transition, the target is ready to send and the
synchronous readout can start.

Protocol:

1. Host sends out size-prefixed byte packet.
2. Host polls target receive-ack (i.e. data ->high)
3. Host polls for target ready-tos-end (i.e. data ->low)
4. Host clocks out one byte (size)
5. Host clocks out the remainder of the data packet


Read mechanism also seems to work.

(define (icsp-recv bytes)
  (CLR_UPLOAD_BFR)
  (if (< bytes 1)
      '()
      (begin
        (EXECUTE_SCRIPT (SET_ICSP_PINS 0)) ;; only clock matters
        (if (= 1 bytes)
            (EXECUTE_SCRIPT (READ_BYTE_BUFFER))
            (EXECUTE_SCRIPT (READ_BYTE_BUFFER) (LOOP 1 (- bytes 1))))
        (UPLOAD_DATA))))


I quickly tried the ICD protocol handshake but that doesn't seem to do
anything.  Maybe it should trigger on the other line?



[Reply][About]
[<<][pk2][>>][..]