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.

pascal06's Content

There have been 95 items by pascal06 (Search limited from 16-June 23)


By content type

See this member's


Sort by                Order  

#253 Ethernet Shield from nuelectronics

Posted by pascal06 on 11 August 2010 - 05:46 PM in Netduino 2 (and Netduino 1)

The MAC control lines are not connected so far as I can see from the schematics. So you have a choice between the ENC28J60 or the Wiz5100.

I'd suggest going the Wiz5100 route and integrating the device at the PAL layer in the SOCK_* functions. This avoids the issue of bringing MSSTACK into the firmware. It's getting tight on the chip with only 512K flash.

The Audino ethernet shield uses the Wiz5100 for pretty much that reason. That, and a full TCP/IP stack implementation is not for the faint hearted on an embedded device!

Given the bloaty nature of GCC I would vote for keeping the stack out of the firmware.

Jeremy


I understand your point, but I'm working with IPv6 ... because I'm using multiple 802.15.4 sensors using 6lowPAN ...

Pascal



#180 Ethernet Shield from nuelectronics

Posted by pascal06 on 09 August 2010 - 09:46 PM in Netduino 2 (and Netduino 1)

Yes, you can use it, but there are no drivers for it currently.


Thanks for your reply,

I have a experience on .NET Framework, .NET Compact Framework and on Arduino, but not on .NET Micro Framework,

What do you mean by no drivers ?

If I look at the Porting Kit, it's not possible to use this ? :
C:\MicroFrameworkPK_v4_1\DeviceCode\Drivers\Ethernet\enc28j60
Or this, if I plan to use lwIP ? :
C:\MicroFrameworkPK_v4_1\DeviceCode\Drivers\Ethernet\enc28j60_lwip

Pascal



#187 Ethernet Shield from nuelectronics

Posted by pascal06 on 10 August 2010 - 07:46 AM in Netduino 2 (and Netduino 1)

Hi Pascal,

I think what Chris Seto was talking about was supported C# drivers (or drivers built into the Netduino firmware). Today (stressing the "today" part), there are no networking features compiled into the Netduino firmware...we're evaluating a few ways to support network connectivity on the Netduino and are welcoming community feedback as we build out support.

That said...If you have experience with native C++ code and writing drivers, Netduino is open source--so you have full control. You can build the enc28j60 drivers, integrate them into your own custom firmware, etc. And if you do, I know that many members of the community would love it if you shared your experiences.

If you're not comfortable going down that road, we will have at least one or two good networking options available in the near future. We will continue adding new capabilities (and new tutorials) for the Netduino. Thanks for joining us on the journey.

Chris


Thanks Chris & Chris,

In case of success, I will share my experience,

Pascal



#1184 Communication between 2 or more duino's

Posted by pascal06 on 23 August 2010 - 09:59 PM in Netduino 2 (and Netduino 1)

From the AT91SAM7X512 datasheet:
One Two-wire Interface (TWI)
– Master Mode Support Only, All Two-wire Atmel EEPROMs and I2C Compatible Devices Supported

A driver for SPI slave mode could be written, but I2C slave would require a "bit banged driver."

Chris


Thanks for that clarification :unsure: ...

Pascal



#1049 SPI

Posted by pascal06 on 22 August 2010 - 02:27 PM in Netduino 2 (and Netduino 1)

Regarding clock speed, when I try 1000 Khz, I see 550.66 Khz on my oscilloscope ...

Stephen, did you see the same difference ?

Pascal


Also, just to check the netduino clock, I try this code (come from Expert .NET Micro Framework book) :

