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

Netduino Plus 2, SPI interferes with Networking?

SPI Sockets

  • Please log in to reply
2 replies to this topic

#1 Anthony Glenwright

Anthony Glenwright

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 13 June 2013 - 07:32 AM

My application uses sockets to provide information to callers, and also integrates an LCD panel, which is driven by SPI.  I have encountered a problem where the socket .Accept never accept()s a connection, but only if I have created an instance of the Microsoft.SPOT.Hardware.SPI class before calling Accept().  I have reduced the test case down to the following code.

SPI objSPI;Socket objListenSocket = null;objListenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);objListenSocket.Bind(new IPEndPoint(IPAddress.Any, 80));objListenSocket.Listen(10);// If this line is commented out, the Accept() call works, otherwise it doesn'tobjSPI =new SPI(new SPI.Configuration(Cpu.Pin.GPIO_Pin8, false, 0, 0, true, true, 400, SPI.SPI_module.SPI1));objListenSocket.Accept();

Any ideas?  I am guessing that SPI is used as part of networking support in the NDP2 and that's why it breaks the sockets functionality, but I'd appreciate any tips on how I can work around the issue.  Firmware is 4.2.2.2



#2 Anthony Glenwright

Anthony Glenwright

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 13 June 2013 - 07:54 AM

Eeek.  The interference with networking was caused by me using Cpu.Pin.GPIO_Pin8 from the Microsoft.SPOT.Hardware namespace instead of from the SecretLabs.NETMF.Hardware.Netduino namespace.  Strangely, my SPI communications were functioning correctly, even with the wrong pin assigned.  I guess because it's declared ActiveState:=False, SetupTime:=0, HoldTime:=0 it's not really used for anything in SPI?

 

So problem solved.



#3 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 13 June 2013 - 10:55 AM

I would have thought it be unusual for an SPI slave device to ignore chip select but could be it only looks at the raising edge of the clock as long as !cs is asserted, i.e. performing and AND operation on the two. Maybe that is defacto standard procedure. The parameters you set do matter and controls how the Netduino SPI module manages the cs and clock pins respectively but I guess you knew that already.





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.