3

So I need a program that I can run on embedded linux (OpenWRT 8.09), via command line, I need to be able to transmit 8N1, i need to transmit in HEX (not ascii,) and preferaby also in decimal.

As far as i can tell microcom and picocom don't transmit hex.

Edit clarification: I want to enter data into the program in Hex, and have it send the binary (8N1) repressentaion of each 2 digit hex pair.

  • 2
    I think you mean it should transfer files in BINARY as well as (or instead of) ASCII. – pavium Feb 6 '10 at 0:52
  • Not files, i want to send bytes i enter from my keyboard, like br@ys ternimal does in windows. also I can't just send the ascci equivients as some op n the thijngs i need to send corrispongd to no printable characters – Lyndon White Feb 6 '10 at 1:42
  • 1
    @oxinabox: files, data, whatever. to clarify, you need a BINARY transfer mode instead of an ASCII mode, and you want to be able to input the data to transfer as hex. – quack quixote Feb 6 '10 at 10:36
  • 8N1 = 8 data bits, no parity bit, and 1 stop bit. – Peter Mortensen Feb 24 '10 at 8:53
1

If the program doesn't allow you to transmit in hex there are workarounds. You can pipe info through od to convert it to hex before sending it to microcom or picocom.

for example, convert "some text" to hex:

echo "some text" | od -tx1 | cut -c 8- | tr -d " "
  • unfortunatly od is not included in opnwrt distro - this will require a recompile of hte OS. openwrt isn't great, I think installing debian or even freebsd might be a better option, even though that will mean porting and crosscopiling – Lyndon White Feb 9 '10 at 6:51
  • @oxinabox: what's openwrt running on? you could crosscompile od for the openwrt environment, then if it's on a router, scp the just binary over the network. – quack quixote Feb 13 '10 at 8:45
  • Can i please have more info on how to do this piping? I have made a custom program that converst hex or decimal or binery taken as a parameter to the appropriate binery stream, How do i pipe it though the com program? – Lyndon White Feb 16 '10 at 3:49
1

Try to use CuteCom: http://cutecom.sourceforge.net/

It is dead project yet, but it works fine and it is able to show hex representation of characters.

But it is graphical, so you can't use it on embedded linux (if you don't have there X support ant QT4).

enter image description here

0

I think ssterm should work for you. It is written in Python (which is probably bad) but it is console-based, and it does support hexadecimal input and output.

You can launch it like this:

ssterm /dev/ttyAMA0 -b 9600 -i hex -o split

Then it should read hexadecimal characters from stdin, convert each 2 characters to byte and send that byte to the serial.

Also it will read data from the device and show it in hexdump-like way: hex representation to the left and ascii representation to the right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.