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

NetduinoGo Shieldbase SPI hookup

SPI Shieldbase

  • Please log in to reply
15 replies to this topic

#1 Kirk K

Kirk K

    New Member

  • Members
  • Pip
  • 7 posts

Posted 24 May 2013 - 10:59 PM

My fellow Netgoers,

 

I need your help in hooking up a Parallax Gyroscope Module 3-Axis L3G4200D to the shieldbase. I am using the latest firmware for both my GO and Shieldbase, VS2012, .NET Micro 4.2, etc. Based on the pinout diagram provided by Gutworks, I hooked up the devices as followed:

 

Shieldbase   ->   Gyroscope Module 3-Axis L3G4200D Pin D04 NSS  -> CS Pin D11 MOSI -> SDA Pin D12 MISO -> SDO Pin D13 SPCK -> SCL

using System;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.NetduinoGo;using NetduinoGo;namespace Netduino_Go{    public class Program    {        public static void Main()        {            // write your code here            using (ShieldBase sb = new ShieldBase(GoSockets.Socket5))            {                //Data to write to gyroscope                byte x_MSB = 0x29;                byte x_LSB = 0x28;                byte y_MSB = 0x2B;                byte y_LSB = 0x2A;                byte z_MSB = 0x2D;                byte z_LSB = 0x2C;                byte CTRL_Register1 = 0x20;                byte CTRL_Register2 = 0x21;                byte CTRL_Register3 = 0x23;                //Setup device                SPI device = new SPI(new SPI.Configuration(Pins.GPIO_PIN_D4,   //Chip Select pin                                                false,              //Chip Select Active State                                                0,                  //Chip Select Setup Time                                                0,                  //Chip Select Hold Time                                                true,               //Clock Idle State                                                true,               //Clock Edge                                                10000,               //Clock Rate (kHz)                                                sb.SPI_Devices.SPI1));                device.Write(new byte[] { CTRL_Register1, 0x1F });                device.Write(new byte[] { CTRL_Register2, 0x08 });                device.Write(new byte[] { CTRL_Register3, 0x80 });                Thread.Sleep(1);                while (true)                {                    byte[] data = new byte[6];                    device.WriteRead(new byte[] { x_MSB, x_LSB, y_MSB, y_LSB, z_MSB, z_LSB }, data);                    var x = ((read[0] << 8) | read[1]);                    Debug.Print(x.ToString());                    Thread.Sleep(5);                }            }        }    }}

I am not sure what I am doing here, but I am reading values of 255 on all  from the gyro. Any help would be helpful?

 

ps. I have a competition between a fellow co-worker who is using an Arduino. May have to get +2 to compete against him.

 

 

Thanks,

Kirk



#2 DaveRVW

DaveRVW

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 05 June 2013 - 03:19 AM

You may have SPI and I2C confused. SDA and SCL are I2C connections, and there are dedicated (and mirrored) connections on the shield base.  You may also need 3V pull ups (e.g. 2.2k or similar) for SDA and SCL to work correctly.

 

And use the I2C APIs instead of the SPI APIs.



#3 eplaksienko

eplaksienko

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts

Posted 05 June 2013 - 03:20 PM

There is no i2c on SB yet



#4 eplaksienko

eplaksienko

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts

Posted 05 June 2013 - 03:21 PM

I am also waiting till something changes there



#5 DaveRVW

DaveRVW

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 08 June 2013 - 05:57 AM

Ah, the device supports both SPI and I2C.  Yeah, stick with SPI when you can get it to work.

 

I got confused when you called pin 5 of the Parallax module SDA.  That's for I2C.  The SPI function of that pin is SDI.

 

Sorry I don't have the module myself to try.  Hopefully another user can help.

 

Good luck!



#6 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 09 June 2013 - 11:12 AM

its looks ok, what does tghe who am i register answer?

 

ill add my basic code for this module, its i2c, but maybe it helps

 

also try changing your spi speed, start with 1-2 mhz (idk the specs for the device now, but 10mhz sounds high)

Attached Files



#7 Kirk K

Kirk K

    New Member

  • Members
  • Pip
  • 7 posts

Posted 10 June 2013 - 02:19 PM

Thanks for all the input guys. I will be shelving the NGO for the time being I am leaning towards a +2. While the GO has the potential to be a great device, it is beginning to fall behind the other development boards. I was an earlier adapter of this board because of the potential, but I am now sadden by the fact that this board is going nowhere fast and it seems to be losing traction. Maybe if I understand the concept of building modules the NoGO will be interesting again. 

 

@NooM

Thanks I will try the provided code tonight and keep you guys posted.

 

 

Thanks,

Kirk



#8 eplaksienko

eplaksienko

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts

Posted 11 June 2013 - 02:11 PM

Unfortunately I feel this project is dead, particularly after announcement of watch I feel it abandoned



#9 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 14 June 2013 - 11:37 AM

Thanks for all the input guys. I will be shelving the NGO for the time being I am leaning towards a +2. While the GO has the potential to be a great device, it is beginning to fall behind the other development boards. I was an earlier adapter of this board because of the potential, but I am now sadden by the fact that this board is going nowhere fast and it seems to be losing traction. Maybe if I understand the concept of building modules the NoGO will be interesting again. 

 

 

After using $670 on netduino go related stuff, i'm throwing this in the bucket, maybe if i find a way to use the card for something totally different, I will look into it again, but probably not.

And due to the lack of attention to the Go, I definitely are not wasting my money on the others either, specially due to the lack of interrest of making this an true opensource community effort, still deliverying bits and pieces of sources scattered around in zip files are nothing I want to waste my time on, there are too many other projects that are far more interresting than this.

 

 

The only good effort that has been done for the Go are this blog, this series, and the previous, the way of the registers that Mark have on his blog is truly remarkable, wish Secretlabs could follow this, but I guess it newer will.

http://blog.mark-ste...uk/?page_id=911

http://blog.mark-ste...uk/?page_id=544


--
Asbjrn


#10 zemuss

zemuss

    Advanced Member

  • Members
  • PipPipPip
  • 69 posts

Posted 17 June 2013 - 09:06 PM

I feel the same way and will be purchasing the NetDuino 2 PLUS and shelve the go. 

 

I can get my controller off the ground by the end of the month with the plus unit.



#11 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 18 June 2013 - 07:21 AM

After using $670 on netduino go related stuff,

 

sounds like a lot. are you sure its only for the go? maybe you can use the stuff you bought for a normal netduino or even an arduino.

thats what i do with my electronic stuff, nearly all parts are compatible with all my different mcu's :D



#12 neslekkim

neslekkim

    Advanced Member

  • Members
  • PipPipPip
  • 350 posts
  • LocationOslo, Norway

Posted 18 June 2013 - 10:35 AM

Sure it's a lot:

 

1 x Nwazet Power Supply Kit  -  Nwazet Power Supply Kit 13
5 x 5cm go!cable  -  5cm go!cable 10
4 x 10cm go!cable  -  10cm go!cable 10
1 x Nwazet Data Acquisition Module  -  Nwazet Data Acquisition Module 52
1 x Nwazet Touch Display Module  -  Nwazet Touch Display Module 54
1 x Nwazet Pro Kit - Black Acrylic Plates With Fasteners  -  Nwazet Pro Kit - Black Acrylic Plates With Fasteners 25
1 x Komodex Seven Segment Display Module  -  Komodex Seven Segment Display Module 19,95
1 x Black Dome Metal Knob  -  Black Dome Metal Knob 6
Shipping 30
1 x Nwazet Relay Module Kit  -  Nwazet Relay Module Kit 14
1 x Netduino Go  -  Netduino Go 49,95
1 x Shield Base Module  -  Shield Base Module 24,95
Shipping 15
2 x 10cm go!cable  -  10cm go!cable 5
1 x 30cm go!cable  -  30cm go!cable 3
1 x Button Module  -  Button Module 4,95
1 x    STM8S105 chips for GoModules (5 pack) - DIP (NET0015-1) = $12.95 12,95
1 x    GoPort IDC Headers (10 pack) - Through Hole (NET0014-1) = $12.95 12,95
1 x    GoPort IDC Headers (10 pack) - Surface Mount (NET0013-1) = $9.95 9,95
Shipping 9
1 x 497-11578-ND (497-11578-ND) = $2.27 2,27
1 x TSSOP-20 to DIP-20 SMT Adapter (0.65 mm pitch) (PA0035) = $12.49 12,49
        DIP Pin Type Wire Wrap Pins (0.64 mm square)
        Assembly Pins and IC Assembled
Shipping 6
1 x    Netduino Go - 10cm go!cables (5 pack) (NET0010-1) = $9.95 9,95
2 x    Netduino Go - IDC Cable Breakout Board (GO-ADAPT) = $13.98 13,98
Shipping 9
1 x    Netduino Go - Button Module (NET0007-1) = $4.95 4,95
1 x    Netduino Go - Piezo Buzzer Module (NET0011-1) = $7.95 7,95
2 x    Netduino Go - Potentiometer Module (NET0008-1) = $15.90 15,9
2 x    Netduino Go - RGB LED Module (NET0009-1) = $19.90 19,9
Shipping 9
2x GoBus Breakout module 19,9
shipping 16,95
Protomodule 25
shipping 13
f3 discovery 23,42
stm8103krt6c 5,31
f4 discovery 16,73
f0 discovery 8,99
stm8 discovery 10,81
stlink/v2 23,91
shipping 30
 

Totals to $687, and then comes import duties of 25% etc.

Some of this is educational, to learn the stm platform and such, but the go modules is not that easy to reuse just like that, Fabien have an good writeup here: http://fabienroyer.w...no-care-part-1/

but it's just not plug'n play.

What's good though, is that Fabien/Nwazet is all opensource, the sad part is that the rest is not (Well, you got zipfiles to wade through), so it's currently on hold.


--
Asbjrn


#13 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 18 June 2013 - 08:37 PM

I feel the same way and will be purchasing the NetDuino 2 PLUS and shelve the go. 

 

I read this post and I must admit it struck a chord.  At the moment the best value option for me is the Netduino Plus 2:


    [*]It's here
    [*]Can work with shields
    [*]You can convert existing drivers and use the previous work from community members
    [/list]

    Given the cost of the N+2 and the GO! and a ShieldBase the N+2 is better value for money,

     

    Regards,

    Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#14 eplaksienko

eplaksienko

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts

Posted 18 June 2013 - 08:41 PM

Honestly I like idea of NGO better, I am quiet thinking to try Raspberry Pi + Ala Mode



#15 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 18 June 2013 - 08:46 PM

Honestly I like idea of NGO better, I am quiet thinking to try Raspberry Pi + Ala Mode

I think the Pi is a big game changer.

 

Not heard of AlaMode - interesting board.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#16 eplaksienko

eplaksienko

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts

Posted 19 June 2013 - 12:05 AM

I just ordered one, my problem is I try to tech kids this staff, and NGO is just great solution, but 1 thing, lack of realization







Also tagged with one or more of these keywords: SPI, Shieldbase

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.