I have a raspberry pi 3b+, and I am trying to communicated with a TPI synthesizer model 1001-B. I want to use Python and specifically the pyserial module to communicate with a serial port - i.e. the synthesizer, which is connected via USB to the raspberry pi. The synthesizer specifies some particular setting for the python code:
"Internally the communication USB port is connected to an FTDI chip that acts as a USB to UART translator. Therefore, the user’s program accesses the unit as if it was a COM port. The driver installed in the computer maps the computer’s USB port to a virtual COM port. The user’s program must set the COM port parameters to the following… • Baud rate: 3,000,000 (3 Mbit/sec) • Data bits: 8 • Stop bits: 1 • Parity: None • Handshake: Request to send"
The code I tried was:
import serial
ser = serial.Serial( port='/dev/ttyUSB0', baudrate=3000000, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS )
I then ran the following code, hoping to write to the device and enable user control on the device:
ser.write(chr(0xAA) + chr(0x55) + chr(0x00) + chr(0x02) + chr(0x08) + chr(0x01) + chr(0xF4))
I chose this particular set of strings because the user manual specified it. "The full packet including the header and checksum is… 0xAA, 0x55, 0x00, 0x02, 0x08, 0x01, 0xF4" where 0xAA, 0x55, 0x00, 0x02 is the header, 0x08, 0x01 is the body, and 0xF4 is the checksum.
When I did, the device did not write anything back. Any ideas? Can I use pyserial with Linux? Help!