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.

GB30's Content

There have been 10 items by GB30 (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#4424 Using DMA

Posted by GB30 on 02 November 2010 - 08:31 AM in Netduino 2 (and Netduino 1)

Hi.
I tried to investigate how can I use Interop in order to integrate low level code with microframework.
I don't understand this :
1) I use wrapper class to microframework. But how can microframework know what kind of microprocessor is working? How can it compile this C or C++ code?

Thanks











Actually, register access is rather simple - if I omit code that checks address to prevent access to invalid/reserved areas:

// C# Wrapper

using System;
using Microsoft.SPOT;
using System.Runtime.CompilerServices;

namespace XXX.NETMF.Hardware
{
  public static class Register
  {
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern uint Read(uint address);

    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void Write(uint address, uint value);
  }
}

// Native Code (.cpp)

#include "XXX_NETMF_Hardware.h"
#include "XXX_NETMF_Hardware_XXX_NETMF_Hardware_Register.h"

using namespace XXX::NETMF::Hardware;

UINT32 Register::Read(UINT32 address, HRESULT &hr)
{
  // FIXME: Check address
  UINT32 retVal = *(UINT32*)address; 
  return retVal;
}

void Register::Write(UINT32 address, UINT32 value, HRESULT &hr)
{
  // FIXME: Check address
  *(UINT32 *)address = value;
}




#3338 Using DMA

Posted by GB30 on 01 October 2010 - 07:35 AM in Netduino 2 (and Netduino 1)

Hi GB30,

You can write a native code class for that and compile it into the firmware if you'd like.

We could also add one directly in the SecretLabs namespace--the big reason we haven't is because we didn't want to introduce any "raw power tools" when the board was brand new (as it would be easy for new users to incorporate drivers with raw register access--and not understand the consequences).

Are there particular features you're looking for?

Chris



Hi Chris.
My request is refered to have the complete control of AT91.
For example: I want to use low power mode, but I have to write some uP registers; I want to change PLL configuration in order to change clock; I want to use ADC in 8 bit mode or 10 bit mode... and so on.
I would like to control AT91 and then I would like to work in high level: I work in C or assembler so I understand the consequences of raw register access; working with OOP is useful in order to accelerate programming process and interface with PC world.
So is there an example to follow in order to write a native code class for that and compile it into the firmware ?


Thanks a lot



#3288 Using DMA

Posted by GB30 on 30 September 2010 - 03:19 PM in Netduino 2 (and Netduino 1)

Hi GB30,

What exactly are you wanting to do? [Read/write directly to memory locations in the AT91SAM7X512?]

Chris



Exact, for example read directly memory locations.



#3287 Clock - Time to on and off an output pin

Posted by GB30 on 30 September 2010 - 03:17 PM in General Discussion

Hi GB30,

Your C# code is running at the managed code layer, so it's being interpreted by the .NET runtime...there is a lot going on behind the scenes. If you'd like to take advantage of the raw speed of the microcontroller, you can write your time-sensitive code in C++ (with a C# wrapper class) and compile it into the Netduino firmware.

You can also erase the Netduino and use C/C++ and SAM-BA for a fast 100% native code solution--but that sort of defeats the purpose of having .NET on there. We put the erase pad on the board so that it's fully "hackable."

Chris




Thank you for the response. Obviously there is a lot going on behind the scenes.
Is there an example of C# wrapper class?



#3278 Clock - Time to on and off an output pin

Posted by GB30 on 30 September 2010 - 01:58 PM in General Discussion

Hi! I observed with an oscilloscope the behaviour of this code: static OutputPort out1 = new OutputPort(Pins.GPIO_PIN_D0, false); public static void Main() { while (1==1) { out1.Write(true); out1.Write(false); } } and I measure on pin ton time: it is 60 us. I think that it is a long time for only 2 instructions! if Netduino clock is around 48 MHz, it is a long period Have you got some ideas about it? Thanks!



#3266 Using DMA

Posted by GB30 on 30 September 2010 - 09:29 AM in Netduino 2 (and Netduino 1)

Hi. At this moment is it possible to use DMA of AT91SAM7x512 with micro framework? Thanks



#2219 More blinking leds

Posted by GB30 on 13 September 2010 - 07:39 AM in Project Showcase

