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 Mini using SPI pin assignment question


  • Please log in to reply
2 replies to this topic

#1 contractorwolf

contractorwolf

    Member

  • Members
  • PipPip
  • 23 posts

Posted 03 September 2012 - 06:01 AM

I created a project that has a Netduino Mini communicating with an AD5206 digital potentiometer over SPI. I had it up and working no problem using pin 19 as the CS (or Enable) pin. When I was redesigning my wire setup I tried to use pin 13 instead of pin 19 and it didnt work. I hooked it up to a Saleae Logic to see if I could get a better idea what was happening and it appears that the Enable line never gets a signal. I am initializing my SPI like this:
        public AD5206()
        {
            config = new SPI.Configuration((Cpu.Pin)Pins.GPIO_PIN_19, false, 0, 0, false, true, 1000, SPI.SPI_module.SPI1);
            SPI1 = new SPI(config);
        }


and send a value like this:
        public void SendAddressValue(int potAddress, int potValue)
        {
            tx_data[0] = (byte)potAddress;//digipot address (0 through 5)
            tx_data[1] = (byte)potValue;//value to put pot (0 through 255)

            SPI1.Write(tx_data);
        }


Pin 19 works but using the same code and just changing the pin to GPIO_PIN_13 shows no Enable pin activity even though I can see activity on the CLOCK and MOSI pins. Can pin 13 not be used as the SPI Enable pin for some reason? Do I have to use just the PWM pins? Thanks!

#2 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 03 September 2012 - 05:16 PM

There is currently a bug in the .NetMF which makes pin 13 unusable as the SPI CS pin. Any other pin should work as expected. If you need to use pin 13 (if your out of pins) you can manually manage the CS by creating an OutputPort and writing the pin either HIGH or LOW as needed before and after you send data to the device. If you choose to manually manage the CS you can pass Pins.GPIO_NONE to the SPI.Configuration constructor for the CS.

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#3 contractorwolf

contractorwolf

    Member

  • Members
  • PipPip
  • 23 posts

Posted 08 September 2012 - 08:39 PM

There is currently a bug in the .NetMF which makes pin 13 unusable as the SPI CS pin. Any other pin should work as expected. If you need to use pin 13 (if your out of pins) you can manually manage the CS by creating an OutputPort and writing the pin either HIGH or LOW as needed before and after you send data to the device. If you choose to manually manage the CS you can pass Pins.GPIO_NONE to the SPI.Configuration constructor for the CS.



Thanks Arron, I switched it to pin 20 and it worked fine.




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.