Painfully slow WiFi on my board (sub BT speed - 700KiB/s)

  • I have a painfully slow file transfer speed on my new Duet board. Speed is almost always around 700 kilobytes per second, which is on par with 1990s and even bluetooth is 5 times faster nowadays. Is there anything wrong with my new duet or was it designed this way? Modern WiFi should be 50-100 times faster, or am I missing anything here? It becomes very noticeable on loading complex gcodes, where I have to wait over 2 minutes to just have that transferred. Seems like unreasonably low performance for a price range of this board. What speeds are you guys getting from yours?

  • How are you getting the speed value?

    I usually get reported speeds of 20-60 MiB/s, however I just uploaded a 10MB file and it took 25s to complete, after reporting 100% complete for a while and hanging there. This is with a print running which may affect how fast the data is written to internal SD.

    There are recommendations for cluster size on the sd card which may affect upload speed. See here:

    Uploaded a 20MB file and it took 50s with printer idle so fairly consistent results. The reported upload speed of 70MiB/s seems to have little to do with the actual transfer speed in my case.

    You can also run a M122 command to see if the longest block write time is excessively slow.

  • administrators

    The speed of upload to the SD card depends on several factors:

    1. Speed at which the Duet can write to the SD card. Unfortunately the duet does not have a large RAM buffer available, so this is not as fast as we would like. It depends on the SD card and the cluster size that it is formatted with. In firmware 2.02 and later you can test the SD card write speed by sending M122 P104 Snn where nn is the test file size in Mbytes, default 10. It is typically around 1.5Mbytes/second, and a little slower on the Duet Maestro than on the Duet WiFi/Ethernet.

    2. The speed of the SPI interface between the ESP8266 and the Duet main processor. This runs at 26.7MHz (the fastest speed that we can run it at without getting occasional underruns). So that's around 3Mbytes/sec.

    3. The speed of the WiFi connection to your router. This depends on the signal strength. The theoretical maximum speed with a strong signal is 72.2Mbytes/sec. But not all the bits sent are useful data because there is quite lot of protocol overhead, so in practice it's somewhat less than that.

    All told, with a strong WiFi signal and a good SD card, I think more 1Mbyte/sec should be achievable in theory. I normally get 800kbytes/sec. I have more firmware work planned to try to achieve higher speeds more consistently.

  • 650Kb/s on average here.

  • Yeah, extremely slow in fact. My son had a 13in HP laptop for $180 it had normal WiFi there lol. But thanks for clarification. I love the fact that I can transfer directly from my PC, this also allows for cloud development in future, but speeds are less than ideal at this moment, to say the least. I actually was really hoping there is something wrong with my settings, but oh well. Looks like the first limitation/bottleneck is #2 from David's list.

  • @vlad you old laptop has probably many megabytes of RAM or even a few gigabytes.
    DuetWifi have only 128 kilobytes of RAM, this is not just the same type of CPU. It is well suited for realtime tasks (like 3D printing) but doing fast data transfer it is weak spot. 700 kilobytes per second are quite good speed on such processor.

  • @dragonn The point was that: 1) laptop was new 2) it cost $180, same as duet 😉 For a note, I just tested with a high speed sd card, formatted with 64 sectors, that does nothing, still same 720kbyte speeds. It is interface limitation indeed. Coming from memory business, how much extra could really extra ram cost on such board. It is usually in cents. Or is there a limitation on CPU to support more ram?

  • @vlad RAM isn't the only limitation, as dc42 mentioned, there are others like SPI bus speeds.

    Comparing a mass produced consumer laptop to a (relatively) low volume multi axis realtime motion controller is like comparing, how'd you put it? Roaches to apples? They're two very different devices, with different limitations. Lets see you hook up 5 steppers and 3 heaters directly to that laptop 🙂

  • @elmoret haha, fair enough. Mass production is definitely cheaper, if that laptop was done by duet3d it would cost $3000 at least. Duet clones are $70 by the way, also not mass produced. So my understanding was that with such price it should at least have those faster speeds. I always support development, so I keep buying from Duet3D directly, don't mind that. I am just used to pushing all my products to a limit. So I am wondering what exactly is holding duet3d from going after faster processing and more bandwidth bus. Since, it seems to me that budget should allow it.

  • Duet clones don't have warranties, they don't support development, and often compromises are made on things like copper thickness in the PCB.

    What is holding Duet3D back from going after faster processing?

    1.) The development team is small. What you are proposing would require a whole new architecture. This happening with Duet 3, but it takes time to produce a brand new design from scratch, while also supporting requests for existing generation hardware.

    2.) The types of processors that are used in realtime motion control generally do not have large amounts of RAM. The solution to this in most cases is to have two different processors, one for realtime motion control, and one for high bandwidth, non-realtime tasks. But this approach increases complexity and cost.

    What microcontroller would you propose the Duet team use?

  • Are you using Kingston SD cards? Those are notoriously bad.

    Multiple block write SD card command stops because the card is busy way too often and writing constant 192 kB/s is impossible without big write buffer from small MCU. Burst speeds can be higher.

    Sandisk, Transend and Lexar work much better and bigger and faster are doing their cleanups with much saner way.

  • @vuokko I used cards all the way up to U3 by sandisk, which are extremely fast, duet will be slower than your slowest card anyways, that is not what bottleneck is. I think as David mentioned in his #2 reason, it's architecture limitation which we will have to live with for now.

    @elmoret I am not experienced enough in microcontrollers yet to suggest anything to duet3d team, I am simply asking questions out of curiosity.

  • administrators

    @vlad, yes it's essentially an architecture limitation i.e. lack of a large RAM buffer, and to a lesser extent the use of SPI to transfer the data from the WiFi module. I have just tested the SD card write speed on the Duet WiFi on my bench using M122 P104, and I get speeds of about 1.6Mbytes/sec all the way up to 200Mbyte files. This is with a Kingston Memory 8Gb Class 4 card. I don't think we will do much better that that using the current 8kb write buffer. The problem is, once the card sees the end of the 8kb block write, it may start to do internal wear levelling operations, and those take time.

    I am also minded to add another M105 subfunction that tests the speed of uploading a file but discards the data instead of writing it to file. This would help users who are getting slower than expected uploads to determine whether the SD card or the WiFi network is the bottleneck.

    We recognise that users want faster upload speeds, and we have addressed that in Duet 3. However, by better overlapping transfers from the WiFi or Ethernet module with transfers to the SD card, I am hopeful that in as future Duet 2 firmware release we can achieve more than 1Mbyte/sec consistently, assuming a good WiFi connection.

Log in to reply