mbrossett's Content - Netduino Forums
   
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.

mbrossett's Content

There have been 46 items by mbrossett (Search limited from 28-September 23)


By content type

See this member's


Sort by                Order  

#57380 Adding to Cpu.Pin enumeration

Posted by mbrossett on 06 April 2014 - 09:26 PM in Netduino 2 (and Netduino 1)

Rather, I would like to add to the Netduino.Pins enumeration.




#57383 Adding to Cpu.Pin enumeration

Posted by mbrossett on 06 April 2014 - 09:53 PM in Netduino 2 (and Netduino 1)

Let me try to clear up any confusion...

 

There are pins on the STM32F405RG that are unused in the Netduino design (i.e. PA4, PA5, PC8, PC9,...). I wish to wire up to these pins, however, they are not defined in the Netduino.Pins enumeration and therefore I have no way to control those pins. Does anyone know how I can modify the software/firmware to get access to those STM32F4 pins?




#57379 Adding to Cpu.Pin enumeration

Posted by mbrossett on 06 April 2014 - 09:22 PM in Netduino 2 (and Netduino 1)

Can someone tell me how to add STM32F4 pins (i.e. PA4, PA5, PC8, PC9, ...) to the Cpu.Pin enumeration and use these I/O? Obviously it would require physical access to these pins, for example a custom Netduino board.

 

I am guessing it would require a modification to the Netduino firmware and a rebuild. Has anyone done this?




#57398 Adding to Cpu.Pin enumeration

Posted by mbrossett on 07 April 2014 - 01:25 PM in Netduino 2 (and Netduino 1)

Thank you very much CW2! Also, I have attached a simple class that defines the STM32F405RG pins.

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace STM32F4
{
    public static class Pin
    {
        public static Cpu.Pin PA0 { get { return (Cpu.Pin)(0); } }
        public static Cpu.Pin PA1 { get { return (Cpu.Pin)(1); } }
        public static Cpu.Pin PA2 { get { return (Cpu.Pin)(2); } }
        public static Cpu.Pin PA3 { get { return (Cpu.Pin)(3); } }
        public static Cpu.Pin PA4 { get { return (Cpu.Pin)(4); } }
        public static Cpu.Pin PA5 { get { return (Cpu.Pin)(5); } }
        public static Cpu.Pin PA6 { get { return (Cpu.Pin)(6); } }
        public static Cpu.Pin PA7 { get { return (Cpu.Pin)(7); } }
        public static Cpu.Pin PA8 { get { return (Cpu.Pin)(8); } }
        public static Cpu.Pin PA9 { get { return (Cpu.Pin)(9); } }
        public static Cpu.Pin PA10 { get { return (Cpu.Pin)(10); } }
        public static Cpu.Pin PA11 { get { return (Cpu.Pin)(11); } }
        public static Cpu.Pin PA12 { get { return (Cpu.Pin)(12); } }
        public static Cpu.Pin PA13 { get { return (Cpu.Pin)(13); } }
        public static Cpu.Pin PA14 { get { return (Cpu.Pin)(14); } }
        public static Cpu.Pin PA15 { get { return (Cpu.Pin)(15); } }
        public static Cpu.Pin PB0 { get { return (Cpu.Pin)(16 + 0); } }
        public static Cpu.Pin PB1 { get { return (Cpu.Pin)(16 + 1); } }
        public static Cpu.Pin PB2 { get { return (Cpu.Pin)(16 + 2); } }
        public static Cpu.Pin PB3 { get { return (Cpu.Pin)(16 + 3); } }
        public static Cpu.Pin PB4 { get { return (Cpu.Pin)(16 + 4); } }
        public static Cpu.Pin PB5 { get { return (Cpu.Pin)(16 + 5); } }
        public static Cpu.Pin PB6 { get { return (Cpu.Pin)(16 + 6); } }
        public static Cpu.Pin PB7 { get { return (Cpu.Pin)(16 + 7); } }
        public static Cpu.Pin PB8 { get { return (Cpu.Pin)(16 + 8); } }
        public static Cpu.Pin PB9 { get { return (Cpu.Pin)(16 + 9); } }
        public static Cpu.Pin PB10 { get { return (Cpu.Pin)(16 + 10); } }
        public static Cpu.Pin PB11 { get { return (Cpu.Pin)(16 + 11); } }
        public static Cpu.Pin PB12 { get { return (Cpu.Pin)(16 + 12); } }
        public static Cpu.Pin PB13 { get { return (Cpu.Pin)(16 + 13); } }
        public static Cpu.Pin PB14 { get { return (Cpu.Pin)(16 + 14); } }
        public static Cpu.Pin PB15 { get { return (Cpu.Pin)(16 + 15); } }
        public static Cpu.Pin PC0 { get { return (Cpu.Pin)(32 + 0); } }
        public static Cpu.Pin PC1 { get { return (Cpu.Pin)(32 + 1); } }
        public static Cpu.Pin PC2 { get { return (Cpu.Pin)(32 + 2); } }
        public static Cpu.Pin PC3 { get { return (Cpu.Pin)(32 + 3); } }
        public static Cpu.Pin PC4 { get { return (Cpu.Pin)(32 + 4); } }
        public static Cpu.Pin PC5 { get { return (Cpu.Pin)(32 + 5); } }
        public static Cpu.Pin PC6 { get { return (Cpu.Pin)(32 + 6); } }
        public static Cpu.Pin PC7 { get { return (Cpu.Pin)(32 + 7); } }
        public static Cpu.Pin PC8 { get { return (Cpu.Pin)(32 + 8); } }
        public static Cpu.Pin PC9 { get { return (Cpu.Pin)(32 + 9); } }
        public static Cpu.Pin PC10 { get { return (Cpu.Pin)(32 + 10); } }
        public static Cpu.Pin PC11 { get { return (Cpu.Pin)(32 + 11); } }
        public static Cpu.Pin PC12 { get { return (Cpu.Pin)(32 + 12); } }
        public static Cpu.Pin PC13 { get { return (Cpu.Pin)(32 + 13); } }
        public static Cpu.Pin PC14 { get { return (Cpu.Pin)(32 + 14); } }
        public static Cpu.Pin PC15 { get { return (Cpu.Pin)(32 + 15); } }
        public static Cpu.Pin PD2 { get { return (Cpu.Pin)(48 + 2); } }
    }
}