I think you are right. The classes from SecretLabs.NETMF.Hardware.Netduino namespace should be actually declared as internal classes on Netduino class. Then it would be clear that you have to write for example Netduino.Pins.GPIO_PIN_D3. Currently this code is invalid. If I remmember ut is done this way in GHI and DeviceSolutions SDKs.



Hi. I'm tryng to use Netduino. First Examples run correctly on board, but I controll pin numbers in Netduino dll:

public static class Pins
{
public const Cpu.Pin GPIO_NONE = -1;
public const Cpu.Pin GPIO_PIN_A0 = 59;
public const Cpu.Pin GPIO_PIN_A1 = 60;
public const Cpu.Pin GPIO_PIN_A2 = 61;
public const Cpu.Pin GPIO_PIN_A3 = 62;
public const Cpu.Pin GPIO_PIN_A4 = 10;
public const Cpu.Pin GPIO_PIN_A5 = 11;
public const Cpu.Pin GPIO_PIN_D0 = 27;
public const Cpu.Pin GPIO_PIN_D1 = 28;
public const Cpu.Pin GPIO_PIN_D10 = 54;
public const Cpu.Pin GPIO_PIN_D11 = 17;
public const Cpu.Pin GPIO_PIN_D12 = 16;
public const Cpu.Pin GPIO_PIN_D13 = 18;
public const Cpu.Pin GPIO_PIN_D2 = 0;
public const Cpu.Pin GPIO_PIN_D3 = 1;
public const Cpu.Pin GPIO_PIN_D4 = 12;
public const Cpu.Pin GPIO_PIN_D5 = 51;
public const Cpu.Pin GPIO_PIN_D6 = 52;
public const Cpu.Pin GPIO_PIN_D7 = 3;
public const Cpu.Pin GPIO_PIN_D8 = 4;
public const Cpu.Pin GPIO_PIN_D9 = 53;
public const Cpu.Pin ONBOARD_LED = 55;
public const Cpu.Pin ONBOARD_SW1 = 29;
}
}


They don't match with numbers on schematic : why?
For example onboard_SW1 = 29, but pin on schematic is 75!!!

Thnak you!



#1928 Sizing a Battery?

Posted by GB30 on 08 September 2010 - 12:01 PM in Netduino 2 (and Netduino 1)

I am also interested in this, especially in using Netduino in battery powered scenarios.


I have not had enough time to dig into details yet, but quick overlook reveals that there is already code for Power Management Controller (PMC) functionality (see AT91_PMC.h in DeviceCode\Targets\Native\AT91\DeviceCode) used for example during board initialization and even switching to Idle mode function is there (AT91_SAM_Driver::Sleep() in AT91_SAM.cpp). Thus it may be as easy as calling the driver's Sleep() function at right moment in PowerState class methods (shouldn't it be there already?).

Additionally, peripherals can be selectively enabled/disabled by manipulating bits in PMC control registers, so the biggest 'problem' is to carefully choose what to disable in what power state, because it is being left "to be determined by the hardware vendor". Or simply provide a managed method with parameters which peripheral to enable/disable, something like PowerManager.Switch(UsbController | UnusedPins, Off), where UnusedPins means all the I/O pins not accessible on Netduino board (not exposed via headers).




Thank you for the reply. But I don't understand how to manipulate bits in PMC control register throught microframework.
How can I find AT91_PMC.h? I don't find in Netduino documentation.

Thanks



#1891 Sizing a Battery?

Posted by GB30 on 07 September 2010 - 12:08 PM in Netduino 2 (and Netduino 1)

Hi Chris! Thank you very much! I'm studyng the possibility of using Netduino under the 30 mA, using Low Power mode of Atmel MCU, but I don't find the solution with C++. You said that Power State Class, in particular Sleep method doesn't work. So have you some ideas about this problem? Have you some examples of C++ code? Thanks a lot



#1881 Sizing a Battery?

Posted by GB30 on 07 September 2010 - 03:29 AM in Netduino 2 (and Netduino 1)

I have the same need, i.e. power management in order to have less than 30 mA in "idle" mode.
But can I write ARM register with microframework ? I mean: in C language I can use Assembler directive, but here how can I work with uP register?

thanks



Power management is a project we'll be looking at later this fall. We'll also be doing a power audit to make sure things like SPI interfaces get turned off when you stop using them, etc.

Chris





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.