Hello, I am designing an arduino shield that has 9 shift registers to achieve 72 outputs. However, I don't have much experience with shift registers so I wanted to ask for an advice.
I want to output 72 square wave signals with frequency of at least 400kHz and I want to output signal from all shift registers at the same time, every 1/400'000 th of a second, so that there is no delay between the signals. Also, the board I will be using is arduino due that has a clock frequency of 84Mhz.
I will have 9 different 8 bit signals for each shift register, for example "01001001". I will use the shiftout function SPI interface to supply shift register with the data.
Q1. Is the frequency of the shiftout SPI output to the shift register limited by the max frequency of the shift register? So for example if the max clock frequency of the shift register is 25Mhz, then the shiftout SPI output will input each bit every 1/25'000'000 th of a second?
Q2. Is it possible to shiftout use SPI adress multiple shift registers at the same time or does it have to be done sequentially? For example can I have arduino adress two or more shift registers at the same time or does it have to shift data to first shift register and then move to the second shift register?
Q3. What would be the best way to synchronise all shift registers? I was thinking of having a global clock of frequency 400MHz that feeds to every shift register, but would this work?
Edit1: I just read that I will probably need to use SPI interface for this application due to the required frequency. However, I still have same questions about SPI as I did for the shift out function (Q1 and Q2).
Is the frequency of the shiftout SPI output to the shift register limited by the max frequency of the shift register?
Yes. But that frequency depends on what shift register you use. See the data sheet of the shift register.
Q2. Is it possible to shiftout use SPI adress multiple shift registers at the same time or does it have to be done sequentially?
If there is only one SPI interface then yes it needs to be sequentially.
This seems like a an X-Y problem, what do you actually want to do, and why use shift registers?
Note that making a long chain of shift registers to operate at such a high frequency is not an easy job. It requires a good layout and attention to your decoupling. It is not something you can do on a breadboard.
I want to be able to create a phased array of ultrasound transducers that I can use for ultrasonic levitation.
The project is based on a kit called TinyLev, but the driving electronics is quite simple and only supports two outputs for top and bottom array and so the plan is to improve it.
The kit has 72 transducers by design and since I need to create phased array each transducer needs individual signal.
Since, I couldn't find a board that supports so many outputs I decided to use shift registers.
The square wave will be amplified using mosfet gate drivers and then fed into individual transducers.
The whole thing will be on a pcb not a breadboard.
Q1. So there is no way to use digital pins for it, right? I need to use SPI pins?
Q2. How should I decouple the shift registers? Should I use a capacitor for the input voltage of the shift register? If so what value?
Q3. Would it be better to daisy chain all shift registers or is it better to keep them separate?
Using shift regs won't work because you can't latch them fast enough.
To get 16 different phases at 400kHz is a temporal resolution of 156ns, so you'd need to latch
the registers that fast, and thus clock them at 72 times that (460MHz).
Definitely unworkable, and that's only 16 phases.
Possible approach not using an FPGA might be a large crossbar switch from an array of differently phased signals to the outputs. Or use an array of small microcontrollers all controlled and clocked from
a master microcontroller.
Using shift regs won't work because you can't latch them fast enough.
To get 16 different phases at 400kHz is a temporal resolution of 156ns, so you'd need to latch
the registers that fast, and thus clock them at 72 times that (460MHz).
Definitely unworkable, and that's only 16 phases.
Sorry I wasn't clear. The transducers will be driven at 40khz and I said I need a frequency of 400kHz because I want minimum of 10 phases.
Shift registers come in a variety of styles, SIPO, PISO, SISPO etc., and logic families, CD, HC, LV etc. Some of these can be extremely fast, and the ATSAM3X8E has up to 6 SPI interfaces, not one.... Yes, you can use one clock. The question is, with 103 IO pins, why use the shift registers at all?
Perehama:
Shift registers come in a variety of styles, SIPO, PISO, SISPO etc., and logic families, CD, HC, LV etc. Some of these can be extremely fast, and the ATSAM3X8E has up to 6 SPI interfaces, not one.... Yes, you can use one clock. The question is, with 103 IO pins, why use the shift registers at all?
The actual board has less than 103 IO pins, I think somewhere around 66, and I am not an expert with arduino. If I created board from scratch rather than using the due it might cause problems for me. (Maybe next project)
I am thinking to use SISPO shift register and link the serial output to next serial input (daisy chain shift registers). Once 72 bit signal is inputted from single SPI I will set the shift registers to output the signal. Given the frequency requirements any shift register that has max frequency of 30Mhz+ should work. I might even try ~80Mhz to get better phase precision. I will connect a bypass capacitor (or two in parallel) to each Vcc of the shift register for noise cancellation.
If you can't use all of the parallel IO controllers, try to use one of them, and connect your 9 SISPO (serial out wouldn't be used, but is usually there on more common chips) all to the same controller... A for the sake of example. Then, you can set the synchronous bit for all 9 in a single clock, then clock high, then low, then set the next 9... should end up being pretty fast.
Would you be satisfied with 72 square wave signals @ 40 KHz,
and each of a different phase? I still do not have a clear understanding
of exactly what output(s) you want. There is a lot of confusing information
floating around but signifying nothing leading to a clear solution, such as
"01001001" which will not yield a square wave when shifted.
Herb
400 kHz * 72 bits = 28.8 Mb/s at a minimum. Hardware SPI pins can handle this just fine indeed. You will need shift registers that can handle this, too. Of course you also need sufficient time for latching. PCB layout will also become an issue, it's not a frequency that can handle parasitics much. This part sounds doable to me. Not easy or straightforward, but totally doable.
Where it goes wrong is that you also will want to read some sensors and calculate the new set of phases as needed to keep your levitating thing levitated. A 84 MHz clock means you have a mere 210 clock cycles to read those sensors, and calculate and set the next phase. That's simply impossible. Something like a 100 times greater clock speed would be a minimum to pull that off.
wvmarle:
400 kHz * 72 bits = 28.8 Mb/s at a minimum. Hardware SPI pins can handle this just fine indeed. You will need shift registers that can handle this, too. Of course you also need sufficient time for latching. PCB layout will also become an issue, it's not a frequency that can handle parasitics much. This part sounds doable to me. Not easy or straightforward, but totally doable.
Where it goes wrong is that you also will want to read some sensors and calculate the new set of phases as needed to keep your levitating thing levitated. A 84 MHz clock means you have a mere 210 clock cycles to read those sensors, and calculate and set the next phase. That's simply impossible. Something like a 100 times greater clock speed would be a minimum to pull that off.
The latching frequency required for this is 400kHz so digital pins should be able to manage it.
I don't need to calculate phases in real time due to periodicity of the waves. I will only need to calculate 10 independent 72bit sets in advance, then I can just loop it. If I want to move the particle I will calculate new sets and then feed it into the arduino. I will do the calculations in the software model I am also working on.