Cpu.GlitchFilterTime = new TimeSpan(0, 0, 0, 0, 100); //100 ms
float systemClock = Cpu.SystemClock / 1000000.0f;
Debug.Print("System Clock: " + systemClock.ToString("F6") + " MHz");
float slowClock = Cpu.SlowClock / 1000000.0f;
Debug.Print("Slow Clock: " + slowClock.ToString("F6") + " MHz");
float glitchFilterTimeMs = Cpu.GlitchFilterTime.Ticks /
(float)TimeSpan.TicksPerMillisecond;
Debug.Print("Glitch Filter Time: " + glitchFilterTimeMs.ToString("F1") +
" ms");

It works fine on emulator, but it raise a exception at first line on netduino :

"An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll"

Pascal



#1067 SPI

Posted by pascal06 on 22 August 2010 - 04:50 PM in Netduino 2 (and Netduino 1)

It seems that there is minimum SPI clock speed of about 200KHz.

Desired setting -> Frequency measured on oscilloscope
6000kHz -> 6.00MHz
1000kHz -> 1.00MHz
300kHz -> 300kHz
150kHz -> 743kHz
100kHz -> 215kHz
10kHz -> 251kHz


It's my mistake, I need to multiply by 2,
You're right for all results,
I have the same results now (approximatly),

Pascal



#1046 SPI

Posted by pascal06 on 22 August 2010 - 02:15 PM in Netduino 2 (and Netduino 1)

We've used a variety of clock speeds with success (internally, the .NET MF runtime divides the 48MHz clock into a small counter and then multiplies that counter to match your speed as closely as possible). What clock speed are you looking for?



Hmm, curious. The SPI code comes straight from Atmel and Microsoft, but we can look into this. I'd have to look at some native code SPI samples to see if this is a chip implementation or CLR implementation item. But if you need us to, we can schedule some time to analyze this further. Are you having data communication isssues on SPI because of this?

Chris


Regarding clock speed, when I try 1000 Khz, I see 550.66 Khz on my oscilloscope ...

Stephen, did you see the same difference ?

Pascal



#1071 SPI

Posted by pascal06 on 22 August 2010 - 05:16 PM in Netduino 2 (and Netduino 1)

Okay, just to make sure I understand this right... The SPI clock is working properly for you now, correct?

If not, I want to make sure I get a bug report files so we can investigate...


My SPI works because I use 1 Mhz clock. Because netduino is the master clock, I decided to use that freqency. If the slave doesn't support freqency above 150khz, we will probably have a issue.
But it's not my case.

Pascal



#1037 SPI

Posted by pascal06 on 22 August 2010 - 11:43 AM in Netduino 2 (and Netduino 1)

Hello,

I'm trying to figure out SPI on the netduino with this code:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
using System.IO.Ports;

namespace NetduinoApplication1 {
    public class Program {
        public static void Main() {
            SPI spi_port = new SPI(new SPI.Configuration(
                Pins.GPIO_NONE,                             // Chip select pin
                false,                                      // false - CS active state is low
                0,                                          // CS setup time in ms
                0,                                          // CS hold time
                false,                                      // false - Clk low on idle
                false,                                      // false - Data valid on falling edge
                100,                                        // Clock rate in kHz
                SPI_Devices.SPI1                            // SPI Module
                ));
            byte[] readBuffer = new byte[2];
            while (true) {                
                spi_port.WriteRead(new byte[] { 0x00, 0x55 }, readBuffer);
                //Thread.Sleep(1);
            }
        }       
    }
}

I have problem with:
1. Clock rate adjustment. What clock speed is supported by Netduino?
2. 20us before the data transfer, the clock line is weakly pulled-up for about 40us. This gave me an extra unwanted clock edge. Is it possible to remove this?


Hello Stephen,

Currently I use a clock at 1000 kHz with my nokia 3310 LCD with success,

Pascal



#2421 Netduino USB deployment under VMWARE virtual machine

Posted by pascal06 on 18 September 2010 - 12:35 PM in General Discussion

How can I detect the firmware version on my Netduino board ?

Thanks,
Paolo


Using MFDeploy.exe, select USB -> Netduino_Netduino, in Menu Target -> Device Capabalities,
The "SolutionReleaseInfo.solutionVersion" show the Netduino firmware version,

