0

I was wondering how I could send a byte array of 16 or more bytes from the pi to a computer, where the computer would receive it via USB. Could UART send a byte array of this length? If yes, how can I arrange them? I have sent them over via wifi, using sockets on python, now I need to send them over USB, as it is faster and more reliable. Thanks! NB: I am using Raspberry Pi3, model B.

  • Does it have to be pure USB, or an USB/Serial adapter would work too? Because this is the easiest way. – Radu Jan 22 '18 at 16:58
  • USB on the PC end is a must, I am allowed to be flexible on the other side. – rpi350 Jan 22 '18 at 17:01
  • It's a must to use the USB stack on the PC, or what? – Radu Jan 22 '18 at 17:06
  • I have to use a USB cable on the PC side. – rpi350 Jan 22 '18 at 17:23
  • So then do what I said, get an USB/serial adapter. They are pretty cheap. – Radu Jan 22 '18 at 19:11
0

Yes you can.

Use a USB serial dongle. One end will be USB to plug into a USB port. The other end should be pins to connect with wires to the Pi's TXD, RXD, and ground pins. Make sure the dongle works with 3V3 TTL (i.e. can talk to the Pi GPIO).

The device will be seen as a serial device at the PC and Pi ends.

  • Thanks, but how exactly do I arrange a 16 byte array in UART? As far as I understand, UART only sends 8 bits of information. – rpi350 Jan 22 '18 at 18:08
  • Linux uses a function called write (man 2 write) to send data to a device. You specify the number of bytes to write. – joan Jan 22 '18 at 18:12

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.