#57128 Analog Output

Posted by mbrossett on 26 March 2014 - 01:42 AM in Netduino Plus 2 (and Netduino Plus 1)

Btw, the MCP48xx family have internal voltage references and the MCP4725 references it's supply voltage. Each has its advantages and disadvantages just depends on what you need the DAC for.



#57127 Analog Output

Posted by mbrossett on 26 March 2014 - 01:38 AM in Netduino Plus 2 (and Netduino Plus 1)

You could also interface with and SPI or I2C DAC device like this one (MCP4821)...

http://ww1.microchip...eDoc/22244B.pdf

Or better yet (if you are looking for cheap and easy)...

http://www.adafruit....CFSISMwodvSgAZQ



#57038 Device driver implementation for PCA9539 I/O Expander...

Posted by mbrossett on 23 March 2014 - 10:16 PM in General Discussion

My goal was to create an easy to use device driver for the PCA9539 16-bit GPIO expander IC. However, I also wanted to make it generic so that could be used with other future gpio expander driver implementations.

 

I created a simple interface that each device driver class (i.e. PCA9539) shall implement. I also created a generic Gpio class used to interface with the device driver(s).

 

I chose to do it this way to to make it easy to use in the main routine. I am not a software engineer by trade, so any advice would be much appreciated. Any thoughts, comments, ideas to improve?

 

Attached Files




#57510 Help on I2C

Posted by mbrossett on 12 April 2014 - 09:44 PM in Netduino 2 (and Netduino 1)

I live in the US. I think you will learn more by me walking you through the steps of troubleshooting the hardware. Even if you are only interested in software. A software person with good hardware skills is very desirable.

 

Anyway, let me do some testing on my Netduino Plus 2 tomorrow and I will get back to you with some things to try.




#57485 Help on I2C

Posted by mbrossett on 11 April 2014 - 05:34 PM in Netduino 2 (and Netduino 1)

Looking at the Netduino schematics I think it should more than capable of providing the LCD power without a large voltage drop...that being said let's figure out what is causing your 0.4V voltage drop and then we should be able to fix it. Please measure the following voltages...

1) VIN_PROTECTED (U1 pin 3 on Netduino)
2) +5.0V (U1 pin 4 on Netduino)
3) +5V_HEADER (at the connector on Netduino)
4) VDD (at the LCD input connector)
5) SDA/SCL (idle voltage)

Make these measurements with your 1500mA power supply connected to the Netduino and the LCD power, ground, SDA, and SCL pins connected to the Netduino connector.



#57545 Help on I2C

Posted by mbrossett on 14 April 2014 - 02:07 AM in Netduino 2 (and Netduino 1)

Frank,I measured the 5V railed and 5V header on my Netduino Plus 2 this evening running from a 9V, 1A power supply. The outputs were both right at 5V (with no load on the 5V header). I am putting something together for you to help your test and troubleshoot your hardware. I will send it to you tomorrow when I finish it up.

when i only connect the powersupply and nothing else the voltage on the 5V DC is 4.81 VDC ?
on both my Netduino's ? So what could be wrong then ?


