Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can create SPI wave in nano seconds resolution? #582

Open
andyzhuang2015 opened this issue Aug 19, 2023 · 10 comments
Open

Can create SPI wave in nano seconds resolution? #582

andyzhuang2015 opened this issue Aug 19, 2023 · 10 comments

Comments

@andyzhuang2015
Copy link

andyzhuang2015 commented Aug 19, 2023

I use ADS8688A with the 500kSPS. It need 64 clock time per sample. However, the pigpio library use 1us as the min clock time. The max speed I can achieved is (1000 / 64) kSPS, which is much smaller than 500.

So how can modify the SPI clock to 10ns or 100ns ?

@guymcswain
Copy link
Collaborator

The hardware SPI supports a baud rate maximum of 32M.

@andyzhuang2015
Copy link
Author

andyzhuang2015 commented Aug 19, 2023

The hardware SPI supports a baud rate maximum of 32M.

Yes. But when use rawWaveAddSPI , the parameter rawSPI_t's clk_us min value is 1us. This limit the clock frequency to 1M. Any workaround to improve the Wave frequency? ( I need to monitor the signal in real-time. So I use Wave to exchange data by SPI. I think spiXfer may have dubious time slot between two invoking. )
@guymcswain This blocking me too much time. Will be very appreciate for your help!

@guymcswain
Copy link
Collaborator

The construction of output waveforms is limited to 1 microsecond timing. Ie, the fastest square waveform you can generate is 500 KHz.

@andyzhuang2015
Copy link
Author

The construction of output waveforms is limited to 1 microsecond timing. Ie, the fastest square waveform you can generate is 500 KHz.

Is it possible to improve the waveforms' CLK timing to nano seconds?

@guymcswain
Copy link
Collaborator

No. Waveforms are controlled by DMA. To try to make it run sub microseconds would be futile as that would create excessive bus traffic interfering with normal activity.

Why do you not use the hardware SPI peripheral which is intended for such purposes?

@andyzhuang2015
Copy link
Author

@guymcswain I use RPI to do this because it need no other devices and I saw that the clocks can achieve 100MHz or higher for RPI peripheral. So I want to test the max ablity of the speed.
@guymcswain You said hardware SPI peripheral, did you mean using FPGA DAQ card, like NI Corporation's?

@guymcswain
Copy link
Collaborator

RPi is made up of many peripherals. The 100MHz rate you mention is only achievable in certain Gpio pins via the Clock peripheral. When I mentioned the SPI peripheral I am referring to the APIs: spiOpen, spiTransfer, spiClose.

@andyzhuang2015
Copy link
Author

@guymcswain Thanks for your patience. I need to monitor the signal continuously without time gap between two data acquest. I tried spiOpen, spiXfer (I didn't found spiTransfer API), spiClose. But there is a dubious time gap between two spiXfer invoking. I think the System schedule to do other things in the time gap. Is there any workaround to avoid that?

@guymcswain
Copy link
Collaborator

Yes, spiXfer. When you specify a buffer of data it will be transferred without any gaps. Check you ADC device. If it can handle data that fast, it most likely can buffer the data.

@andyzhuang2015
Copy link
Author

andyzhuang2015 commented Aug 27, 2023

@guymcswain If I want to streaming the input data without any gaps, can I use spiXfer to achieve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants