Is all about speed…

Using 24 Mhz crystal will affect the speed, too many communication errors and maximum speed I can achieve is 230,400 bauds which is not really enough for a decent streaming. Changed the crystal to 22.1184 Mhz and now I can get 921,600 bauds with no errors, allowing me to stream 2 RGB444 frames per second and an “outstanding” 5 fps B&W 4 bits per pixel (128 x 120), all this is using an Atmega16 microcontroller.

I just managed to buy a pair of Atmega1284P chips today and got one of them installed on a prototype board, did some small changes in the code and got it up and running @ 921,600 bauds without issues. Will continue to work on my code and hope to get the first demo soon. So far, can do tracking at 15 fps in pooling mode (host initiate tracking within a frame), however, will implement a full speed mode, that will allow continuos tracking at higher speed, targeting 30 fps.


10 thoughts on “Is all about speed…

  1. How are you able to get serial to go so fast. I can only get 0.5mbaud I tried the next level up 1mbaud (I am using an arduino which is clocked at 16mhz) and I keep missing some bytes even though my program is well optimized. Without the serial reads it draws a simulated image at over 100FPS.

    • Hi there, if you want higher speed you should consider ditching the 16 Mhz crystal and go for 22.1148 Mhz or a frequency that allows you generate standard serial speed. As far as i know, linux is more particular on baudrate, may not accept non standard speed (e.g.: 500.000 bps, 1.000.000 bps, etc) but will work fine with standard ones (e.g.: 115.200, 230.400, 460.800, 921.600 bps).

      This will create issues with your bootloader. Another option is to use windows, then can use your arduino with the 16 Mhz crystal and 1 Mbps…

    • 100 fps? Really? Not sure how you do that, maybe willing to share with us how you do it? Using my math even streaming 4 bits per pixel @ 160 x 120 with 30 fps it requires: 288 K bytes or a baudrate of 2.3 Mbps… Considering the fact that you are using 16 Mhz crystal, using the baudrate calculator formula you can only get 1 Mbps baudrate, so if you MCU is only doing streaming (!!!) can only do a max of 13 fps wit 4 bits per pixel…

      Please share with us how you manage to get such framerate with an Arduino, i’m really very interested to hear it!

      • No I did not get 100FPS from the arduino I just saying that the reason that I am missing bytes is NOT because of me not reading from the serial port fast enough. If I replace the code that reads the serial port with a function that just returns a random value I get 100FPS so I know that there is another cause of me missing bytes. Maybe the kernel is missing interrupts? Although in theory it may be possible to have the arduino do a fast compression algorithm I think I will try that out today.

      • May be the way you are reading the data from the serial port. Are you sure that your code detect “init frame” and “end frame” properly? To avoid this issues you may want to consider creating a “protocol” that will handle start/end frame and maybe even start/end line. This will allow you to ditch lines that have missing pixels and reconstruct the image correctly.

        Other solution is to have your code on the client to initiate the streaming of the frame, so you’ll always know when frame start and the length of the frame.

        Anyway, is all in the way you write your serial port communication, as you know, your UART have actually a hardware buffer, so chances to loose a byte is pretty small.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s