When you say nothing else connected, does that mean the LCD is disconnected?



#57491 Help on I2C

Posted by mbrossett on 12 April 2014 - 04:35 AM in Netduino 2 (and Netduino 1)

This is strange. Out of curiosity is the USB cable disconnected while taking these measurements?

So what we need to measure is the (1) input to the 5V regulator (should be about 8.7V), (2) the output of the 5V regulator (should be 5V when not powered by USB), (3) the voltage on the output side of the MOSFET load switch for the 5V header (should be around 4.95V), and (5) the voltage at the LCD (should be around 4.9V or more if you have proper cabling). When making these measurements your reference should be the power supply input negative terminal at the input barrel connector.

I'm surprised that the voltage output of the 5V regulator is so low.



#57584 Help on I2C

Posted by mbrossett on 15 April 2014 - 12:15 PM in Netduino 2 (and Netduino 1)

Remove the RED wire connected to P1.1 of the display. You shouldn't have 5V tied to the RX pin. Actually since you aren't using the UART interface, you can leave P1 completely disconnected (VDD and VSS connections are already made on P2). After doing this remeasure the voltages and ensure you are getting the proper 5V to the display.




#57640 Help on I2C

Posted by mbrossett on 18 April 2014 - 08:57 PM in Netduino 2 (and Netduino 1)

No I don't think you need to buy a new one...yet. I have been on travel but should be able to send you something this weekend to help you troubleshoot.



#57601 Help on I2C

Posted by mbrossett on 17 April 2014 - 01:00 AM in Netduino 2 (and Netduino 1)

Yes. You can disconnect all wires from the 3 pin connector on the left.




#57467 Help on I2C

Posted by mbrossett on 11 April 2014 - 04:08 AM in Netduino 2 (and Netduino 1)

Are you making any progress Frank?




#57546 Help on I2C

Posted by mbrossett on 14 April 2014 - 02:13 AM in Netduino 2 (and Netduino 1)

Also if you could send some good pics of your setup that would help, too. And are you using a good DMM to make your measurements (I.e. Are you confident with its readings)?



#57434 Help on I2C

Posted by mbrossett on 08 April 2014 - 02:08 PM in Netduino 2 (and Netduino 1)

Also if you do not have the right sized barrel on the power supply, you could wire it up to VIN and GND pins of the Netduino connector. Make sure the voltage of the supply is between 7.5VDC and 9VDC, though.




#57101 Help on I2C

Posted by mbrossett on 25 March 2014 - 02:52 PM in Netduino 2 (and Netduino 1)

Ok, I looked at that display for a bit and it uses a parallel type display with a I2C gpio expander. Also, it is a 5V display so you would need to ensure that you are powering it from 5V and that the I2C pull-ups are to 5V. If you are new to METMF and Netduino I would suggest going with a true I2C serial display such as one of these...

 

http://www.newhavend...lays-c-253.html

 

Although the Arduino library can be ported to NETMF, you will be better off going with one of the displays I have pointed you to. With NETMF not being a real-time environment you might run into issues with the timing on this display anyway, especially in a multi-threaded application, but I'm not for sure. Another option is to use an Arduino instead of a Netduino. Sorry I couldn't be more helpful, maybe someone with a little more free time and ambition will come by and port it over for you.




#57124 Help on I2C

Posted by mbrossett on 25 March 2014 - 11:56 PM in Netduino 2 (and Netduino 1)

As promised here is your driver and test code for the Newhaven Display I2C serial displays. Enjoy and keep us posted on the progress.

