DSPRelated.com
Forums

Using CAN Controller mapped in external memory?

Started by nova...@gmail.com January 28, 2009
Hi all
I dont have experience working with aDSP21060.
I have CAN Controller mapped in external memory 0x400000, this controller has internal register from 00 to 0xff. How can i do to read and write this register?

Thanks you in advance

Marcelo
Hi,

Write to it like a memory mapped peripheral, like if each of the CAN controller's register was an acces in extrenal SRAM.


Jaime Andr Aranguren Cardona
j...@ieee.org
j...@computer.org

________________________________
From: "n...@gmail.com"
To: a...
Sent: Wednesday, January 28, 2009 5:52:39 PM
Subject: [adsp] Using CAN Controller mapped in external memory?
Hi all
I dont have experience working with aDSP21060.
I have CAN Controller mapped in external memory 0x400000, this controller has internal register from 00 to 0xff. How can i do to read and write this register?

Thanks you in advance

Marcelo


Hi Jaime

Thanks you for your answered. But I can't understand how can i do to define
a specific memory position for all CAN registers.
For example:

I make a segment memory in external memory "seg_CAN" start:0x400000
end:0x400FFF. I have a register "CAN_Status" in adress 0x400005 . If I
defined a variable "CAN_Status" in segment memory "seg_CAN" the compiler
can put it in some place from 0x400000 to 0x400FFF, and not in 0x400005.
How can i do to define memory position 0x400005 for "CAN_Status" ?
Thanks you in advance

Marcelo

2009/1/29 Jaime Andres Aranguren Cardona

> Hi,
>
> Write to it like a memory mapped peripheral, like if each of the CAN
> controller's register was an acces in extrenal SRAM.
> Jaime Andr Aranguren Cardona
> j...@ieee.org
> j...@computer.org
> ------------------------------
> *From:* "n...@gmail.com"
> *To:* a...
> *Sent:* Wednesday, January 28, 2009 5:52:39 PM
> *Subject:* [adsp] Using CAN Controller mapped in external memory?
>
> Hi all
> I dont have experience working with aDSP21060.
> I have CAN Controller mapped in external memory 0x400000, this controller
> has internal register from 00 to 0xff. How can i do to read and write this
> register?
>
> Thanks you in advance
>
> Marcelo
>
>
Hi,

I do not recall exactly the directive to use in VDSP, which you should use to define variables to be in an exact position in memory (external memory in your case). I remember using them sometime ago, maybe directly for assembler.

But in any case, you can use pointers. Have a look at how for the compiler the addresses of memory mapped registers are defined in a header file, and how they are referenced by content in the C program, where the addresses are used.

An example:

In .h file for the addresses. Typically in a defBF5XX.h file:
#define CAN_Status 0x400005

In .h file for the mempry mapped registers. Typically in a cdefBF5XX.h file:
#include "defBF5XX.h"
#define pCAN_Status ((volatile unsigned short *) CAN_Status)

In .c file
*pCAN_Status = 0x00000001; // Write a 0x00000001 to the address 0x400005
unsigned short value = *pCAN_Status; // Read the value in address 0x400005, and store it in "value"

So, the static palcement of variables is not needed, and can be easiliy handled / ported with header files. Here using short or int depends on the data bus width, in your case for external memory.

Ah! I wrote the example thinking of Blackfin, but you can easyly understand and modify for a SHARC!

I hope this helps.

Regards,


Jaime Andr Aranguren Cardona
j...@ieee.org
j...@computer.org

________________________________
From: marcelo B
To: Jaime Andres Aranguren Cardona
Cc: a...
Sent: Tuesday, February 3, 2009 12:41:19 PM
Subject: Re: [adsp] Using CAN Controller mapped in external memory?
Hi Jaime

Thanks you for your answered. But I can't understand how can i do to define a specific memory position for all CAN registers.
For example:

I make a segment memory in external memory "seg_CAN" start:0x400000 end:0x400FFF. I have a register "CAN_Status" in adress 0x400005 . If I defined a variable "CAN_Status" in segment memory "seg_CAN" the compiler can put it in some place from 0x400000 to 0x400FFF, and not in 0x400005.
How can i do to define memory position 0x400005 for "CAN_Status" ?
Thanks you in advance

Marcelo

2009/1/29 Jaime Andres Aranguren Cardona

Hi,

Write to it like a memory mapped peripheral, like if each of the CAN controller's register was an acces in extrenal SRAM.