Pascal



#196 EEPROM

Posted by pascal06 on 10 August 2010 - 08:15 PM in Netduino 2 (and Netduino 1)

Hello, I realize that the MCU AT91SAM7X512 have no EPROM, right ? Perhaps, related to embedded ethernet use on your roadmap, it would be a good idea to include also a little EPROM to be able to store some persitant information like IP address ... /pascal



#2375 Netduino USB deployment under VMWARE virtual machine

Posted by pascal06 on 17 September 2010 - 03:43 PM in General Discussion

How can I install Netduino board driver on the host machine without install all the Netduino SDK ?

Thanks,
Paolo


By using this:
http://forums.netdui...tduino-drivers/

If I understand your question correctly,
Pascal



#4142 Serious problem on my Netduino board

Posted by pascal06 on 23 October 2010 - 01:51 PM in General Discussion

I had a problem with start debugging in Visual Studio 2010....Vs didn't connect to the board.
I have tried to upgrade firmware on Netduino but the MFDeploy blocking on "Connecting to TinyCLR...".
So I have disconnected my Netduino board....
Now when I insert Netduino in USB port I get the following message on my status bar :

USB device not recognized

I have uninstalled and installed the Netduino SDk but it doesn' work !
I can't connected to the board with MFDeploy !

Help !!!
Paolo.


Don't worry :)

You probably need to reflash the firmware. Here the step-by-Step procedure to do it http://forums.netdui...e-does-not-fix/

Pascal



#1245 Another Analog Input Question

Posted by pascal06 on 24 August 2010 - 08:40 PM in Netduino 2 (and Netduino 1)

Hi, I have wired up a sparkfun Triple Axis Accelerometer Breakout ADXL335 to the netduino as follows:

x - PIN_A0
y - PIN_A1
z - PIN_A2
VCC - 3V3 && Aref
GND - Gnd

All works ok when I only try to read a single port, however if I try to read all 3 as detailed below the netduino drops out during the while statement and then I have to do a manual erase of the program via MFDeploy before I can successfully deploy to the device again.

My program is as follows:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace accelerometer
{
public class Program
{
// Define our accelerometer inputs
static AnalogInput accX;
static AnalogInput accY;
static AnalogInput accZ;

public static void Main()
{
// Create the Inputs
accX = new AnalogInput(Pins.GPIO_PIN_A0);
accY = new AnalogInput(Pins.GPIO_PIN_A1);
accZ = new AnalogInput(Pins.GPIO_PIN_A2);

// Output the values ???
while (true)
{
// When alone works fine
Debug.Print("accX: " + accX.Read().ToString());

// This (multiple) doesn't
// Debug.Print("accX: " + accX.Read().ToString());
// Debug.Print("accY: " + accY.Read().ToString());
// Debug.Print("accZ: " + accZ.Read().ToString());
}
}
}
}

I have tested the accelerometer via just running the single input code and swapping in the respective wire for x,y,z. The likelihood is that I am missing something obvious due to inexperience etc so with that in mind a few questions:

I have assumed that I can wire in multiple analog inputs which can be read concurrently. Is this correct?
Drawing upon peoples vaster pools of knowledge do I seem to have I wired up the system correctly?

Does the Aref only cater for a single input?

Cheers dyadica


Did you have update the firmware with patch 2, which include a fix regarding multiple analog use ?

Pascal



#3780 Features of NetDuino

Posted by pascal06 on 11 October 2010 - 08:25 PM in General Discussion

Perhaps you're already on this road, but when the getting started guide comes out, if it could be in a wiki or some other community-editable format, that would be great. If you need a suggestion for wiki software, I like the Screwturn wiki, it's very simple, open source, and .net based.

Full disclosure: I'm listed as a contributor to the Screwturn project, but my contributions were more by accident than intentional...


