Faster downloads
Dr_Acula
Posts: 5,484
Brainstorming here, is there a way to do faster downloads of programs?
For Spin and pasm this is not a problem as the program size is a maximum of 32k. But with programs in external memory (like C) the download time starts to become significant.
Ballpark figure, 115200 baud is about 10 kilobytes per second. So for a 500 kilobyte program, this starts to add up.
Ideas:
1) Download to an SD card. This is very fast, but there is lots of plugging and unplugging.
2) Talk directly with USB to the propeller. There is a long thread discussion on the forum about this, but I believe the PC sees the propeller as a serial device. This seems to limit the speed to that of serial ports, and indeed, throughput on that thread was around 6 - 8 kilobytes per second which is not much different to using a USB serial adapter. I don't know if it is possible to use a different driver and persuade the PC that the device connected is something like a USB drive, and whether this would speed up downloads? Has anyone done this sort of thing?
3) If #2 is not practical, I wonder if a USB to parallel adapter could be used? Only $5 on ebay. These seem to have speeds of around 2 megabytes per second. For a cheap and cheerful one way solution, 8 data lines and one control line = 9 pins. Toggle in bytes one at a time. Checksum data could go back to the download program via the serial port. I wonder how simple this could be? Maybe a couple of HC244 chips to isolate P0 to P8 on the propeller chip. Control the 244s with the data line of the eeprom as this is not used after bootup. Move the data either to ram or to an SD card or to both (do this under software control).
Brainstorming ideas would be most appreciated!
For Spin and pasm this is not a problem as the program size is a maximum of 32k. But with programs in external memory (like C) the download time starts to become significant.
Ballpark figure, 115200 baud is about 10 kilobytes per second. So for a 500 kilobyte program, this starts to add up.
Ideas:
1) Download to an SD card. This is very fast, but there is lots of plugging and unplugging.
2) Talk directly with USB to the propeller. There is a long thread discussion on the forum about this, but I believe the PC sees the propeller as a serial device. This seems to limit the speed to that of serial ports, and indeed, throughput on that thread was around 6 - 8 kilobytes per second which is not much different to using a USB serial adapter. I don't know if it is possible to use a different driver and persuade the PC that the device connected is something like a USB drive, and whether this would speed up downloads? Has anyone done this sort of thing?
3) If #2 is not practical, I wonder if a USB to parallel adapter could be used? Only $5 on ebay. These seem to have speeds of around 2 megabytes per second. For a cheap and cheerful one way solution, 8 data lines and one control line = 9 pins. Toggle in bytes one at a time. Checksum data could go back to the download program via the serial port. I wonder how simple this could be? Maybe a couple of HC244 chips to isolate P0 to P8 on the propeller chip. Control the 244s with the data line of the eeprom as this is not used after bootup. Move the data either to ram or to an SD card or to both (do this under software control).
Brainstorming ideas would be most appreciated!
Comments
Yes, you want something like a FT232H or FT2232H, which can do Serial to 12MBaud, and has SPI/FIFO/245 modes too.
8-40 MB/s, if that 12MBaud is still too slow..
Then the question becomes just how you want to talk with your Memory ?
Is it still slow i2c, or have you moved to SPI (or QuadSPI),given you are using large code now ....?
http://www.ftdichip.com/Products/ICs/FT232H.htm
http://www.ftdichip.com/Products/ICs/FT2232H.htm
There is also a Prolific device, PL-2303HX (revD), claims 12MBd, but the Baud choices are less, and the buffers are smaller, and it is not High Speed USB. - and not as easy to buy. - but should be cheaper. eBay suggests $1.19 ?
http://prolificusa.com/portfolio/pl2303hx-rev-d-usb-to-serial-bridge-controller/
Just to go off on a tangent, I have done some considerable research on USB to parallel devices, but it appears these are no longer supported. There is tantalizing code out there suggesting they are http://www-user.tu-chemnitz.de/~heha/bastelecke/Rund%20um%20den%20PC/USB2LPT/index.html.en, but the best they manage is to permanently disable the USB to Parallel port on that particular USB socket. No new LPT port appears - just a USB printing device in the USB section. There is also a myriad of differences between XP/Vista/Win7 and who knows about Linux so parallel ports probably are not going to work. Which is a pity because my older PC that I do all my work on has a real LPT port that works brilliantly for fast downloads that are much faster than 115200 serial.
The other little problem I have is that I can't solder SMDs. Without wanting to blow my own trumpet too much, I consider that I am quite good at soldering, but I also know my own limitations and I know how easy it is to solder a joint that looks good but is not. It is a matter of flux and getting the solder at the joint at the right time and not doing a dry joint that looks ok. Many times I pull on a wire that I am suspicious was not soldered right and find it comes loose. So I can certainly join a SMD to a board with some lovely looking soldering but I just don't have confidence in the joins.
So... do you know of any premade USB to serial devices using those nifty chips? They look absolutely perfect.
Addit: found a few up to 500 kilobits per second. Faster?
And in a general sort of way, given the extremely fast speeds of USB there seems no good reason why the serial side seems limited to 115200.
I've also been exploring the code side of USB. There are different codes for different devices, and code 08 I think emulates flash drives, so I wonder if the propeller could emulate a USB flash drive? The hardware side might only be a USB socket and three resistors, and the propeller may well be able to get up to megabits per second, even if it is only USB 1.0 standard. Certainly faster than a serial download.
re
The latest design is using two 512k sram chips in parallel using 16 bits, with a theoretical speed of around 4 pasm instructions to write one word, so ? 5 megawords or 10 megabytes per second. So it is a matter of getting data from the PC at a faster speed.
I'm going to take a risk and order a few USB to parallel cables on ebay by only looking at the ones that come with driver software. Maybe that might work?
There must be some way to get data into a propeller faster than 10 kilobytes per second!
FTDI have a couple of ready made 232H development tools and several examples of use with different programming tools including Visual Studio using their D2xxx library.
There is the UM232H module that will plug into a breadboard and there is the C232HM, a cable that breaks out the chips pins to connector wires.
I will probably buy the cable (and an additional test module) for myself it looks quite interesting, I've already used the D2xxx drivers with a 245M.
Jeff T.
FT245 through-hole module at DigiKey - $20
Besides the ones above, there is also UM232H (single chan ) @ $20, but it is was me, I'd take the extra channel for $2
The serial side is no longer limited to 115200, I've had FT2232H going all the way to 12Mbd, and it gets close to sustainable if you keep the packet sizes largish. It also has a fractional Baud generator.
I would avoid the parallel cable ones, as the drivers will all be different...
Besides, the FT2232H also has parallel modes, so if serial is too slow, you can move to parallel
4MBd would seem a crystal compatible target ? Higher might be possible ? (especially with slight overclocking at 96MHz, which better matches the Baud choices )
Re the speed, yes the prop can go faster than 115200. Good point. Maybe therefore it is the driver on the PC side that is the problem? You open up some drivers eg in .net, or even at the system level in the Device Manager and the allowed settings seem to max out at 115200. So perhaps it is not a hardware problem at all??
@jmg, what software were you using on the PC side when you had the chip running at 12mbaud?
Andy
Too many pgms list a choice of Bauds and do NOT pass a user BAUD number to the driver....
I was using std openCom, in FreePascal + Synaser Lib, and that does pass the full Baud value, and the 'invisible' FTDI drivers allow any fractional baud, the chip supports.
(it actually snaps to the nearest Numeric Baud), and to check BAUD, I send blocks of 55H, and use a frequency counter.
That nails it down to a few ppm.
That makes sure what I thought was their formula, and what it does, are actually the same.
From memory the FT2232H is a 120MHz/10*(N+R/8) where R is 0..7 (the fractional part) & I think fractional applies < 6MHz
This fine control can be used to margin serial port designs.
Got any links on how to do that ?
The benefit of a serial approach, is it works faster where the good silicon is available, but also works when even the most basic comms setup is all you have....
I think.
James
Though it is by no stretch of the imagination a complete project I did post a VS VB source that implemented bit bang mode just using the 232 that is attached to most propeller platforms giving you the opportunity to test it out using the equipment you already have.
The post was at the following link http://www.savagecircuits.com/forums/showthread.php?291-Getting-Control-of-the-VCP
Jeff T.
True, but what you can do is have a small program in eeprom that then sets up serial comms using one of the standard objects, and those do run based on the xtal.
Some fascinating ideas coming out of this discussion.
Jeff T
USB to an SD card is very fast, and the little adaptors are only a few dollars. Can the switchover be automated instead of plugging and unplugging the SD card every time?
Possibly this can be done with chips, but at the moment I am thinking relays.
Three relays to switch the USB - power and two data. That replicates plugging in a USB cable. The PC uses the current drain on a USB port to start the initiation process.
Next - another group of relays to switch the SD card between the USB adaptor and the propeller. Power and 4 data. Possibly a 74HC157 can replicate that, though one needs to think about power going into pins when the chip is unpowered.
Then a controller chip. Maybe something simple like a picaxe. Chip monitors the propeller eeprom line. If it detects rapid changes in pulses, that is a startup, so swich the SD over to the propeller.
Need a downloader program running on the prop - Kyedos or something. Send a download command via the serial port. Kyedos interprets that and toggles the eeprom data line at a certain speed. Speed x = switch to USB, speed y = switch to propeller.
So from the users perspective, you might be coding in a C program, hit download, relay clicks, SD card is recognised within a few seconds by the PC as drive E (or whatever), copy large megabyte file to this drive (very quick, only a few secs), send a tiny command via serial port to switch the SD over, relay clicks again, then another tiny command to say "run program x that is on the SD card" and it runs.
Would this work?
Another option would be to use a large EEPROM and to connect the ft2232H to the i2c lines and download the program straight. Pull the prop reset line low for the duration of the programming cycle, and you're good.
Buy a usb to microSD socket (small and cheap on ebay because they are not gold connectors) ~$1
Wire the microsd socket section to a mux chip, other side to microSD socket (the common), third to the prop.
Then you can switch between them as you please.