Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

SPI usage

  • Please log in to reply
1 reply to this topic

#1 Wernfried


    Advanced Member

  • Members
  • PipPipPip
  • 33 posts

Posted 04 January 2015 - 09:14 PM

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 250s. Sending the code using a parallel port together 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(

I declared a clock rate of 4KHz, which is a 250s cycle. Then I send 1000 byte

            byte[] xxx = new byte[1000];
            for (int i = 0; i < 1000; i++) xxx[i] = 0xaa;

On the MOSI port (11) I expect a signal for about 2 seconds (1000 Byte x 8 bit x 250s), but it is much lesser then a second.


Where is my fault? Does 4KHz mean, one Byte is sent within 250s and not one Bit as I expected?

How can I send a code with a duration of 250s for one bit?



#2 Wernfried


    Advanced Member

  • Members
  • PipPipPip
  • 33 posts

Posted 07 January 2015 - 10:55 AM

I found another topic which explains my problems.




According this explanation I think my fault was to assume the clock rate is 4KHz. The lowest available clock rate is 164 KHz on APB1 and 328 KHz on APB2.


In that topic I could figure out the available frequncies for SPI1, SPI2 and SPI3.

Since APB1 allows a lower clock rate I would use either SPI2 or SPI3.


Now my question ist, on what port can I access MOSI of SPI2 or SPI3? For SPI1 it is somewhere explaned (Port 11). But I cannot find any hints where MOSI for SPI2 or SPI3 is available. Is this avalable at all?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.