Sync two OutputCompare

Hi,

I want to send data on a custom serial bus. I have a clock on a pin, and data on another. I need the data sent on each clock tick.

I use an OutputCompare to generate the clock.

Is there a way to synchronize the data OutputCompare (or something else) with the clock tick?

You will need to implement an RLP driver for your “custom bus”

OK, Thanks ^^

Where can I find a tuto on RLP?

If your custom Bus does not require high speed, you can build it with software on managed code.

You have an example with software I2C here : http://code.tinyclr.com/project/297/software-i2c-driver/
Or SHT11 software driver here : http://code.tinyclr.com/project/185/sensirion-sht71--humidity-temp-and-dewpoint-rev-10b/

I currently need clock ticks around 10 µs so I think I need RLP right?

Right… Using managed code you would not go under 100 to 200us.

This is a bad idea, generating 10uS clock in software! This is where CPLD and FPGAs excel, micros are not made to do that.

I need timing around 10 µs but it will work with up to 50µs, but slower, obviously.

I wanted to do it with OutputCompare because it is driven by the crystal (I think… I’m not sure…)

OutputCompare isn’t driven by the crystal per se. There is a program in the background that counts crystal clocks and changes the output on que.

The PWM is driven directly from the crystal, but it runs at a “fixed” pulse size, no good for serial.

Is there any reason that you can’t use the SPI bus? It also clocks out one bit on every clock…

I need a data pin, a seperated clock pin and I have to use a custom protocol.

Is it possible to do that with SPI (I’m new to embedded)?

If not, where can I find a tuto on using RLP with Eclipse?
I already done this : http://www.itcrowd.be/getting-started-with-ghi-rlp
and this : http://www.yagarto.de/howto/yagarto2/index.html.

I can compile by running make in my project’s directory from a CMD, but Eclipse does not work.

I finally got it to work. I can compile my C code to an elf using the Makefile and the LinkScript supplied with the samples, but when I put it on the board, I get an InvalidOperationException when I call RLP.LoadELF.

Final EDIT : I finally understood that I needed an unlock code to get RLP work. I got one and it work!

Thanks GHI ^^