using System;
using System.Text;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace NewhavenDisplay
{
    // For use with newhaven I2C displays
    // I2C protocol:
    // To enter the I2C mode, place a jumper on R1.  
    // SDA and SDK have pull?up resistors (10K Ohm) on R7 and R8.
    // The default I2C address is 80 (50 hex).  The I2C address can be changed to any 8?bit value by command function, with
    // the exception that the LSB (least significant bit) must always be ‘0’.  Once the I2C address has been changed, it will be
    // saved in the system memory, and it will revert back to the default address if either RS232 or SPI protocol is selected.
    // The I2C interface is capable of receiving data at up to 100KHz?clock rate.
    // See http://www.newhavendisplay.com/specs/NHD-0216K3Z-FL-GBW.pdf

    public class SerialLCD
    {
        private static I2CDevice.Configuration _config = new I2CDevice.Configuration(0x50 >> 1, 100); 

        public SerialLCD()
        {
        }

        public void Write(I2CDevice device, string sText)
        {
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            byte[] buf = Encoding.UTF8.GetBytes(sText);                 // Convert the string to array
            xActions[0] = I2CDevice.CreateWriteTransaction(buf);
            device.Execute(xActions, 1000);
        }

        public void DisplayOn(I2CDevice device)
        {
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            xActions[0] = I2CDevice.CreateWriteTransaction(new byte[] { 0xFE, 0x41 });
            device.Execute(xActions, 1000);
        }

        public void DisplayOff(I2CDevice device)
        {
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            xActions[0] = I2CDevice.CreateWriteTransaction(new byte[] { 0xFE, 0x42 });
            device.Execute(xActions, 1000);
        }

        public void SetCursor(I2CDevice device, byte Position)
        {   // 0x00 = line 1 column 1
            // 0x40 = line 2 column 1
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            xActions[0] = I2CDevice.CreateWriteTransaction(new byte[] { 0xFE, 0x45, Position });
            device.Execute(xActions, 1000);
        }

        public void Clear(I2CDevice device)
        {
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            xActions[0] = I2CDevice.CreateWriteTransaction(new byte[] { 0xFE, 0x51 });
            device.Execute(xActions, 1000);
        }

        public void SetContrast(I2CDevice device, byte ContrastLevel)
        {   // Value between 0 and 50, default is 40
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            xActions[0] = I2CDevice.CreateWriteTransaction(new byte[] { 0xFE, 0x52, ContrastLevel });
            device.Execute(xActions, 1000);
        }

        public void SetBrightness(I2CDevice device, byte BrightnessLevel)
        {   // Value between 1 to 8 
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            xActions[0] = I2CDevice.CreateWriteTransaction(new byte[] { 0xFE, 0x53, BrightnessLevel });
            device.Execute(xActions, 1000);
        }

        public void Firmware(I2CDevice device)
        {
            device.Config = _config;
            var xActions = new I2CDevice.I2CTransaction[1];
            xActions[0] = I2CDevice.CreateWriteTransaction(new byte[] { 0xFE, 0x70 });
            device.Execute(xActions, 1000);
        }

    }
}
using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using NewhavenDisplay;

namespace Serial_Display_Test
{
    public class Program
    {
        public static void Main()
        {
            // Create an I2C device with no device configuration
            I2CDevice i2cDevice = new I2CDevice(null);

            SerialLCD display = new SerialLCD();

            display.DisplayOn(i2cDevice);

            // Write to display
            display.Clear(i2cDevice);
            display.SetCursor(i2cDevice, 0x00);
            display.Write(i2cDevice, "Hello");

            // Wait indefinitely
            Thread.Sleep(Timeout.Infinite);
        }
    }
}



#57117 Help on I2C

Posted by mbrossett on 25 March 2014 - 08:32 PM in Netduino 2 (and Netduino 1)

Btw, there are pull-up resistors (10k) installed on the LCD so you shouldn't need them, but you may want to put a little stronger pull-ups on the bus (4.7k, 3.3k, or 2.2k) just in case.




#57097 Help on I2C

Posted by mbrossett on 25 March 2014 - 01:51 PM in Netduino 2 (and Netduino 1)

I cannot find that display. Can you send me a link to the website you bought it from?




#57066 Help on I2C

Posted by mbrossett on 25 March 2014 - 01:45 AM in Netduino 2 (and Netduino 1)

What is the part number of the LCD you are using. This may help us help you. If it is a Newhaven Display serial LCD then you need to install an on-board jumper to configure it in I2C mode. Your fix probably isn't that easy but just thought I'd throw that out there. Also, if you give me the part number I could write you a simple piece of test code.



#57116 Help on I2C

Posted by mbrossett on 25 March 2014 - 08:29 PM in Netduino 2 (and Netduino 1)

These are 5V displays, too. Therefore, you will need 5V pull-ups on the I2C lines. When you get the display you will need to solder a 0 Ohm resistor or something (piece of wire or bridge it with solder like I do) across R1, see page 4 of the datasheet...

 

http://www.newhavend...Z-FL-GBW-V3.pdf

 

And yes I will post some code tonight for this display. I have a driver for it on my PC at home. Will post it tonight.




#57433 Help on I2C

Posted by mbrossett on 08 April 2014 - 02:05 PM in Netduino 2 (and Netduino 1)

If you use an external power supply for the Netduino (such as the one below) you will only need to use USB for debugging as you have stated. The power supply should be connected to the barrel input jack. Be sure to ensure that the power supply has a positive center barrel (this is most common type).

 

http://www.mouser.co...bXAYafurk4XukHd




#57442 Help on I2C

Posted by mbrossett on 08 April 2014 - 11:54 PM in Netduino 2 (and Netduino 1)

Yeah, the voltage may still be too low. You should power it up from its own supply. Also make sure you are checking the return value of the I2C execute commands...that will tell you if the LCD is acknowledging the commands.




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.