chipKIT® Development Platform

Inspired by Arduino™

Fast communication between PC and chipkit max ?

Created Mon, 03 Sep 2012 19:59:54 +0000 by educa


educa

Mon, 03 Sep 2012 19:59:54 +0000

Hi,

I would like to have very fast communication between the chipkit max and my pc.

With very fast I really mean the fastest possible. 2 mbits would be a nice start.

I have seen that the chipkit max has an FTDI232RQ onboard to simulate a serial port.

Any idea if this is the fastest way to connect?

On arduino you have a 64 byte serial buffer and that is quite small. Maybe on chipkit this is bigger?

Any idea/hints/tips on how to achieve the fastest possible connection with chipkit max from a pc ? WITH or WITHOUT a comport ? (I understand FTDI chips can also be directly spoken to over USB without having a comport? D2XX)

Kind regards,

Bart


majenko

Mon, 03 Sep 2012 23:33:40 +0000

"fast" is very subjective.

An ethernet card running at 10Mbps is "fast" in that the bits are sent rapidly. But, the processing and protocol overheads slow it down.

Serial is not as "fast", but due to the simplicity of it, it's more efficient.

The FT232 communicates with the computer at 12Mbps - full speed USB. It then communicates with the PIC32 chip at whatever baud rate you set it up for.

I'm not sure what the actual fastest baud rate the FT232 will support is, but from what I have read around 1Mbaud should be achievable. The PIC32 should be able to (theoretically) achieve anything up to about 5Mbaud, but that's only theoretical - who knows in practice?


EmbeddedMan

Tue, 04 Sep 2012 03:13:48 +0000

The first thing that comes to mind is the built-in USB. You can probably get 5-8Mbps using that route. Another option would be SPI - that can run up to 40MHz, which would be about 4Mbps or so. If you really want t to max it out, you could take the PMP (Parallel Master Port) and tie to to a high speed USB parallel chip (FTDI makes some). But the PIC32 is only good for around 80 MIPS, so 2Mbps means you only have about 40 instructions between each bit. With DMA and some buffering, I'm sure you can get faster I/O than 2Mbps, but 20 may be pushing it.

*Brian


educa

Tue, 04 Sep 2012 05:56:12 +0000

Embeddedman, I was allready trying to look in that way

Let me rephrase FAST in my case.

I am making a cnc controller and that controller must be fed with commands. I need to send these commands from a pc to a chipkit.

1 command is always around 6 bytes long

The maximum rate at which I will every read out these commands is 50000Hertz

But, that results in a speed of 300000 bytes per second and that is way to much for serial I guess.

Also, these 6 bytes are read out, then the pic32 does the stepper code and only after that it done it needs 6 new bytes, so it is not a steady stream of data. I need to get these 6 bytes extremely fast and then it takes minimum (20µS and maximum around 100ms before I need the next 6 bytes)

So I guess that I need a way to somehow burst send these bytes quickly.

1 Thing I looked at is the FT232H chip (which they sell a nice $20 breakout board for). This chip should be able to do some parallel speeds upto 40 megaBYTES / s

Of course that is way to fast for what I need, but the chip seems to have a way to establish a 8 bit SPI port and has an internal 1k buffer.

So I guess if I could work with that chip (still have to read alot) then I could somehow sacrifice 1 port on my max32 to establish a full 8 bits parallel connection and then send/receive bytes in a very fast way ? Maybe even not use the built in SPI functions (because I guess that is standard serial shifting in 1 bit at a time), but I guess that I can do it wirh direct port access and won't have to worry about the speed I toggle the bits in because that ftdi can go 40megabytes/s so thats faster then the pic32 could go (If I don't send signals in 1 single clock of course)

Any opinion on that possibility ?

Kind regards, Bart


rasmadrak

Thu, 06 Sep 2012 12:03:09 +0000

Most CNC routing I've looked at does a single instruction then reads the next. The drill also needs time to realign itself so if reading a single instruction every millisec or so should be quite sufficient - unless the board it is routing is actually moving simultaneously!


educa

Thu, 06 Sep 2012 13:07:44 +0000

Rasmadrak, it is a cnc laser cutter stepping at 50000 hertz steprates and meanwhile shooting pulses in the time of 0.1 to 3 milliseconds.

If I am moving at 50000 hertz steprate and then need to read 6 bytes, then speed does matter a lot


rasmadrak

Thu, 06 Sep 2012 16:01:38 +0000

Is there no way to slow it down?

I believe you would need to customize the hardware serial library otherwise, since there is a lot of error checking and what not. Depending on how much you trust your own data, you might get away without error checking (or precheck for errors) and simply toggle bits as fast as possible. That way you should be able to get at least 20-30 Mhz - which should be plenty.