DSPRelated.com
Forums

I2C interface for 568xx

Started by Santi Corera September 18, 2002
Is there any application note or available code to implement the I2C protocol ?
I am interested specially in mastering the bus and, if possible, ussing a timer
interrupt (probably associated to the sclk signal)
Thanks in advance.




There is an Application Brief BR1553/D, "Virtual I2C Bus Peripheral on
DSP56F8xx", you can get it at:
http://e-www.motorola.com/brdata/PDFDB/docs/BR1553.pdf

This Application Brief does not have any code, but it does describe the hardware
and software interfaces in some detail. The only drawback is that for high I2C
bit rates, you will have to write the interrupt routines in assembler to get the
required speed. Even so, it uses up a lot of the available CPU time. We
decided that for our applications the amount of CPU time used to emulate the I2C
bus was excessive, so we use all SPI bus devices even though they cost slightly
more than the equivalent I2C devices.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com
-----Original Message-----
From: Santi Corera [mailto:]
Sent: Wednesday, September 18, 2002 7:22 AM
To:
Subject: [motoroladsp] I2C interface for 568xx Is there any application note or available code to implement the I2C protocol ?
I am interested specially in mastering the bus and, if possible, ussing a timer
interrupt (probably associated to the sclk signal)
Thanks in advance. _____________________________________
Note: If you do a simple "reply" with your email client, only the author of this
message will receive your answer. You need to do a "reply all" if you want your
answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/motoroladsp

More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/



HI all:
Using Codewarrier for 56800 5.0 and Motorola SDK2.5, can I create
a project using internal pFLASH and external xRAM on DSP56805EVM. The
default setting from SDK is just flash( use internal memory only) and
external RAM (use external memory only ) while CW5.0 can provide such a
target setting.
Any suggestion is welcome.
ggh


Attachment (not stored)
winmail.dat
Type: application/ms-tnef


You can use the Flash target without any changes. Although the Linker Command
File "linker.cmd" states that:
"# Linker.cmd file for DSP56803EVM/DSP56805EVM
# using internal data memory only ( EX = 0, Boot Mode 0A )",
the fact that the EX bit is 0 does not prevent you from using external xRAM.

You can put xRAM .bss sections into the external xRAM by doing the following in
your Linker Command File "linker.cmd":

In the "MEMORY" section:
.xExtRAM (RW) : ORIGIN = 0x2000, LENGTH = 0xDF80
.xExtRAM_Mirror (RWX) : ORIGIN = 0x2000, LENGTH = 0xDF80

In the "SECTIONS" section:
#*******************************************************************************
.DataForExtDataRAM :
{

# .bss sections

extram_data.c (.bss)

} > .xExtRAM_Mirror
#*******************************************************************************

The above will put all uninitialized data (.bss) from the file "extram_data.c"
into the external xRAM area. We have done this and it works for us in our
projects. It is much more difficult to put the initialized data (.data) section
into external xRAM because you would have to modify the startup code in the SDK
file "arch.c", and somehow differentiate between .data going to internal xRAM
and .data going to external xRAM. We don't think it is worth all the effort
that would be involved, so we just put the selected .bss sections into the
external xRAM.

I hope this helps, please let me know if you have any questions about this.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com > -----Original Message-----
> From: Gonggh [mailto:]
> Sent: Wednesday, September 18, 2002 8:22 AM
> To:
> Subject: [motoroladsp] A question about SDK?
>
> HI all:
> Using Codewarrier for 56800 5.0 and Motorola SDK2.5, can I create a
project using internal pFLASH and external xRAM on DSP56805EVM. The default
setting from SDK is just flash( use internal memory only) and external RAM (use
external memory only ) while CW5.0 can provide such a target setting.
> Any suggestion is welcome.
> ggh



Hi Ari,

Yes, you have a very good idea, to use the external memory for all the data and
use the internal memory for the stack. This allows the initialized data (.data)
section to be placed into the external xRAM without having to make any changes
to the startup code in the SDK file "arch.c".

Here's the changes to the linker.cmd file to do this for the '805 chip:

In the "MEMORY" section:
.xAvailable (RW) : ORIGIN = 0x0000, LENGTH = 0x0020
.xOSRegisters (RW) : ORIGIN = 0x0020, LENGTH = 0x0010
.xCWRegisters (RW) : ORIGIN = 0x0030, LENGTH = 0x0010
.xIntRAM (RW) : ORIGIN = 0x0040, LENGTH = 0x05C0
.xIntRAM_Mirror (RWX) : ORIGIN = 0x0040, LENGTH = 0x05C0
.xStack (RW) : ORIGIN = 0x0600, LENGTH = 0x0200
.xReserved (R) : ORIGIN = 0x0800, LENGTH = 0x0400
.xPeripherals (RW) : ORIGIN = 0x0C00, LENGTH = 0x0400
.xFlash (R) : ORIGIN = 0x1000, LENGTH = 0x1000
.xExtRAM (RW) : ORIGIN = 0x2000, LENGTH = 0xDF80
.xExtRAM_Mirror (RWX) : ORIGIN = 0x2000, LENGTH = 0xDF80
.xCoreRegisters (RW) : ORIGIN = 0xFF80, LENGTH = 0x0080 In the "SECTIONS" section:
#*******************************************************************************
.ApplicationInitialzedData : AT (ADDR(.pFlash) + SIZEOF(.pFlash) / 2 +
SIZEOF(.pIntRAM_Mirror) / 2 )
{
# Define variables for C initialization code

F_Xdata_start_addr_in_ROM = ADDR(.pFlash) + SIZEOF(.pFlash) / 2 +
SIZEOF(.pIntRAM_Mirror) / 2;
F_StackAddr = ADDR(.xStack);
F_StackEndAddr = ADDR(.xStack) + SIZEOF(.xStack) / 2 - 1;
F_Xdata_start_addr_in_RAM = .;
_X_DATA_ADDR = .;

# Place the rest of the data into External Data RAM

* (.rodata)
* (.data)
* (fp_state.rodata)
* (fp_state.data)
* (rtlib.rodata)
* (rtlib.data)

F_Xdata_ROMtoRAM_length = . - _X_DATA_ADDR;

} > .xExtRAM_Mirror
#*******************************************************************************

#*******************************************************************************
.DataForDataRAM :
{
# allocates space for .ApplicationInitializedData section

. = (ADDR(.xExtRAM_Mirror) + SIZEOF(.xExtRAM_Mirror) / 2);

# Define variables for C initialization code

F_Xbss_start_addr = .;
_X_BSS_ADDR = .;

# .bss sections

* (rtlib.bss.lo)
* (rtlib.bss)
* (.bss)

F_Xbss_length = . - _X_BSS_ADDR;

} > .xExtRAM
#******************************************************************************* I thought the above information would be useful to other developers, so I am
posting this message to the motoroladsp discussion group.

I hope this helps, please let me know if you have any questions about this. Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com
-----Original Message-----
From: atid2 [mailto:]
Sent: Wednesday, October 23, 2002 3:44 AM
To: Art Johnson
Subject: Re: A question about SDK? Dear Art,
I have read your response to the below question. And I have a
similar problem. But I need to use the xExtRam for the initialized
data also. This is because this part of my code is larger than the
xIntRam.
Isn't there a linker.cmd file that fits those requirements?
Could I just use the external memory for all the data and maybe use
the internal memory for the stack?
I'm a newbie and I find it hard to change the SDK linker.cmd file to
fit my requirements, without doing any damage.
I'm using the SDK with the 56827EVM.

Thank you in advance
Ari Tidhar

--- In motoroladsp@y..., "Art Johnson" <art@p...> wrote:
> You can use the Flash target without any changes. Although the
Linker Command File "linker.cmd" states that:
> "# Linker.cmd file for DSP56803EVM/DSP56805EVM
> # using internal data memory only ( EX = 0, Boot Mode
0A )",
> the fact that the EX bit is 0 does not prevent you from using
external xRAM.
>
> You can put xRAM .bss sections into the external xRAM by doing the
following in your Linker Command File "linker.cmd":
>
> In the "MEMORY" section:
> .xExtRAM (RW) : ORIGIN = 0x2000, LENGTH = 0xDF80
> .xExtRAM_Mirror (RWX) : ORIGIN = 0x2000, LENGTH = 0xDF80
>
> In the "SECTIONS" section:
>
#********************************************************************
***********
> .DataForExtDataRAM :
> {
>
> # .bss sections
>
> extram_data.c (.bss)
>
> } > .xExtRAM_Mirror
>
#********************************************************************
***********
>
> The above will put all uninitialized data (.bss) from the
file "extram_data.c" into the external xRAM area. We have done this
and it works for us in our projects. It is much more difficult to
put the initialized data (.data) section into external xRAM because
you would have to modify the startup code in the SDK file "arch.c",
and somehow differentiate between .data going to internal xRAM
and .data going to external xRAM. We don't think it is worth all
the effort that would be involved, so we just put the selected .bss
sections into the external xRAM.
>
> I hope this helps, please let me know if you have any questions
about this.
>
> Regards,
>
> Art Johnson
> Senior Systems Analyst
> PMC Prime Mover Controls Inc.
> 3600 Gilmore Way
> Burnaby, B.C., Canada
> V5G 4R8
> Phone: 604 433-4644
> FAX: 604 433-5570
> Email: art@p...
> http://www.pmc-controls.com > > -----Original Message-----
> > From: Gonggh [mailto:ggh@d...]
> > Sent: Wednesday, September 18, 2002 8:22 AM
> > To: motoroladsp@y...
> > Subject: [motoroladsp] A question about SDK?
> >
> > HI all:
> > Using Codewarrier for 56800 5.0 and Motorola SDK2.5, can
I create a project using internal pFLASH and external xRAM on
DSP56805EVM. The default setting from SDK is just flash( use
internal memory only) and external RAM (use external memory only )
while CW5.0 can provide such a target setting.
> > Any suggestion is welcome.
> > ggh