+1 for a Netduino Wiki
+1 for Screwturn, very efficient

Pascal



#2424 Fimeware Expert Needed

Posted by pascal06 on 18 September 2010 - 02:51 PM in Netduino 2 (and Netduino 1)

Please have a look at the following post which contains updated blockrange for GCC 4.4. The *GCC_SPECIAL* symbols are used to differentiate the block range layout between GCC and the other compilers - when compiling with GCC, there is more blocks for bootstrap, because the generated code is twice as big.


Many thanks,

I'm finally successful with a firmware and TinyBooterDecompressor compiled with GCC 4.2.
And a simple blink led application works. For some of you, it's not a huge step, but for me, it was a long way.

But I have only 32k for C# project :( Without any new firmware feature.
And, I don't know why, the device capabilities function on MFDeploy reply Not Supported (any idea ?),
When I will have time, I will write a little document with my experience, because my feeling is that we don't have enought document about that, it's not realy trivial. Perhaps a little tools to manipulate both files needed to modify would be useful.

Thanks again,
/pascal



#2523 Fimeware Expert Needed

Posted by pascal06 on 20 September 2010 - 01:36 PM in Netduino 2 (and Netduino 1)

And, I don't know why, the device capabilities function on MFDeploy reply Not Supported (any idea ?),


Forget this remark, I have tested this function with TinyBooterDecompressor only :rolleyes: , with no firmware,
It works know,
Pascal



#4072 Netduino hosted web server over WiFi

Posted by pascal06 on 21 October 2010 - 09:02 PM in Netduino 2 (and Netduino 1)

I'm trying to cobble together the parts & code needed to have the netduino act as a web server over WiFi. My end goal is to allow my robot to be controlled / receive commands from Windows Phone 7 device (which can only make http requests; no sockets here). Just as a note I have the original netduino, not the plus model. I was planning to use an XBee shield for WiFi as it appears to have been used successfully by others in this forum. The final missing piece of the puzzle will be to have the netduino listen for http requests and produce some kind of output (and, optionally, return some response data to the device making the requests). I found some code to host a web server from a previous post here http://forums.netdui...ch__1#entry3685 :


WebServer webServer = new WebServer();    
			while (true)    
			{        
				int requestLength = webServer.WaitForRequest(new RequestReceivedDelegate(RequestReceived));        
				
				if (requestLength > 0)        
				{            //-- Build response --            
					responseStr = "HTTP/1.1 200 OK\nContent-Type: text/html\n\n";            
					responseStr += ProcessRequest(receivedStr);                        
					// IMPORTANT: SendResponse() sends response AND closes the connection, please call only once per request.            
					webServer.SendResponse(responseStr);             
					receivedStr = "";        
				}        
				Thread.Sleep(100);    
			}}


Here I'm assuming / hoping the WebServer class is either part of the .NET Micro Framework or part of the example code from the previous post (I guess I should read that code ;). My question is would this work on the original netduino or do I need to upgrade to the plus - and does the overall solution for communicating wirelessly with WP7 sound like the right direction to go? Thanks!!


Hello James,

To use a netduino with wireless, you don't need the plus version. But you need a wireless shield. Xbee module doesn't use the same wireless techonlogies than your PC or Mobile. PC and Mobile use a wireless named Wi-Fi, which use 802.11() wireless technology. With this technology, it's possible to use a IPv4 stack over it, and use HTTP protocol. XBee modules use a different wireless technology, 802.15.4. This technology is perfect is case of low power needs. But, the frame size is 128 bytes only, so it's impossible to use IPv4 over it. Some IPv6 stack exists using 6lowPAN.

In conclusion :

- Use XBee on Netduino and another XBee on your PC. And forget Mobile use. This is a point to point communication. Like serial over the air.
- Or use a true Wi-Fi 802.11 shield, but you probably need to write a driver for it

Pascal



#2383 Fimeware Expert Needed

