Slow Serial Communication

I’m trying to communicate with an Arduino Mega from a BeagleBone using Serial communication (The Arduino is plugged straight into the Beaglebone)

I’m sending coordinates from the BeagleBone to the Arduino Mega which in turn sends it to a LCD screen which draws a pixel to that position. This all works, the problem is the speed. It is drawing roughly 3 pixels per second.

If I just run a program on the Arduino itself to fill the screen pixel by pixel it fills the whole screen in 3 seconds.
(The screen is NHD-240128WG-AFTI-VZ#C5 datasheet: http://www.newhavendisplay.com/specs/NHD-240128WG-AFTI-VZ-C5.pdf)

At first I thought there might be something wrong the the software I was using on the Beaglebone. I was running a php script to communicate over the serial port, so I switched to python.
Here is the python script:

`

import serial
import time

ser = serial.Serial(’/dev/ttyACM0’, 9600)
ser.write(chr(241))

for x in range(0,10):
for y in range(0, 10):
ser.write(chr(x))
ser.write(chr(y))
print x
print y
time.sleep(0.0002)

`

import serial refers to pyserial: http://pyserial.sourceforge.net/
This script results in nothing on the screen (I have to turn the time.sleep() up to 1+ seconds before I can see something) whereas when I run the exact same screen with the Arduino plugged into my computer this writes pixels rather fast.

I’ve read that a possible solution might be to use a USB hub between the Arduino and the BB, why is this needed for the external power source? Would it then also be a viable option to just power the Arduino with an external powersource? (so the usb connection is solely used to communication?)

Thanks.

I slept on it, came back and now it seems to be working flawlessly… Might have just been that the usb cable was a bit loose?