[chirp_devel] Getting copy of written serial data upon read

Dan Smith
Mon Apr 29 15:13:44 PDT 2013


> I'm working on adding support for a new radio, the Ritron RTX-450.
> It's a commercial radio, but with a bit of VCO tinkering works in the
> ham bands.

Cool!
 
> I started with template.py, and use uv5r.py as a reference, since I
> have one of those as well. So far, I've mapped out the memory and
> established communication with the radio, but I'm having a problem
> when I read the data.  To establish communication, I first send a
> series of "?", followed by a "G". As soon as the radio receives the
> G, it starts sending data. What's happening in chirp, though, is when
> I do the serial.read(1), I'm getting the sent data back and then the
> radio data, as if the buffer doesn't clear. This uses an Icom OPC-478
> style cable, where RX and TX are simply wire-OR'd together, so that
> does make sense. I should mention that this cable works fine with the
> OE software. Do I just need to look for the sent string in the
> response and filter it out, or is there a better way to handle this?
> I tried inserting serial.flush() after serial.write("G"), but when
> stepping through the program that seemed to do nothing.

Yeah, so those sorts of cables "echo" because of the unified TX/RX
line. So, the best way to hand that is something like:

def _echo_write(radio, data):
    radio.pipe.write(data)
    radio.pipe.read(len(data))

and use _echo_write(radio, "foo") instead of radio.pipe.write("foo") in
your communication. Various permutations of the above are used in
drivers having to deal with this sort of behavior.

-- 
Dan Smith
www.danplanet.com
KK7DS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130429/d9638ff9/attachment-0001.bin 


More information about the chirp_devel mailing list