Posted by pascal06 on 17 September 2010 - 06:01 PM in Netduino 2 (and Netduino 1)

Yes, each block is 8KB. There are 64 blocks total (8KB * 64KB = 512KB).

Does that help at all? It sounds like you had already figured that out though... :)

When making firmware modifications, we typically compile the image--and then measure the size of TinyBooter (using SAM-BA) and the size of TinyCLR (using MFDeploy). Then we re-adjust the block layout, recompile (with /t:rebuild), and reflash.

Chris


Thanks Chris,

And :
BLOCKTYPE_BOOTSTRAP = TinyBooter size
BLOCKTYPE_CODE = TinyCLR size
BLOCKTYPE_DEPLOYEMENT = Free memory for managed code size

But what's both *GCC_SPECIAL* blocks ? Do I need to change his size, and if yes, based on what ?

Many thanks,
Pascal



#2374 Fimeware Expert Needed

Posted by pascal06 on 17 September 2010 - 03:28 PM in Netduino 2 (and Netduino 1)

Hello,

I try to find a good procedure to compile firmware with GCC.
Each time we need to add some firmeware code, we need to modify memory layout.
After some reading on the web and the Porting Kit documentation, it's not very clear for me.

When I cannot build because my firmware doesn't fit the allocated memory, I need to change two files :
C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR>scatterfile_tinyclr_gcc.xml
and
C:\MicroFrameworkPK_v4_1\Solutions\Netduino\DeviceCode\Blockstorage\Sam7X_blockstorage

For the first, it's simple, if I understand correctly :

If I need x bytes (compiler give this value), I just need to add x to previous existing value in Deploy_BaseAddress properties.

<?xml version="1.0"?>
<ScatterFile xmlns="http://schemas.microsoft.com/netmf/ScatterfileSchema.xsd">

    <!-- SAM7X512 has 128KB of RAM at 0x00000000, 512KB FLASH at 0x00100000  -->

    <Set Name="Valid" Value="false"/>

    <!-- ################################################################################ -->
    <!-- 16KB Stack and 16KB Heap -->
    <Set Name="Heap_Begin"      Value="0x00010000"/>
    <Set Name="Heap_End"        Value="0x00017FF8"/>
    <Set Name="Stack_Bottom"    Value="0x00018000"/>
    <Set Name="Stack_Top"       Value="0x0001FFF8"/>

    <If Name="TARGETLOCATION" In="FLASH">
        <Set Name="Code_BaseAddress"    Value="0x0011e000"/>
        <Set Name="Deploy_BaseAddress"  Value="0x00172000"/> <!-- here -->
        <Set Name="Code_Size"           Value="%Deploy_BaseAddress - Code_BaseAddress%"/>
        <Set Name="Config_BaseAddress"  Value="0x0017E000"/>    
        <Set Name="Config_Size"         Value="0x00002000"/>
        <Set Name="Valid"               Value="true"/>
    </If>

With this modification, the compile phase should works. But, the deployement phase can be unsuccessful in case of not enought room in blockstorage.
So, we need to change values in this structure also.

const BlockRange g_SAM7X_BS_BlockRange[] =
{
    //
    { BlockRange::BLOCKTYPE_BOOTSTRAP       ,  0,  5 },
    { MEMORY_BLOCKTYPE_GCC_SPECIAL_BOOTSTRAP,  6, 14 },
    { BlockRange::BLOCKTYPE_CODE            , 15, 44 },
    { MEMORY_BLOCKTYPE_GCC_SPECIAL_CODE     , 45, 46 },
    { BlockRange::BLOCKTYPE_DEPLOYMENT      , 47, 60 },
    { BlockRange::BLOCKTYPE_STORAGE_A       , 61, 61 },
    { BlockRange::BLOCKTYPE_STORAGE_B       , 62, 62 },
    { BlockRange::BLOCKTYPE_CONFIG          , 63, 63 }
};