Jaime Andr Aranguren Cardona
jaime.aranguren@ ieee.org
jaime.aranguren@ computer. org

________________________________
From: "novadsp@gmail. com"
To: adsp@yahoogroups. com
Sent: Wednesday, January 28, 2009 5:52:39 PM
Subject: [adsp] Using CAN Controller mapped in external memory?

Hi all
I dont have experience working with aDSP21060.
I have CAN Controller mapped in external memory 0x400000, this controller has internal register from 00 to 0xff. How can i do to read and write this register?

Thanks you in advance

Marcelo




Hi,

I knew that this are memory mapped to a fixed location and can't be altered per our wish.

Find the CAN related .h files in the installation location for details on which memory location the registers are mapped..

Hope it will be helpful

Nagaraju

+91-9600076673

--- On Mon, 9/2/09, Jaime Andres Aranguren Cardona wrote:

> From: Jaime Andres Aranguren Cardona
> Subject: Re: [adsp] Using CAN Controller mapped in external memory?
> To: "marcelo B" , "Jaime Andres Aranguren Cardona"
> Cc: a...
> Date: Monday, 9 February, 2009, 2:59 PM
> Hi,
>
> I do not recall exactly the directive to use in VDSP, which
> you should use to define variables to be in an exact
> position in memory (external memory in your case). I
> remember using them sometime ago, maybe directly for
> assembler.
>
> But in any case, you can use pointers. Have a look at how
> for the compiler the addresses of memory mapped registers
> are defined in a header file, and how they are referenced by
> content in the C program, where the addresses are used.
>
> An example:
>
> In .h file for the addresses. Typically in a defBF5XX.h
> file:
> #define CAN_Status 0x400005
>
> In .h file for the mempry mapped registers. Typically in a
> cdefBF5XX.h file:
> #include "defBF5XX.h"
> #define pCAN_Status ((volatile unsigned short *)
> CAN_Status)
>
> In .c file
> *pCAN_Status = 0x00000001; // Write a 0x00000001
> to the address 0x400005
> unsigned short value = *pCAN_Status; // Read the value in
> address 0x400005, and store it in "value"
>
> So, the static palcement of variables is not needed, and
> can be easiliy handled / ported with header files. Here
> using short or int depends on the data bus width, in your
> case for external memory.
>
> Ah! I wrote the example thinking of Blackfin, but you can
> easyly understand and modify for a SHARC!
>
> I hope this helps.
>
> Regards,
>
>
> Jaime Andr Aranguren Cardona
> j...@ieee.org
> j...@computer.org
>
>
>
>
> ________________________________
> From: marcelo B
> To: Jaime Andres Aranguren Cardona
>
> Cc: a...
> Sent: Tuesday, February 3, 2009 12:41:19 PM
> Subject: Re: [adsp] Using CAN Controller mapped in external
> memory?
>
>
> Hi Jaime
>
> Thanks you for your answered. But I can't understand
> how can i do to define a specific memory position for all
> CAN registers.
> For example:
>
> I make a segment memory in external memory
> "seg_CAN" start:0x400000 end:0x400FFF. I have a
> register "CAN_Status" in adress 0x400005 . If I
> defined a variable "CAN_Status" in segment memory
> "seg_CAN" the compiler can put it in some place
> from 0x400000 to 0x400FFF, and not in 0x400005.
> How can i do to define memory position 0x400005 for
> "CAN_Status" ?
>
>
> Thanks you in advance
>
> Marcelo
>
>
>
>
> 2009/1/29 Jaime Andres Aranguren Cardona
>
>
> Hi,
>
> Write to it like a memory mapped peripheral, like if each
> of the CAN controller's register was an acces in
> extrenal SRAM.
>
>
> Jaime Andr Aranguren Cardona
> jaime.aranguren@ ieee.org
> jaime.aranguren@ computer. org
>
>
>
>
> ________________________________
> From: "novadsp@gmail. com" > com>
> To: adsp@yahoogroups. com
> Sent: Wednesday, January 28, 2009 5:52:39 PM
> Subject: [adsp] Using CAN Controller mapped in external
> memory?
>
>
>
> Hi all
> I dont have experience working with aDSP21060.
> I have CAN Controller mapped in external memory 0x400000,
> this controller has internal register from 00 to 0xff. How
> can i do to read and write this register?
>
> Thanks you in advance
>
> Marcelo
Get perfect Email ID for your Resume. Grab now http://in.promos.yahoo.com/address