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 29-April 23)


By content type

See this member's


Sort by                Order  

#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)



#90 MCU Embedded ethernet

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

Hello, It seems that AT91SAM7X512 have a embedded ETHERNET capability, Do you plan to make it available ? Best regards, 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



#151 Ethernet Shield from nuelectronics

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

Hello, I use this shield with arduino with success: http://www.nuelectro...1&products_id=4 May I use this shield with netduino ? My question is essentially regarding hardware, For the software, I have already see that lwIP have some enc28j60 driver, Many thanks for all, Pascal I'm currently waiting to receive my netduino, somewhere between Canada & France ....



#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



#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



#232 European experience

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

Hello, I just receive my netduino today in France, I'm very happy :) I ordered on August 5 at Proto Advantage, only 6 days to receive it, and only 5$ for shipping, So don't hesitate even if you live in Europe, Enjoy, Pascal



#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



#261 5v vs 3.3v

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

Hello, I use multiple shield with my Arduino, and before trying to plug any shield on my netduino, I would like to be sure that's not dangerous regarding TTL level : http://www.nuelectro...&products_id=20 http://www.nuelectro...&products_id=12 http://www.nuelectro...1&products_id=2 http://www.nuelectro...1&products_id=4 In general, what's happen if I plug a shield designed for Arduino (TTL 5v) to netduino ? Is it dangerous or it simply doesn't work ? Sorry for this basic electronic question, but I'm a software guy, need to stay humble with electronic, /pascal



#267 5v vs 3.3v

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

The Netduino's digital pins output 3.3V signals, but inputs from shields can be up to 5V. Analog pins in analog mode need to stay at <=3.3V.

Pretty much all of the Arduino shields should work electrically, with the following two exceptions:
1. If the shield provides 5V analog inputs, you'd need to modify it to provide 3.3V analog inputs instead.
2. If the shield requires 5V data signals, you'd need to put a level converter in between the Netduino and the shield.
3. Netduino has 4 hardware PWM (vs. 6 PWM on the Arduino's AVR chip). We may have "software PWM" in the future, but for now you might lose a small bit of functionality on certain motor control shields.

That's it. Netduino provides 5.0V and 3.3V power just like Arduino. Many/most shields should work. We're compiling a list and will put it on an upcoming Netduino "accessories" page.

Does that help?

Chris


Many thanks Chris,


In conclusion, only analog input is risky. But is it realy dangerous for netduino or not ?

/pascal



#906 Circuit Simulator!

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

I found this circuit simulator and thought some of you might be able to prototype with it....
http://www.falstad.com/circuit/

Tell me if you like it :)


Definitly userful to learn electronic ... Yes, I like it ...

A dream can be a netduino emulator with this circuit simulator :)



#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



#926 Ethernet Shield from nuelectronics

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

It appears that the board is driving 5V to the joystick for analog input--and the schematic's quote of 3.3V/5V compatiblity is for the "logic I/O" (screen, etc.) only.

Can you move the VCC for the joystick to the 3.3V pin easily? Do they have a board with a joystick ADC at 3.3V?

Chris


Thanks,

No on both questions. But I can replicate the same schema outside the shield with another analogue pin.

What about enc28j60 ? what's your advice,

/pascal



#927 Ethernet Shield from nuelectronics

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

That's odd that the joystick wouldn't work. Right on the schematic at

http://www.nuelectro...ia_3310_lcd.pdf

it says

"VCC - 3.3V - 5V
All ligic I/O compatible with
5V & 3.3V logic level"


The joystick use 5v and voltage divider using resistances (a solution to not use one pin per direction). So, in fact, I can use some of direction (like up/down ..) but not all. Just because the voltage on AD0 is more than 3.3v in some situation. Without pushing any direction, AD0 return 1023 and also when I push right direction. The most important is, without any push, the AD0 is connected to 5v with a 2K resistance. Is it risky ?

/pascal



#980 PK enc28j60

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

Hello, I'm trying to compile netduino firmware with lwIP and enc28j60, First off all, I need to remove a lot of features to have suffisant flash memory (like SD, File System, Stream ...), I just need to have a advice regarding pin definition in file enc28j60_LWIP_config_stubs.cpp : #define ENC28J60_INT MC9328MXL_GPIO::c_Port_A_06 <- #define ENC28J60_CS MC9328MXL_GPIO::c_Port_A_04 <- #define ENC28J60_CS_ACTIVE FALSE #define ENC28J60_MSK_IDLE FALSE #define ENC28J60_MSK_SAMPLE_EDGE TRUE #define ENC28J60_16BIT_OP FALSE #define ENC28J60_CLOCK_RATE_KHZ 25000 #define ENC28J60_CS_SETUP_USEC 0 #define ENC28J60_CS_HOLD_USEC 0 #define ENC28J60_MODULE MC9328MXL_SPI::c_SPI1 <- What can I define for theses three define ? My ethernet shield use PB2 (Arduino 10) for CS and PD2 (Arduino 2) for INT. Thanks in advance for your help, Pascal PS: I cannot build your std firmware with gcc without flash memory issue. I suppose that you use RDVS instead, which is more efficient, right ?



#1036 Temperature Sensor?

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

I have published the article on my blog: http://forums.netdui...-blinking-leds/

Now I will look into writing the driver for one-wire DS18B20 sensor.


Hello Szymo,

Congratulation for your article !!

Regarding OneWire, look at this:
http://bansky.net/bl...k/comments.html

Here is my test:
OutputPort port = new OutputPort(Pins.GPIO_PIN_D2, false);

while (true)
{
    port.Write(true);
    port.Write(false);
}

With my oscilloscope I see that the period is 115.28 uS. So it take 115.28 / 2 = 57.64 uS to change Digital Port state. To slow for OneWire communication.

It seems that we need a OneWire implementation in NativeCode, like tinyclr:
http://www.tinyclr.c...de to NETMF.pdf

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



#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



#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



#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



#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



#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



#1180 Communication between 2 or more duino's

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

3 or more you've got a couple choices - you can use I2C to do it and give each a different address or you can use ethernet.

Personally, as a network engineer I'd say ethernet but there aren't any ethernet drivers for the netduino (yet!).


+1 for Ethernet.
It's seems that I2C .net MF implementation (like SPI) is always master. So, we cannot use I2C to cummunicate between 2 Netduino(s). Or we need to write another driver.
And I2C is very slow for that distance.

Pascal



#1182 Communication between 2 or more duino's

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

The I2C on the ARM7X chip is master-only. We'll see what we can do on speeding up Ethernet support...

Chris


I2C master-only is a limitation of ARM7X or .NET micro framework ?
Perhaps I'm wrong, but when I read the datasheet, it's seems that the ATMEL used on netduino support both mode, no ?

Pascal




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.