Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@11000100111000 stty, minicom, screen are shit, tried all of them. I don't want to send data out of a file or something. I need to be able to enter data, press enter and get it transferred.
-
@11000100111000 yeah but my stdin doesn't interpret "101" as a 5, a number, it interprets it as "101", an ascii string.
-
@Gregozor2121 please provide me the ascii symbols for 0xaa, 0x82, 0x10, 0xcd, 0x7a, 0xfa quickly so i can send it easily to my device.
I got me an hex editor with binary capabilities, wrote a file and sent it. What a huge overhead for something so fucken simple. -
ddephor44466yWhy not hexadecimal? It's easy to convert from base 2 to base 16. Or do you need values other than 8 bit length?
For the serial part, install PySerial and write a short script.
Here's an example (without any conversion from base 2, you can copy that from Stackoverflow ;-)):
import serial
TestString = b'ABC123'
port = serial.Serial( 'ttyACM0', 9600 )
port.timeout = 0.5
port.write( TestString )
port.flush()
response = port.read( 10 )
port.close() -
@ddephor yeah of course i could write a program for that. But i don't want to write 3 programs in parallel.
-
@nitwhiz It's easy to complain about tools that are, in your words, “shitty” just because they don't convert what you type in your keyboard, whatever format it may be, to the correct value automagically.
Those tools do what they're supposed to do: read data from stdin, send it to the serial port. What you need is something that reads whatever input you want to type in the format you want to type it and output the binary data to stdout, which then you can pipe to one of those tools.
Let me add another tool not mentioned here before: socat. Here you go:
while read -r i; do i="\\x$(printf '%2x' "$(( 2#$i ))")"; echo -ne "$i"; echo >&2; done | socat -u STDIN /dev/ttyACM0,b9600,rawer,crnl
I haven't tested the socat part, but that Bash loop lets you enter bytes as binary digits and outputs them back as ASCII characters when you press Enter. You can consult socat's manpage for more information about what options to use in your particular case. -
ddephor44466y@nitwhiz Using base 2 directly is not a common use case. You will hardly find a popular tool that will do the conversion and all other stuff you need combined in one.
Base 16/hexadecimal is much more common, and easy to convert, you're better off using hex IMO.
Or just write the tool for yourself. I often rather write a small script to deal with some simple task, than search for hours for an existing solution, that usually doesn't do exactly what I need. These scripts are often one-shots, they look ugly and are not maintainable, but they do what I need. And as another benefit, it's a good developer training. -
@ethernetzero @ddephor for me, it was completely normal that these tools should have such a function. Most mcu's let you transfer/receive less than a byte via serial, say 5 bit or so. So i thought someone else might have thought "geez to test my routine i need to calculate the hex number for this binary combination myself?"
So I'm sorry i took "lat. computare" by it's meaning. -
Usually, a serial ports treat data bytewise. Mostly 8 bits, no parity, 1 stop bit (8N1). This means that the port does NOT send the data as continuous bit stream, and that's why it's not useful to enter data in binary.
Put 8 bits into a byte and then send it bytewise, that should work. You just need a little program that will convert '0' and '1' to bits, shift that into a variable, and transmit to the port once 8 bits are full. This is such an exotic use case that of course nobody has written a program to do that. -
@Fast-Nop if i configure my mcu to actually use 5 bit i'd like to specify 5 bits because i'm able to ffs.
-
@nitwhiz the question is whether your mobo port also supports this. Even if it does, it's unlikely that the mobo manufacturer has tested this at all.
-
Try hterm, we use it all the time during development.
Windows version works nice, Linux version needs some extra dependencies tho.
The developer website seems dubious, but I assure you we've never had any problems with it. -
ddephor44466y@nitwhiz Many UARTs are configurable from 5-9 data bits, but today you will usually find 8 data bits. Some protocols still use 7 data bits. All other configurations are kept for backwards compatibility, because there were protocols using 5 or 6 data bits, and the UARTs mostly based on the classic 8250/16550 design already support them since forever. But 5/6 data bits are really rare today.
-
@ddephor I'm using 8 bit myself, but the possibility of < 8 bit let me think there must be an option to enter binary data in these tools.
Related Rants
-
gururaju56*Now that's what I call a Hacker* MOTHER OF ALL AUTOMATIONS This seems a long post. but you will definitely ...
-
linuxxx70This guy at my last internship. A windows fanboy to the fucking max! He was saying how he'd never use anythi...
-
creedasaurus62Another dev on my team just got a new machine. Before he came in today I made two separate USB installers and ...
Is there any good linux application to send FUCKING RAW data to a serial port?
Port in question: /dev/ttyACM0
Baud (nice if configurable): 9600
I want to send specific binary data. I want to send 0b00110011 or something like that to it, not some character or a hex value.
question
linux
rant
serial
uart
usart