DL40 newbie question

Hi,

I’ve been experimenting with the DL40 and yet I can’t seem to get it to do anything!

I’ve got a genericdaisylink module on my design surface and am using the code here (http://wiki.tinyclr.com/index.php?title=DL40_Module), but none of the pinouts seem to change. The page seems to hint that this should blink an (onboard??) LED. But I can’t see how it can.

Before I start messing with re-flashing the DL40 to do what I need it to do, I’d really like to get the easy stuff working.

Cheers

Simon

Welcome to the forum!

What socket did you connect it to and on what mainboard?

I do not think the stock firmware for DL40 does anything beside give the daisy link framework. From there, you can extend it anyway you like.

At bare minimum the mainboard will detect it and you can read/write the virtual registers.

Welcome to the community.

@ simonmiddlemiss - I do not know what firmware is loaded on the module when it ships, but the sample firmware from the wiki definitely does work as advertised. So you might have to at least write that firmware to the module.

Note: You will need to fix the serial comms code for the loader to work. This is due to some changes made by MS to the serial library. Here is a post on the topic
http://www.tinyclr.com/forum/topic?id=9195&page=1#msg91739

I have a few new DL40 here (I like them so I keep spares :slight_smile: ) if I get a chance this weekend I will check what the default firmware does.

Hope this one more clear, that code will blink LED at port 2, pin 5


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
 
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
 
namespace Gadgeteer_TestDL40Module
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
 
            Debug.Print("Program Started");
 
            new Thread(ThreadTest).Start();
 
        }
        void ThreadTest()
        {
            while (true)
            {
                Thread.Sleep(100);
                WriteGPIO(genericDaisylink, 2, 5, HIGH );
                Thread.Sleep(100);
                WriteGPIO(genericDaisylink, 2, 5, LOW );
            }
        }
 
        void WriteGPIO(GenericDaisylink dlmodule, byte port, byte pin, byte value)
        {
            dlmodule.WriteRegister(PORT_REGISTER, port);
            dlmodule.WriteRegister(PIN_REGISTER, pin);
            dlmodule.WriteRegister(DIR_REGISTER, DIR_OUTPUT);
            dlmodule.WriteRegister(VALUE_REGISTER, value);
            dlmodule.WriteRegister(ACTIVE_REGISTER, REG_ACT_ENABLE);
        }
        // Define DL40 register
        const int PORT_REGISTER = 0x1;
        const int PIN_REGISTER = 0x2;
        const int DIR_REGISTER = 0x3;
        const int VALUE_REGISTER = 0x4;
        const int ACTIVE_REGISTER = 0x0;
        // Define DL40 pin dir
        const int DIR_INPUT = 0x0;
        const int DIR_OUTPUT = 0x1;
        // Define active register value
        const int REG_ACT_DISABLE = 0x0;
        const int REG_ACT_ENABLE = 0x1; 
        // Define pin state
        const int LOW = 0x0;
        const int HIGH = 0x1;
    }
}


Thanks for the replies. I had assumed the default firmware was the sample firmware. Will reflash and update you all.

Cheers

S

Finally got around to doing this, and having reflashed the DL40 and run the code that Dat provided all is good! Now on to writing something a little more complex in Kiel!

Cheers

Simon