View previous topic :: View next topic |
Author |
Message |
shine
Joined: 04 Jan 2008 Posts: 16
|
Posted: Fri Jul 01, 2011 4:51 pm Post subject: Need efficient communication between AVR and PC (maybe easy |
|
|
Hi!
I've developed some routines to drive led-matrix-displays using SPI. Please see the pic to get an idea of what I mean.
Now I want to implement some kind of fast and efficient communication protocol to feed the displays using my windows pc.
I have found some easy tcpi/ip twi module in my box, but don't know if it fits my needs. Would be nice if I could use this since it's very flexible and one only needs an ethernet wire.
Maybe rs232 is an option, but it is too slow to push tons of bytes in a fast way.
The current display contains 8.192 LED's to control (64x64x2 (R/G)).
It would be nice if someone give me some examples on how to implement this. And also is there a place where I can find this old easytcp.exe-program for windows? Do I need it anymore?
btw. The code uses two arrays dimensioned with 512 bytes for each color and implements some high-level methods to address each led by simply calling SetLED(x,y,c).
Thanks and regards
Jan |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Jul 01, 2011 9:05 pm Post subject: |
|
|
wow, lots of leds
Maybe usb is an option?
I would use usb, either using usb162 or other (depending on the amount of code) and implementing a hid device, or using an ftdi chip.
i think you can calculate how much data you must transfer? maybe rs232 is an option too. 1 Mbaud can be done. it is probably the most simple solution. _________________ Mark |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Sat Jul 02, 2011 2:09 am Post subject: |
|
|
As Mark Alberts already mentioned the FTDI chips, they also have ready made development modules that fit on a 24-pin dip socket (eliminates the making of a PC-board).
USB to serial (UM232R)l or USB to parallel (UM245R).
Website with all the datasheets: http://www.ftdichip.com/
The modules and chips are available at some electronic companies (other than FTDI too).
If you can do SSOP-28, then the chips are available at a fairly low price too.
The advantage is, that the drivers for your Windows virtual port are downloadable there and royalty free.
Hubert
edit P.S. you have a few dropouts or font problems in "a", "n" and "c". Very nice project! |
|
Back to top |
|
|
shine
Joined: 04 Jan 2008 Posts: 16
|
Posted: Sat Jul 02, 2011 2:26 pm Post subject: |
|
|
Hey guys,
thanks for your answers.
I just tried my old easy tcp/ip twi-module with udp-transmission but the "socketstat"-function to check if a byte is waiting is very slow so it "disturbs" my timer-routine to multiplex the leds. Any ideas on this?
I know the ftdi-chips but only as a simple usb-to-rs232 converter. You mean to connect a proper ftdi-usb-chip directly to the display without using bascom? Does this chip have an SPI-output?
btw. the "dropouts" are caused by the bouncing ball-routine which always deletes the previous ball-position no matter if it is in use. The text was drawn one time, not always in a loop so it get's overwritten. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sat Jul 02, 2011 7:47 pm Post subject: |
|
|
i do not know about the mux frequency but any other interrupt will 'interrupt' your timer isr.
for tcp, the module is interrupting when status changes, so there is nothing you can do about that.
while it is probably possible to use an ftdi chip alone with some additional hardware, i meant to use it as a uart.
the usb device lib i used to create a graphical usb display. that could work for your app too. _________________ Mark |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Sat Jul 02, 2011 8:37 pm Post subject: |
|
|
As much as I know there are no FTDI chips for USB to SPI.
If you have timing problems when there is an interrupt there is a solution I often use.
Instead of making the device a "SLAVE", make it a master and that way you can create your own window for communication or things that usually trigger an interrupt.
A little intermediate AVR between the PC and your display could be the solution. This way the PC as well as the display can be "MASTER"'
For example:
Either USB to serial TTL or direct serial to an AVR input.
Then store the received characters in a buffer (like FIFO) and use the data transfer as interrupt driven SPI slave.
The SPI (much faster than TTL serial) int. routine can take almost as much time as it would take to overwrite an incoming serial character. If you use a 20 MHz AVR or use a small ATXMEGA, then you can achieve quite high transfer rates. On SPI you can use 4x clock (5 MHz at 20 MHz MCU clock). If you have enough pins available you can also do parallel high speed transfer between AVRs without interrupts.
It also depends on the number of bytes that have to be moved at one time.
Like always, many roads lead to ROME.
Hubert |
|
Back to top |
|
|
shine
Joined: 04 Jan 2008 Posts: 16
|
Posted: Sun Jul 03, 2011 1:05 pm Post subject: |
|
|
Just found the UM232H-Module on the ftdi-website and ordered it. Take a look: http://www.ftdichip.com/Products/Modules/DevelopmentModules.htm
It is able to provide 12MBaud over RS232 and 30MBit/s SPI...That's very fast
And the best: There is a .NET-Wrapper available so I could interface my display's directly from my .net-program.
Will also try the UART-Mode with bascom.
Regards
Jan |
|
Back to top |
|
|
anatom
Joined: 06 Dec 2005 Posts: 93
|
Posted: Mon Nov 05, 2012 10:15 pm Post subject: |
|
|
Does anyone have some sampe code where FTDI chips were used for fast communication between PC and AVR (XMEGA)? |
|
Back to top |
|
|
|