Netduino home hardware projects downloads community

Jump to content


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

NP2 - Using SPI1 as general SPI (not Ethernet)


  • Please log in to reply
3 replies to this topic

#1 johncc

johncc

    New Member

  • Members
  • Pip
  • 6 posts

Posted 14 May 2013 - 05:33 PM

Hello, I am in need of a second SPI port on an NP2 (I know you can have multiple devices on a port -- I want two ports for noise/interference reasons particular to my application) .  I plan to remove the ENC28J60T encoder IC and hand-wire to the SPI1 pins there and use SPI1 as a general purpose SPI port.  Before I go to the trouble of doing that I am curious if the .NET MF will allow me to utilize SPI1 as a general purpose SPI port?

 

In summary: Can SPI1 on NP2 be used as a general purpose SPI from a software perspective (assuming I don't need the ethernet capability) or will the software support for the ethernet preclude me from using this SPI port? 

 

Many thanks for any advice!

John



#2 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 14 May 2013 - 06:13 PM

i cant answer your question, but iam sure soldering wires will make way more noise/interference than just using 2 devices on one spi port.

i mean thats what it is made for.

also, there isnt any interferance, each spi device has a chipselect pin, wich activates it. when not activate it does nothing.

 

 

edit: also, when you think you can use 2 at the same time, thats not possible, you can read/write on one port, than the other, not at the same time.

that would require dma, wich iam fairly sure is not in netmf. netmf's threading is also no real threds, never run 2 at the same time.



#3 johncc

johncc

    New Member

  • Members
  • Pip
  • 6 posts

Posted 14 May 2013 - 06:25 PM

Thanks for the reply Noom.  My problem is that I have very sensitive 16 bit DACs that I write to via an SPI port.  Whenever I write to them, the SPI clock/data lines introduce some noise on their outputs (uV range).  This is okay because I only utilize their outputs some time after I have written values to them via the SPI port (i.e. they are not continously updated).  However, I need to continuously write to a TFT display via SPI all the time (even when I need the DACs to have very quiet outputs).  Even though they have a different CS, the DAC CLK/DATA lines still wiggle when I talk to the TFT display which is enough to add noise to the DAC outputs (I have a very sensitive design to uV level noise).  This is the problem.  So what I want to do is use a dedicated second SPI port to talk with the display so that the CLK/DATA lines going to my DACs are silent when I want them to be.

 

Not being able to write concurrently to the two SPI ports is not a problem in my application.

 

So, anybody know, will the software allow me to utilize the SPI1 port?

 

Thanks again for the comments NooM,

John



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 May 2013 - 06:34 AM

Hi John,

Technically speaking...if you removed the ENC28J60 chip then you could tie into those pads for a second SPI bus. You might need to reflash the board with Netduino 2 firmware (giving up some RAM) though.

But before you do that...I would recommend a much simpler solution. Grab a MicroSD breakout board like the following one, and then tie your second SPI device to its pins. Or if you really want to remove something--remove the SD card and use that SPI bus. You shouldn't get any interference there with your device.
https://www.sparkfun.com/products/9419

BTW you should be able to access all of the SPI buses from C#. Just be sure to case the SPI bus manually using the core "SPI module" class, similar to how you'd cast a Cpu.Pin manually for the MCU. Try values 0-3 to determine which SPI bus you're talking to.

Chris




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.