Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I need to interface device using specific synchronous protocol that requires clock signal within 1..2MHz. Period instability shouldn't exceed 10%. Also, in certain condition protocol requres clock signal to be set into still high level. The whole circuit has two channels that act the same way (so I need to clock signals, etc.).

Can I use RPi to generate the signal accurate enough? RPi have only one PWM channel, but I need two of them. GPIO bitbang looks like solution, but usleep(1) shows ugly performance. It seems this could be solved by creating a driver (OMG!), or using some kernel tweak like Xenomai. But could I really reach accurate delay of 1us or even up to 500ns?

The other solution to me is to use external hardware clock generator, and perform interrupts-based data exchange. Can I reach desired performance at userspace?

share|improve this question
    
One more approach: add a small microcontroller dedicated to serving the fast interface and talk to that over some serial bus. –  XTL Jan 10 '13 at 9:33
    
Actually I'm trying to get rid of one. I had simple protocol implementation with AVR MCU, but it's not powerful enough to be used for full protocol implementation. –  xtreye Jan 10 '13 at 9:40
    
Unfortunately, not. I refused to use RPi for the task and decided to port AVR code to generic ARM platform. And that's why: RPi-based solution would require the use of external clock or PWM in conjunction with interrupts handling. Another way is to use real-time kernel (Xenomai). At the same time "dull" port to ARM platform saves a lot time while meeting requirement. –  xtreye Mar 15 at 23:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.