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.
Photo

Using DMA


  • Please log in to reply
10 replies to this topic

#1 GB30

GB30

    Member

  • Members
  • PipPip
  • 10 posts

Posted 30 September 2010 - 09:29 AM

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

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 September 2010 - 02:18 PM

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

#3 GB30

GB30

    Member

  • Members
  • PipPip
  • 10 posts

Posted 30 September 2010 - 03:19 PM

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.

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 September 2010 - 10:58 PM

Exact, for example read directly memory locations.


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

#5 GB30

GB30

    Member

  • Members
  • PipPip
  • 10 posts

Posted 01 October 2010 - 07:35 AM

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

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 01 October 2010 - 07:38 AM

Hi GB30, Here's a good article on creating native code Interop libraries for .NET MF... http://adeneo-embedd...-framework.html I'll also put a "Memory/Register" class down as an official feature request. We'd just have to try to warn users not to take too much rope... :) Chris

#7 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 01 October 2010 - 08:14 AM

I'll also put a "Memory/Register" class down as an official feature request.

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;
}


#8 GB30

GB30

    Member

  • Members
  • PipPip
  • 10 posts

Posted 02 November 2010 - 08:31 AM

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;
}



#9 sweetlilmre

sweetlilmre

    Advanced Member

  • Members
  • PipPipPip
  • 62 posts

Posted 02 November 2010 - 07:26 PM

Hi,

Would it be possible to hook the DMA up to external SRAM (obviously not with the current board, but assuming a board with suitably connected SRAM was developed, does the CPU have this capability?

I would like to read and transform a large volume of data very quickly,
something along the lines of this project except that I am looking for an 8-bit colour display and hence a block of SRAM to store the display buffer in (plus other bits)

-(e)

#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 02 November 2010 - 07:34 PM

sweetlilmre, the AT91SAM7X512 MCU does not support external RAM directly. You could add external RAM via SPI, but you'd have to read/write data slowly via the SPI interface. Chris

#11 sweetlilmre

sweetlilmre

    Advanced Member

  • Members
  • PipPipPip
  • 62 posts

Posted 04 November 2010 - 05:24 PM

sweetlilmre, the AT91SAM7X512 MCU does not support external RAM directly. You could add external RAM via SPI, but you'd have to read/write data slowly via the SPI interface.

Chris


Hi,

Thanks for the info. I guess for this particular application I'll need to look at something else like a STM32.
Hmm pity :( I really like the AT91 chips.

-(e)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.