Anybody may explain how to modify this file with a easy to understand way. How to know the size of each block ?
Is it related to PortBooter.bin, TinyBooter.bin, TinyBooterDecompressor.bin files size (one block = 8k) ...

Any help appreciate,
/pascal



#2884 Wrong network addressing breaks netduino plus

Posted by pascal06 on 25 September 2010 - 04:14 PM in Netduino Plus 2 (and Netduino Plus 1)

I have the same experience, I can see the first ARP request, but no retry (after waiting 30 minutes :) ). A IP stack must retry after a timeout, and after multiple requests it must generate a exception. And it's not the case, like a infinite timeout after the first request. It's probably a bug. Pascal



#920 Ethernet Shield from nuelectronics

Posted by pascal06 on 20 August 2010 - 05:53 PM in Netduino 2 (and Netduino 1)

Hello, I successfully use this LCD http://www.nuelectro...&products_id=12 on Netduino using SPI. I will share the library in a few days. I just need to clean my code. All works fine, except the joystick. Because it powered by 5v :( Now, I will try to use Ethernet Shield http://www.nuelectro...&products_id=4. It seems that we don't have any issue regarding power. But, before starting, I just want to clarify what's the best way to start. Do I need to use PK to create/use the driver ? I think yes if I want to use lwIP, right ? It's not possible to write a driver in C# and use it at this level. Pascal



#91 Board layout file

Posted by pascal06 on 06 August 2010 - 09:16 AM in Netduino 2 (and Netduino 1)

Thanks for your answer, Have a nice day, Pascal



#1055 Nokia 3310 from nuelectronics

Posted by pascal06 on 22 August 2010 - 02:46 PM in Project Showcase

Hello,

I have tried to port Arduino library for this LCD with success. Only the LCD part works, not the joystick due to maximum 3.3v netduino use on Analogue pin.

Here is the library (Nokia3310.cs) :

