Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Measuring Arduino's FT232 throughput rate ? on: October 07, 2010, 08:07:54 am
I found bottle and neck than found bottleneck  smiley-grin
I realized that my CPU fully consumed when I measuring data at 2Mbit with pySerial library. I use python because it allows super fast development speed. I tried with 9600 baud and see that my cpu is not using at all. Than I suspected about python's serial library performance.... I wrote new code at C++ and program gives me a clear 200KB/s. So controller supports it. Now set the point to 2,5 MB/s on async but it looks like communication capped at at 2Mbps exactly. I think that chip support higher baud rates on async but I am suspecting from Linux kernel drivers due capped speed.( got "ttyUSB1: 1 input overrun(s)" at kernel log )

Also I posted a message here and author says that he got 300KB/s with synchronous mode hack...

Thanks everyone for helps.

[edit]Yeah I am sorry for suing pySerial library and python. It's my programming fault due reading one byte per time. Reading 64 byte for each read call fix the issue on python. Thanks.[/edit]
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: Measuring Arduino's FT232 throughput rate ? on: October 06, 2010, 09:38:04 pm
I don't know actually but even pic18 family with USB port could give enough bandwidth for communication. But that is not the point, if I want to have good Oscilloscope, i can buy it. But It is better to make it with already available HW. Also I love poormans gadgets and trying to make one...

Since chips are supporting (claim), I wanted to have 3Mbaud speed but it's looks like no quite possible. Anyway. Might try some more and break later smiley Thanks.
3  Forum 2005-2010 (read only) / Syntax & Programs / Re: Measuring Arduino's FT232 throughput rate ? on: October 06, 2010, 08:26:06 pm
I don't know why datasheet says support up to 78kbps... On my setup, it gives to me ~100 kbps when I set ADPS[2-0] register with 0x3 setting. And It needed to give me ~200 when I use 0x2 pre-scaler). And it looks ok while I am inspecting 31.25 khz PWM signal, gives 6 sample for one wave. And interpretation of those numbers are in this screenshoot:


So this might means Atmel doesn't support it officially but chip could able to gives this data. It might be not reliable, but working.

About FTDI232R, I hoped that chip support synchronized mode. But synchronized mode is possible just for bit-banging as I understand from your message. Sad situation, needed to test windows drivers, they *might* give different performance than linux...

THanks

Edit:
Guess what happened... In windows it gives 40KB/s. Yes. I don't know where is the problem on Windows Drivers or Python implementation which I make benchmark. But It's really low performance... So I count that I cannot make proper test on windows.
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Measuring Arduino's FT232 throughput rate ? on: October 05, 2010, 06:13:04 pm
Firstly I don't use Windows, Using vanilla linux kernel 2.6.36-rc4 so I don't think if there is a problem with drivers. But it will be good to try on windows too to see difference.

3 Mbps is too high to claim, specially if your chip is capped @ 1,5Mbps. If chip doesn't support this speed, they can't easily write this to datasheet just for "marketing" because this probably will end of the front of the judge... I am suspicious on this. Datasheet says that chip supports up to 1Mbps for RS232 mode and 3Mbps for TTL levels. Is there any possibility about if my FTDI chip set with RS232 mode instead of TTL by factory? This might be the reason of capped speed.

I inspected FTDI 232R datasheet here and it says synchronized mode is supported by the chip.
Also found another forum thread here that claiming 3 Mbps with Arduino Duemilanove via use of synchronous mode with small hack, needed to try this if it's working or not...

