I'm rather new to the Pi and Python and I could really use your help, so thanks in advance. My project goal is to transmit data, (a jpeg file for instance) from one Pi2 to another one asynchronously. Currently, I'm using the UART pins and a simple Python program, which it's main modulus are:
#initiating the serial port self.ser = serial.Serial( port='/dev/ttyUSB0', baudrate= int(self.baudRate), parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, rtscts=False, dsrdtr=False ) #writing data to the port f=open(self.filename, 'rb') data=f.read() data_length=str(len(data)) #writing the size of the file I wish to send data_length1=str(len(data_length)) size=data_length1+data_length self.ser.write(size) #writing the size of the file I wish to send for b in data: self.ser.write(b)) #reading data from the port file=open(self.filename, 'wb') first=int(self.ser.read(1)) file_l=int(self.ser.read(first)) # figuring the size of the file data=self.ser.read(1) for i in range (1,file_l): data+=self.ser.read(1) file.write(data)
The thing is that no matter how high I set the baud rate, I couldn’t get a writing rate of over 380Kbps. When I didn't use the "for" loop on the transmitter module, it seemed that the writing was indeed faster, but then the receiver couldn't read anything.
Any advice on how to reach a higher rate?