using System;
using System.Threading;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace Shield
{
    class Nokia3310
    {
        public byte[][] font6_8 = new byte[][]            
        {
            new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },   // sp
            new byte[] { 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 },   // !
            new byte[] { 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 },   // "
            new byte[] { 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 },   // #
            new byte[] { 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 },   // $
            new byte[] { 0x00, 0x62, 0x64, 0x08, 0x13, 0x23 },   // %
            new byte[] { 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 },   // &
            new byte[] { 0x00, 0x00, 0x05, 0x03, 0x00, 0x00 },   // '
            new byte[] { 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 },   // (
            new byte[] { 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 },   // )
            new byte[] { 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 },   // *
            new byte[] { 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 },   // +
            new byte[] { 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 },   // ,
            new byte[] { 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 },   // -
            new byte[] { 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 },   // .
            new byte[] { 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 },   // /
            new byte[] { 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E },   // 0
            new byte[] { 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 },   // 1
            new byte[] { 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 },   // 2
            new byte[] { 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 },   // 3
            new byte[] { 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 },   // 4
            new byte[] { 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 },   // 5
            new byte[] { 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 },   // 6
            new byte[] { 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 },   // 7
            new byte[] { 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 },   // 8
            new byte[] { 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E },   // 9
            new byte[] { 0x00, 0x00, 0x36, 0x36, 0x00, 0x00 },   // :
            new byte[] { 0x00, 0x00, 0x56, 0x36, 0x00, 0x00 },   // ;
            new byte[] { 0x00, 0x08, 0x14, 0x22, 0x41, 0x00 },   // <
            new byte[] { 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 },   // =
            new byte[] { 0x00, 0x00, 0x41, 0x22, 0x14, 0x08 },   // >
            new byte[] { 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 },   // ?
            new byte[] { 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E },   // @
            new byte[] { 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C },   // A
            new byte[] { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 },   // B
            new byte[] { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 },   // C
            new byte[] { 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C },   // D
            new byte[] { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 },   // E
            new byte[] { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 },   // F
            new byte[] { 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A },   // G
            new byte[] { 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F },   // H
            new byte[] { 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 },   // I
            new byte[] { 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 },   // J
            new byte[] { 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 },   // K
            new byte[] { 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 },   // L
            new byte[] { 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F },   // M
            new byte[] { 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F },   // N
            new byte[] { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E },   // O
            new byte[] { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 },   // P
            new byte[] { 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E },   // Q
            new byte[] { 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 },   // R
            new byte[] { 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 },   // S
            new byte[] { 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 },   // T
            new byte[] { 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F },   // U
            new byte[] { 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F },   // V
            new byte[] { 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F },   // W
            new byte[] { 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 },   // X
            new byte[] { 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 },   // Y
            new byte[] { 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 },   // Z
            new byte[] { 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 },   // [
            new byte[] { 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55 },   // 55
            new byte[] { 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 },   // ]
            new byte[] { 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 },   // ^
            new byte[] { 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 },   // _
            new byte[] { 0x00, 0x00, 0x01, 0x02, 0x04, 0x00 },   // '
            new byte[] { 0x00, 0x20, 0x54, 0x54, 0x54, 0x78 },   // a
            new byte[] { 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 },   // b
            new byte[] { 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 },   // c
            new byte[] { 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F },   // d
            new byte[] { 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 },   // e
            new byte[] { 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 },   // f
            new byte[] { 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C },   // g
            new byte[] { 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 },   // h
            new byte[] { 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 },   // i
            new byte[] { 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 },   // j
            new byte[] { 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 },   // k
            new byte[] { 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 },   // l
            new byte[] { 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 },   // m
            new byte[] { 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 },   // n
            new byte[] { 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 },   // o
            new byte[] { 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 },   // p
            new byte[] { 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC },   // q
            new byte[] { 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 },   // r
            new byte[] { 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 },   // s
            new byte[] { 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 },   // t
            new byte[] { 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C },   // u
            new byte[] { 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C },   // v
            new byte[] { 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C },   // w
            new byte[] { 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 },   // x
            new byte[] { 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C },   // y
            new byte[] { 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 },   // z
            new byte[] { 0x00,0x00, 0x06, 0x09, 0x09, 0x06  }   // horiz lines
        };

        public SPI.Configuration conf; 
        public SPI SPI_port;
        public OutputPort RST = new OutputPort(Pins.GPIO_PIN_D9, false);
        public OutputPort DC = new OutputPort(Pins.GPIO_PIN_D8, false);
        public OutputPort BL = new OutputPort(Pins.GPIO_PIN_D7, false);

        public Nokia3310()
        {
            Init();
        }

        void Init()
        {
            conf = new SPI.Configuration(Pins.GPIO_PIN_D10, false, 0, 0, false, true, 1000, SPI.SPI_module.SPI1);
            SPI_port = new SPI(conf);

            Reset();

            Write_Cmd(new byte[1] { 0x21 });
            Write_Cmd(new byte[1] { 0xc0 });
            Write_Cmd(new byte[1] { 0x06 });
            Write_Cmd(new byte[1] { 0x13 });
            Write_Cmd(new byte[1] { 0x20 });

            Clear();

            Write_Cmd(new byte[1] { 0x0c });
        }

        public void Leds(bool On)
        {
            BL.Write(On);
        }

         void Write_Cmd(byte[] Cmd)
        {
            DC.Write(false);
            SPI_port.Write(Cmd);
        }

        void Write_Data(byte[] Data)
        {
            DC.Write(true);
            SPI_port.Write(Data);
        }

        void Reset()
        {
            RST.Write(false);
            Thread.Sleep(200);
            RST.Write(true);
            Thread.Sleep(200);
        }

        public void Clear()
        {
            ushort i;

            Set_XY(0, 0);

            for (i = 0; i < 504; i++)
                Write_Data(new byte[1] {0x00});

            Set_XY(0, 0);
        }

        public void Set_XY(byte X, byte Y)
        {
            Write_Cmd(new Byte[1] { (byte)(0x40 | Y) });  // column
            Write_Cmd(new Byte[1] { (byte)(0x80 | X) });  // row
        }

        public void Write_Char(char c, bool highlight)
        {
            byte line;
            byte ch;

            byte a = (byte)((byte)c - 32);

            for (line = 0; line < 6; line++)
            {
                ch = font6_8[a][line];
                ch = highlight ? ch : (byte)(ch ^ (byte)0xff);
                Write_Data(new byte[1] { ch });
            }
        }

        public void Draw_Bmp_Pixel(byte X, byte Y, byte[] map,
                                byte Pix_x, byte Pix_y)
        {
            ushort i, n;
            byte row;

            if (Pix_y % 8 == 0)
                row = (byte)(Pix_y / 8);
            else
                row = (byte)(Pix_y / 8 + 1);

            for (n = 0; n < row; n++)
            {
                Set_XY(X, Y);
                for (i = 0; i < Pix_x; i++)
                {
                    Write_Data(new byte[1] { map[i + n * Pix_x] });
                }
                Y++;
            }
        }

    }
}