Quote
Quote
sampling about 22Kbps but capped at 16Kpss due serial bottleneck
Wait.  Explain why you think you need 2Mbps to communicate 200kbps worth of data?  (22k samples/s *10 bits, right?)
Opps, My eXplenation is, actually I am sampling @ ~220K, not 22K smiley and using just 8 bit for per sample (I don't need high precision but speed) so even 2Mbps will not enough but better than this situation.

Thanks for the hints.
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: Measuring Arduino's FT232 throughput rate ? on: October 04, 2010, 10:27:10 am
I thought he is talking about RX of arduino chip, not RX of PC...
And if it's cannot work ~2Mbps why controller supports up to 3 Mbps? Is it for synchronized mode? Does arduino deumilanove supports that mode? Or why doesn't it support that mode by default? I don't wanted to use Ethernet shield due cost of it. I am trying to build DIY Oscilloscope project (yes another one  ;D), sampling about 22Kbps but capped at 16Kpss due serial bottleneck  :-/
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: Measuring Arduino's FT232 throughput rate ? on: October 03, 2010, 07:44:44 pm
Hi, thanks for the great work smd, but here it doesn't work.
I can communicate arduino duemilanove to PC (linux) at ~168000 B/s nothing more. I use same code at 4.th message, first code, at this topic. There is no gain between SerialWrite() and this.

I measure bandwidth with custom python script because of your shell script couldn't work here. I guess it doesn't affect the results.

Code:
import serial,time
ser = serial.Serial()
ser.baudrate=2000000
ser.port="/dev/ttyUSB0"
ser.open()
def speedtest():
 tm = 0
 x = 0
 while(1):
  if( tm != int(time.time())):
   print x
   tm = int(time.time())
   x=0
  tmp=ser.read()
  x=x+1

speedtest()
ser.close()

I am using Arduino 0019 version on OpenSUSE 11.3 x64 on 4x 2.6 ghz Phenom2 & 4GB Ram and I really need 2Mbaud (and if possible 2,5Mbaud too) Thanks.
7  Forum 2005-2010 (read only) / Development / Re: GLCDcmd : GLCD libraries BackPack class on: September 12, 2010, 05:22:42 pm
On Backpack device, I use GLCDslave firmware at examples folder. That program implements all required functions for slave device via GLCD Library v3 Beta (you needed to have glcd v3 beta installed on your arduino too and you needed to patch Wire library bug 335 for proper slave device. You could simply change Wire files that provided with the GLCDcmd library )...

On master device, you just need GLCDcmd library installed on your arduino IDE. (No GLCD library needed!). You can use GLCDcmd library as a original "glcd" library. No difference on API side. I only add some extra functions like SetBacklight() and PulseBacklight() functions to control backlight led, driven by a PWM pin of slave device, nothing more...

All data prepare & sending function buried in the class. So you don't need to touch any Wire protocols on master device code... For example open glcd library example "GLCDdemo" and change
#include <glcd.h>
line with
#include <GLCDcmd.h>
and compile it. Your device will draw same graphics via i2c port on backpack device. That's all.
8  Forum 2005-2010 (read only) / Development / Re: GLCDcmd : GLCD libraries BackPack class on: September 11, 2010, 04:15:31 pm
Yes but it's less than "arduino". Just ATmega168 chip with 20Mhz xtal. Also a button for reset device, a variable resistor for brightness control, a resistor for led back light, and cap for the stability. Total budget is nearly ~$5.
9  Forum 2005-2010 (read only) / Development / GLCDcmd : GLCD libraries BackPack class on: September 11, 2010, 07:17:38 am
Hi, I made a Fast GLCD backpack device for myself and wanted to share with community.

Compatibility:
It's fully compatible with GLCD v3 Library. No code porting required for run current applications. Just change glcd header will do the job.
Use
#include <GLCDcmd.h>
instead of
#include <glcd.h>

Communication
Currently only I2C protocol implemented.
Power and communication requires 4 wire to GLCD backpack device.

Wire library is available in the GLCDcmd package because arduino's
wire library is defected. It doesn't allow clock skewing. It is needed for GLCDSlave code other wise you can drop some of your packets.
Package has alternative Wire and twi files, needed to be replaced with arduino ones when you are compiling slave devices firmware.Master device doesn't require the patch since it's slave controlled mechanism so your device will work on any Arduino has un-patched Wire library.

Soon, I wanted to support Serial interface.
And thinking about to support one wire connection. But this requires OneWire slave code for arduino which is not available yet AFAIK...

Speed:
It runs just %8 slower than native GLCD library as a overhead.
I use 20Mhz xtal for Slave device. It works faster and reduces the overhead.

Via GLCDcmd class, I2C connection : 13.88 fps
Via Native GLCD Library on arduino : 15.08 fps
So Only 1.2 fps difference.

I believe you will have faster times with speedy GLCDs. Since slave running on 20Mhz.

Size:
Slave device requires ~18Kb if you put all fonts in it that comes with GLCD library. But you can use ATmega168 too if you crop some fonts.

Limitations:
Only known limitation is that you cannot use fonts that stored at Master device. Library doesn't allow any font upload to slave device now.

Pictures:


Here is the GLCDcmd library.
Download

Special thanks to user mem for helps.
10  Forum 2005-2010 (read only) / Development / Re: KS0108 GLCD on I2C on: September 11, 2010, 07:20:03 am
I released the sources at this thread.

Thanks for help. smiley
11  Forum 2005-2010 (read only) / Development / Re: KS0108 GLCD on I2C on: September 04, 2010, 06:39:53 am
Oh thanks for pointing arduinos Print class. I look deeper and see that glcd_Device already uses it. So I add inherited Print class to gTextcmd directly and overwrite the write(c) function as PutChar(c) does the job well, cleans the code fix some other issues smiley
Now just ">>", stream support and return values of some functions are missing now. And after library is ready for heavy test from the public smiley Thanks for supports.    8-)

