2

I am using a few Picos (connected together via I2C -- but I will switch soon to SPI) as a single USB peripheral connected to a computer and they are working ok. The computer obviously sees only one of the Picos, the one which coordinates with the others on what they need to do.

In one operating mode (just for debugging/calibrating), I would like to capture all the data from the Pico's ADC running at full throttle, which is 500kSample/s at 12bit. With some overhead I have in the protocol, it turns out I'd need several MB/s (note the capital B for bytes, not bits). Unfortunately, the Pico supports at most 12 Mb/s (lowercase b for bits), which is about an order of magnitude less than I need. For everything else I need to do, this bandwidth is adequate, it's just in this debugging/calibrating mode that I have this problem, so I'm asking for advice.

Here are possible solutions I thought:

  • Reduce the protocol overhead, reduce the bit depth to 8-bit (no big loss since it's about 9ENOB anyway) and add compression. On paper it should be enough, but it is a close call. Potentially lots of work to change the protocol and implement compression, and it may be a dead end, e.g. if the CPU can't keep up compressing data at that throughput, and/or if the compression rate is inadequate. It has the advantage that I could use the same connection I am using for the regular transmission, and no other hardware is needed (two pluses, but not really requirements)
  • Use the SPI interface for this purpose, since at 62.5 Mbps it should have enough bandwidth. I will need an external board to connect to the computer. Not a big deal if such a board exists, is inexpensive, support the desired throughput to the computer, and works out of the box. Does it? I have seen some, but I have not found easy information about them.
  • Store the data and transfer it (later) at available speed. Fine for my needs and easy-peasy, if it weren't that the Pico has only 264kB of memory, and I'd need at least an order of magnitude more, perhaps two. Is there any memory module that is compatible with the Pico, use a fast-enough interface (hence no I2C, which I believe is too slow on the Pico for this throughput) and not too expensive? I haven't seen any, but perhaps I have not searched the right way.
  • Use a Zero W or a Pi 3+ or a Pi 4 B which can act as either of the previous two and do much more, e.g. freeing the main Pico from having to be the USB peripheral (Pi 3+ cannot do that but the 4 and the Zero can). Nice solution, a bit expensive (besides the Zero if found at list price) and hard to achieve now since all of these boards are out of stock, most not even available for backorder, and can be found only at considerable price gouging.

Any other option that I missed? Other ideas or suggestions?

2
  • Sounds like a fishing trip. Ot least one of you assumptions "as a single USB peripheral connected to a computer" is false
    – Milliways
    Jan 29, 2022 at 1:31
  • @Milliways this is what I have now. I am ok to connect it with another route if that's the way to achieve my goal.
    – Davide
    Jan 30, 2022 at 0:47

2 Answers 2

1

Here is what I achieved so far.

With https://github.com/davidedelvento/no-OS-FatFS-SD-SPI-RPi-Pico I have been able to store the data in a SD card at rates between 500 and 700 KiB/s which is almost perfect (I can use a little bit more but it's good enough).

With https://github.com/davidedelvento/pico-webserver I have been able to achieve around 100 KiB/s directly to the host computer, which is insufficient for my needs, but being more convenient it might be good enough for some of you out there.

1
  • In the old days, Eye-FI SD-cards were tiny computers that could upload photos over wifi which may be adaptable to your needs. These days Toshiba FlashAir apparently has similar functionality. Jan 22 at 11:54
1

SPI Slave over USB

You could get yourself an FT4222H chip that acts as an USB device on one end and an SPI master on the other end. It can transfer at up to 53.8Mbps with Quad-SPI master mode.

Getting RP2040 synchronized with the SPI master clock would not be simple. The SPI slave peripheral is able to only go at about 10Mbps out-of-box. You would probably have to use PIO and maybe overclock the RP2040 to get reliable transfers at the full speed.

You would also have to implement the host driver somehow.

IPv4 host over Ethernet

There is an experimental RMII driver for use with LAN8720 or an established ready-to-use SPI/IP bridge called W5500 that would both enable RP2040 to work as an IPv4 device. You could then send your data using TCP or UDP (probably) at 100Mbps.

You would also need an RJ45 jack and a transformer. Or a jack with magnetics already built in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.