I'm new using SPI, may be I'm doing it totally wrong.
I Need to switch an RF device and I figured out how the code Looks like. One short pulse has to be 250µs. Sending the code using a parallel port togehter woth a Delay functions works well.
Since the Delay Loop in .Net can be interrupted I had the idea using the MOSI of the SPI to generate the code. Thus I implemented a short test, but is seems the code is sent to fast. Thats why I made the following test:
The SPI config is the following:
SPI.Configuration rcConfig = new SPI.Configuration( Pins.GPIO_PIN_D8, true, 0, 0, false, false, 4, SPI.SPI_module.SPI1 );
I declared a clock rate of 4KHz, which is a 250µs cycle. Then I send 1000 byte
byte[] xxx = new byte[1000]; for (int i = 0; i < 1000; i++) xxx[i] = 0xaa; spi.Write(xxx);
On the MOSI port (11) I expect a signal for about 2 seconds (1000 Byte x 8 bit x 250µs), but it is much lesser then a second.
Where is my fault? Does 4KHz mean, one Byte is sent within 250µs and not one Bit as I expected?
How can I send a code with a duration of 250µs for one bit?