Completed. Just cleaning code. smiley
12  Forum 2005-2010 (read only) / Development / Re: KS0108 GLCD on I2C on: September 03, 2010, 04:04:52 am
Hi, can you talk about how can I handle "print" and "<<" stuff? Every other things looks working properly now (I needed to implement funtions return values also but I think it's easy part...) and I wanted to complete this sub-project. "BigDemo" shows correctly except prints and "<<". GLCDDiags fails because it requires low level things like chip selection.I assume users will not require such functions. smiley.

I think it's not good way to handle "prints" within multiple overload of "print" and "println" function on gTextcmd class. I also look end of gText.cpp file but I don't understand... Could you help? Thanks
13  Forum 2005-2010 (read only) / Development / Re: KS0108 GLCD on I2C on: September 01, 2010, 08:56:07 pm
I know but problem is identifying which gText object used by user at master device. You cannot know which object used it with only function name... So you needed to send gText object ID to slave on every text related command... Now I created gTextcmd class and moved text related function to it from GLCDcmd class. This will handle text related functions and will add a ID to each object that I create at master. On slave, I can create and remove gText objects on the fly with this ID. This requires change on some of Text commands structure...  :-/ I am happy since there is no documentation to change smiley
I also don't work on return from slave device. So functions that require return don't implemented yet. I wish competed the job on weekend. smiley-grin

Edit: It looks like Arduino doesn't support new and delete command. smiley-sad Couldn't I create new class instance with code? I looks like I needed to define them at beginning. Seven of them is enough for everyone I guess...

Edit2: New problem. When defining new gText areas, we cannot send messages to slave device via Wire interface to tell gText object created.  There is no problem if you make definitions in loop function. But you cannot define gText's before setup as I understand...

It's not problem if we don't have initialization arguments, since we don't needed to tell slave device to create one(since 6 of them created already). But some of gText constructors has parameters. They must be set also... I don't understand why Wire interface doesn't sent the messages. Is it because "setup" function not called yet? But Serial library works here!
I also called Wire.begin() from Constructor function of gTextcmd but master device emits nothing.  >smiley-sad

I inspected deeply and detected that Wire.endTransmission() function does not returning... Any idea to fix this or work around?

Edit 3: I used work around to fix problem. Just storing constructor commands of gText's on preSend buffer if GLCD not initialized. When GLCD initializing, I send this commands from buffer to slave. So it looks working now. I don't run whole GLCD demo, just pieces of it. But will test more pieces of it...

Edit 4:I put some other test. And see that just textArea gives errors I don't know why. There is some bad code, I don't implement << and printf's on correct way. Just convert them to the "puts" commands. Try to understand how could I put << and printf support to my derived class... Any help will be appreciated.
14  Forum 2005-2010 (read only) / Development / Re: KS0108 GLCD on I2C on: August 31, 2010, 09:22:32 pm
Started Master's code. Handled all other problems but gText.
Currently I see 13.79 fps on 20Mhz slave device for GLCDdemo drawings from master smiley which is good enough...

I am not sure how to handle gText commands and definitions. There is no problems if users doesn't create another instance of gText. But users could also define gText area in their programs. Not sure about how to handle this...

I wanted to have transparent library layer for glcd. If user wanted to port it's code to serial library, just change of library name and addition of device address is needed to enough for the port.
15  Forum 2005-2010 (read only) / Development / Re: KS0108 GLCD on I2C on: August 27, 2010, 12:53:01 am
Hi again.
I have start to coding slave and see something missing in Special chars function... It has only '\n' support. How about to add '\b' and '\r' chars?
'\b'ackspace and carriage '\r'eturn are useful chars if you counting something and it's better/speedy than using some high level functions.
Wait a minute I can't see '\t'ab character support also  :o

I skipping functions that require PGM_P ( like Puts_P ) since we don't have such strings in slave device program memory. But we needed to support them in master device. Right? Is PGM_P str is compatible with char* ? Or do I needed to convert it? I don't play them before. I wish I could convert them easily when I writing masters code.

SelectFont functions make me thinking... I use enumerations for selecting fonts that stored locally and see that there is no memory for including all fonts 16796 bytes but 14336 allowed!).
If we remove arduino bootloader from slave (arduino don't required for such a device I think) We got some bytes > 1K.  And removal of heartbeat function (I usually wanted to have heartbeat on MCUs. smiley ) and serial library, It's fits in the device. But I don't implement drawbitmap function also. Might be use function pointers to get some space also, But  we needed to remove some of the fonts again i think. Also serial library or OneWire (that I wanted to see it) will require more bytes.
So atmega328 chip is required for including everything, but we needed to remove some fonts from atmega168 targets. Which fonts are we will crop by default? Which ones are used mostly?(I don't know really) I will place font header includes to top of slave code so user could uncomment which one they needed to use. But I want to hear font list from you that from important to petty one...

Could we transfer new fonts from master to slave RAM before using? On atmega168, there is no RAM such fonts like Arial14.(Currently 711 bytes available on) And storing fontset to flash on demand will degrade flash on MCU with time or with missuses... If we use atmega328, it's ram is could used such a purpose but we could also store all fonts into flash! smiley-grin

I don't know how could we handle gText things!!! I import DrawArea functions to slave. But I think we needed to create some instances of gText on slave to play with it, right? What do you think about it?

Also DrawBitmap function make me thinking. Because wire library code allows you up to 32 byte to transmit continuously.  If you send 33.rd one, It will discarded. I needed to divide data to 32 bytes before send and needed to write it to screen directly since there is not enough RAM for frame buffer. Also images are stored in the PGM data. I think I needed to rewrite DrawBitmap code for the master and the slave. I think it will be fun to code DrawBitmap smiley

What do you think about those functions and do you have some advice about implementations of them?
Regards,
Erdem
Pages: [1] 2 3