Here a the sample of use (Program.cs) :

using System.Threading;

namespace NetduinoNokia3310
{
    public class Program
    {

        static byte[] AVR_bmp =
        {
            0x00,0x00,0x00,0x00,0x80,0xE0,0xFC,0xFF,0xFF,0xFF,0x7F,0xFF,0xFE,0xFC,0xF0,0xC1,
            0x0F,0x7F,0xFF,0xFF,0xFE,0xF0,0xC0,0x00,0x00,0x00,0xC0,0xF8,0xFE,0xFF,0xFF,0x3F,
            0x07,0xC1,0xF0,0xFE,0xFF,0xFF,0xFF,0x1F,0x07,0x8F,0xCF,0xFF,0xFF,0xFF,0xFE,0xFC,
            0x00,0x80,0xF0,0xFC,0xFF,0xFF,0xFF,0x7F,0x7F,0x78,0x78,0x79,0x7F,0x7F,0xFF,0xFF,
            0xFC,0xF0,0xC1,0x07,0x1F,0xFF,0xFF,0xFE,0xFC,0xFF,0xFF,0xFF,0x1F,0x07,0xC1,0xF0,
            0xFE,0xFF,0xFF,0x3F,0x0F,0x0F,0x7F,0xFF,0xFF,0xFF,0xFF,0xE7,0x07,0x03,0x01,0x00,
            0x02,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
            0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x1F,0x3F,0x1F,0x07,0x00,0x00,0x02,0x03,0x03,
            0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00
        };

        public static void Main()
        {

            Shield.Nokia3310 LCD = new Shield.Nokia3310();

            LCD.Leds(true);

            byte i, j;
            for (i = 0; i < 6; i++)
            {
                for (j = 0; j < 14; j++)
                {
                    LCD.Set_XY((byte)(j * 6), (byte)i);
                    LCD.Write_Char((char)((byte)(i * 14 + j + 32)), true);
                }
            }

            Thread.Sleep(5000);

            LCD.Clear();

            LCD.Draw_Bmp_Pixel(20, 1, AVR_bmp, 48, 24);

            Thread.Sleep(5000);

            LCD.Leds(false);

        }

    }
}


It would nice to have a Netduino bmp instead of AVR :)

Enjoy,
Pascal



#85 Board layout file

Posted by pascal06 on 05 August 2010 - 09:27 PM in Netduino 2 (and Netduino 1)

Hello, I'm waiting for my Netduino :D Congratulation for this incredible product !!! I try to load the board layout file from the latest eagle program without success -> invalid file. Perhaps I'm wrong, it's not a eagle file ? Thanks again for this product, Kind regards, Pascal (France)




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.