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

not working spi


  • Please log in to reply
17 replies to this topic

#1 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 01:07 AM

hi, all I'm programming lcd dogml128 with netduino, on this netduino is spi working, And i try with netduino mini and spi dont work. both netduinos working with 4.1.1. Pls help me.

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 06 December 2011 - 06:32 AM

I guess you should describe better your problem, show some code, and let the users understand what is your context. Thanks
Biggest fault of Netduino? It runs by electricity.

#3 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 07:51 AM

//  SID: D11 (SPI MOSI) 14 lcd36
        //  SCLK: D13 (SPI CLK) 16 lcd37
        //  A0: D7 (Data / Command) 17 lcd38
        //  /RST: D4  18 lcd40
        //  /CS: D10 (SPI CS), D8 if D10 used for SD Card CS 19 lcd39

  //      public static AdaFruit7565 lcd = new AdaFruit7565(Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D4, Pins.GPIO_PIN_D10, speedKHz: 21000); SPI working with netduino

        public static AdaFruit7565 lcd = new AdaFruit7565(Pins.GPIO_PIN_17, Pins.GPIO_PIN_18, Pins.GPIO_PIN_20, speedKHz: 21000); SPI not working with netduini mini

Edited by Stefan, 06 December 2011 - 08:39 AM.
Added [code]-tags


#4 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 December 2011 - 08:18 AM

Hi stafil, Could you please also share the AdaFruit7565 library, or tell us which one you're using, so we can see the actual code?
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#5 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 08:21 AM

public AdaFruitSSD1306(Cpu.Pin dc, Cpu.Pin reset, Cpu.Pin chipSelect, SPI.SPI_module spiModule = SPI.SPI_module.SPI1, uint speedKHz = 10000)
        {

            AutoRefreshScreen = false;

            var spiConfig = new SPI.Configuration(
                SPI_mod: spiModule,
                ChipSelect_Port: chipSelect,
                ChipSelect_ActiveState: false,
                ChipSelect_SetupTime: 0,
                ChipSelect_HoldTime: 0,
                Clock_IdleState: false,
                Clock_Edge: true,
                Clock_RateKHz: speedKHz
                );

            Spi = new SPI(spiConfig);

            dcPin = new OutputPort(dc, false);
            resetPin = new OutputPort(reset, false);
        }


I have pins set correctly for netduino mini?

Edited by Stefan, 06 December 2011 - 08:39 AM.
Added code tags


#6 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 December 2011 - 08:39 AM

Hi stafil,

I see one thing that's not right:
public AdaFruitSSD1306(Cpu.Pin dc, Cpu.Pin reset, Cpu.Pin chipSelect, SPI.SPI_module spiModule = SPI.SPI_module.SPI1, uint speedKHz = 10000)
The constructor has 5 parameters.
You define:
public static AdaFruit7565 lcd = new AdaFruit7565(Pins.GPIO_PIN_17, Pins.GPIO_PIN_18, Pins.GPIO_PIN_20, speedKHz: 21000);
with 4 parameters.

But I think you posted the wrong class? Since the name is also slightly different (AdaFruit7565 versus AdaFruitSSD1306)
Could it be you're using this library? http://netduinohelpers.codeplex.com/
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#7 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 08:54 AM

Yes I have use AdaFruit ST7565 Negative LCD display . on mini is spi 3.3v or 5v? the library work with netduino but do not work with mini.

#8 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 December 2011 - 09:09 AM

on mini is spi 3.3v or 5v?

All Netduinos currently output 3V3 on digital signals. But the Mini doesn't have a 3V3 pin. It's power pin outputs 5V for some reason. I normally use a low drop voltage regulator to get my own 3V3 connector.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#9 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 09:24 AM

What is the difference between a netduino netduinomini? Why it works for netduino and the mini is not it?

#10 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 December 2011 - 09:26 AM

What is the difference between a netduino netduinomini? Why it works for netduino and the mini is not it?

Hard to tell, I don't have that display to reproduce the issue. But try setting the speed to 10000.
It can happen at higher speeds that the result gets unpredictable. Other things (like the voltage or amperage) could make a difference then.

And how have you connected the device to the Mini's SPI-bus?
Netduino pin D11 == Netduino Mini pin 14
Netduino pin D12 == Netduino Mini pin 15
Netduino pin D13 == Netduino Mini pin 16
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#11 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 06 December 2011 - 09:26 AM

But the Mini doesn't have a 3V3 pin. It's power pin outputs 5V for some reason.

The Netduino Mini is pin-compatible with Parallax BASIC Stamp 2 modules.

#12 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 December 2011 - 09:30 AM

The Netduino Mini is pin-compatible with Parallax BASIC Stamp 2 modules.

Thats some good reason ;)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#13 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 10:00 AM

Yes I have you connected the device to the Mini's SPI-bus. I try reduce speed and lcd do not work.

#14 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 10:17 AM

Thx for all, I try setting the speed to 1000 and lcd work, but I do not understand why you can not go faster when it goes on netduine.

#15 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 06 December 2011 - 10:53 AM

Could have several reasons. Is the code different? Are there more components connected to the mini? Is the power supply different? Hard to tell with the info we have ;) But I'm glad it's working!
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#16 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 10:59 AM

everything is same.

#17 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 06 December 2011 - 12:46 PM

@stafil: you set a 21MHz clock rate, which is very high. Both the Netduinos have no problem to manage a such high frequency, nor even higher. The problem is actually the external hardware: the wires must be short enough, possibly paired and the components used do have relevancy on performance. If you dig in this forum, I posted a consideration on the SPI speed for the users, especially for who aren't expertise with circuits and/or without some basic instrumentation (e.g. a good scope). I suggest to keep any signal rate below 5-10MHz (even lesser), to avoid problems. Cheers
Biggest fault of Netduino? It runs by electricity.

#18 stafil

stafil

    Member

  • Members
  • PipPip
  • 27 posts

Posted 06 December 2011 - 04:34 PM

Thx for all, lcd is now work.




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.