Shop OBEX P1 Docs P2 Docs Learn Events
Faster downloads — Parallax Forums

Faster downloads

Dr_AculaDr_Acula Posts: 5,484
edited 2012-02-25 17:14 in Propeller 1
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!

Comments

  • jmgjmg Posts: 15,183
    edited 2012-02-19 21:25
    Dr_Acula wrote: »
    Brainstorming here, is there a way to do faster downloads of programs?

    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/
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-02-22 04:28
    Thanks jmg.

    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
    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 ....?

    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!
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2012-02-22 05:50
    So... do you know of any premade USB to serial devices using those nifty chips? They look absolutely perfect.

    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.
  • JavalinJavalin Posts: 892
    edited 2012-02-22 11:17
    if the prop supported native usb it would be much quicker. but much more work for chip....
  • jmgjmg Posts: 15,183
    edited 2012-02-22 13:05
    Dr_Acula wrote: »
    Thanks jmg.

    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.

    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 )
  • pedwardpedward Posts: 1,642
    edited 2012-02-22 14:15
    I thought the standard chip the Prop uses is good for 1Mbaud? I seem to recall that's about the upper limit of the Prop's serial driver (not the bootloader, but fullduplexserial).
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-02-22 14:36
    Very interesting suggestions. Thanks++.

    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?
  • pedwardpedward Posts: 1,642
    edited 2012-02-22 17:07
    Methinks that the FTDI driver has the 920Kbaud option unlisted. I'm betting that some INF file or driver hacking will show up that option. I know 920Kbaud was the highest available on my Blackberry Bluetooth connection.
  • AribaAriba Posts: 2,690
    edited 2012-02-22 17:25
    Hanno uses the normal FT232RL with up to 2 MBaud for ViewPort, so it's really only a software issue.

    Andy
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-22 17:47
    FT232RL can run up to 3MBaud if driven by the D2xx or libftdi drivers. As a COM port, it's limited to 920KBaud.
  • jmgjmg Posts: 15,183
    edited 2012-02-22 19:21
    Dr_Acula wrote: »
    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?

    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.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-22 19:38
    Crazy idea: The FT2232H can be used in a parallel mode, even on a port configured as serial. Could you connect it to P22-P27, P30-31, boot the prop, download a small bootloader through serial, then load all of hub ram via parallel from said pin set?
  • jmgjmg Posts: 15,183
    edited 2012-02-22 22:52
    Crazy idea: The FT2232H can be used in a parallel mode, even on a port configured as serial.

    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....
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-23 01:35
    The datasheet is pretty comprehensive. It does take talking directly to it with the d2xx library, but it can actually act as a host for simple parallel mcu peripherals, or as an 8/16-bit fifo. I think it can act as an 8-bit fifo while still looking like a UART to software. Has both synchronous and asynchronous modes. I have no doubt it can go faster than the prop.
  • JavalinJavalin Posts: 892
    edited 2012-02-23 03:47
    I remember an early thread where Chip said the limitation of the programming was that its using an internal osc not the 5mhz (or whatever) external one. So its limited in its speed in "boot" or "programming" mode. Thus increasing the PC baud won't help.

    I think.

    James
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2012-02-23 06:53
    The same D2xxx driver is used for SPI mode with the 232H as is used for synchronous / asynchronous bit bang mode mode using the 232R/245M. There are articles out there that describe shifting data in and out over a parallel bus and the docs for the D2xxx are fairly comprehensive.

    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.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-02-23 14:03
    I remember an early thread where Chip said the limitation of the programming was that its using an internal osc not the 5mhz (or whatever) external one. So its limited in its speed in "boot" or "programming" mode. Thus increasing the PC baud won't help.

    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.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2012-02-23 14:43
    The link in my previous post contains some good references but unless you are registered you will be unable to download the VB source. Here is a copy for anyone interested.

    Jeff T
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-02-24 23:11
    Some more random thoughts.

    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?
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-02-25 09:49
    No. USB high speed requires a balanced 110 ohm transmission line to carry data that fast. A relay would severely interrupt those line conditions. What could be used would be, with an ft2232h, the "fast opto-isolated" data protocol at about 40Mbps to move 1MB in ~5 seconds, which would be faster than the SD card reader even showing up on the computer.

    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.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-02-25 17:14
    Drac: If you want to switch between the usb and sd why not try this...

    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.
Sign In or Register to comment.