SoC design

  • Thread starter stararvigu@gmail.com
  • Start date
S

stararvigu@gmail.com

Guest
Hi All;

This is Ravi.I am very new in the world of SoC.
I have been working on project where i need to interface 8051 micro
controller with i2c bus controller,SPI,USB, and PIC. I need to load
8051 through C code. Can u suggest me
How processor will read the status register of peripheral devices?
means what i need to write inside interrupt service routine? I am
using SDCC compiler.

Thanks
Ravi Gupta
 
Hello,
I am not sure about SDCC compiler.. i think the basic idea is to load
a program from ROM. Assuming that the program image is loaded onto the
ROM before the start of the testcase.
So in the test.. i think you will basically need to read the
register... (memory mapped) of the SPI(USB.. etc) and depending upon
the data read.. take further action..
something like..

mov r0,#addr_of_spi_status_reg
mov r1,@r0
and r1,*#0x01

and do something depending upon resulting condition...
 
On Jan 30, 1:42 pm, rakesh <rakes...@gmail.com> wrote:
Hello,
I am not sure about SDCC compiler.. i think the basic idea is to load
a program from ROM. Assuming that the program image is loaded onto the
ROM before the start of the testcase.
So in the test.. i think you will basically need to read the
register... (memory mapped) of the SPI(USB.. etc) and depending upon
the data read.. take further action..
something like..

mov r0,#addr_of_spi_status_reg
mov r1,@r0
and r1,*#0x01

and do something depending upon resulting condition...
Thanks Rakesh, But the Files of the 8051 and the Supporting protocols
are in Verilog, so how from C code can 8051 read a register of the
connecting protocol say SPI, or I2C.
 
Hello,
I am of the understanding that the compiler will change the C code
into an assemby code executable by 8051.
This code must be loaded into ROM by a $readmemh and the controller
fetches instructions from there.

now suppose the register address of SPI is 0x2000 and you want to read
it,
I would do this...

read_value=(int *)(0x2000);

this would be converted by ur compiler into a code similar to the one
written above... (i hope it can).
I have worked with armcc compiler and it is definitely able to do
this...

hope this helps..

Rakesh
 
On Jan 31, 1:41 pm, rakesh <rakes...@gmail.com> wrote:
Hello,
I am of the understanding that the compiler will change the C code
into an assemby code executable by 8051.
This code must be loaded into ROM by a $readmemh and the controller
fetches instructions from there.

now suppose the register address of SPI is 0x2000 and you want to read
it,
I would do this...

read_value=(int *)(0x2000);

this would be converted by ur compiler into a code similar to the one
written above... (i hope it can).
I have worked with armcc compiler and it is definitely able to do
this...

hope this helps..

Rakesh
Thanx Rakesh,
Even i tried the almost similar thing like
ubyte *spi_addr;
spi_addr = 0x1234;
*spi_addr = 8;
.........
.......

but here my port of SPI is connected to wishbone interface port of
8051,so how can i make sure that data 8 is going into the SPI
port.Just by defining address of the port in .C file????
i.e how i can fix the addresses of the devices port in .H file?
Thanx for your concern :)
 
stararvigu@gmail.com wrote:

On Jan 31, 1:41 pm, rakesh <rakes...@gmail.com> wrote:
Hello,
I am of the understanding that the compiler will change the C code
into an assemby code executable by 8051.
This code must be loaded into ROM by a $readmemh and the controller
fetches instructions from there.

now suppose the register address of SPI is 0x2000 and you want to read
it,
I would do this...


but here my port of SPI is connected to wishbone interface port of
8051,so how can i make sure that data 8 is going into the SPI
port.Just by defining address of the port in .C file????
i.e how i can fix the addresses of the devices port in .H file?
Thanx for your concern :)
No just define something like the following in C
volatile xdata at 0xFE50 unsigned char mux;
mux = myvalue;
etc
in verilog check for address FE50.
taco
 
On Feb 6, 8:15 pm, taco <trala...@joepie.nl> wrote:
stararv...@gmail.com wrote:
On Jan 31, 1:41 pm, rakesh <rakes...@gmail.com> wrote:
Hello,
I am of the understanding that the compiler will change the C code
into an assemby code executable by 8051.
This code must be loaded into ROM by a $readmemh and the controller
fetches instructions from there.

now suppose the register address of SPI is 0x2000 and you want to read
it,
I would do this...

but here my port of SPI is connected to wishbone interface port of
8051,so how can i make sure that data 8 is going into the SPI
port.Just by defining address of the port in .C file????
i.e how i can fix the addresses of the devices port in .H file?
Thanx for your concern :)

No just define something like the following in C
volatile xdata at 0xFE50 unsigned char mux;
mux = myvalue;
etc
in verilog check for address FE50.
taco
Hi Rakesh;
Thank you so much,I did that now i am able to access
wishbone ports.Now the other problem is that the 8051 code i am using
doesn't have a wishbone_sel line but the SPI i am using have the same.
So can you suggest me what should be done,because that sel pin will
not have access through C code. Also SPI has 32 bit data line whereas
8051 has 8 bit data line,so i want to use that sel pin as byte
select,is it possible?
 
On Feb 7, 2:09 pm, "stararv...@gmail.com" <rav...@hcl.in> wrote:
On Feb 6, 8:15 pm, taco <trala...@joepie.nl> wrote:





stararv...@gmail.com wrote:
On Jan 31, 1:41 pm, rakesh <rakes...@gmail.com> wrote:
Hello,
I am of the understanding that the compiler will change the C code
into an assemby code executable by 8051.
This code must be loaded into ROM by a $readmemh and the controller
fetches instructions from there.

now suppose the register address of SPI is 0x2000 and you want to read
it,
I would do this...

but here my port of SPI is connected to wishbone interface port of
8051,so how can i make sure that data 8 is going into the SPI
port.Just by defining address of the port in .C file????
i.e how i can fix the addresses of the devices port in .H file?
Thanx for your concern :)

No just define something like the following in C
volatile xdata at 0xFE50 unsigned char mux;
mux = myvalue;
etc
in verilog check for address FE50.
taco

Hi Rakesh;
              Thank you so much,I did that now i am able to access
wishbone ports.Now the other problem is that the 8051 code i am using
doesn't have a wishbone_sel line but the SPI i am using have the same.
So can you suggest me what should be done,because that sel pin will
not have access through C code. Also SPI has 32 bit data line whereas
8051 has 8 bit data line,so i want to use that sel pin as byte
select,is it possible?- Hide quoted text -

- Show quoted text -
The problem is not clear...
I am sure u can't use one line to select the different bytes.
U will need atleast 2 lines to make them work as address byte selects..
(32 bits on micro controller side and 8 bits on spi side) i think.

Rakesh
 
On Feb 13, 10:47 am, rakesh <rakes...@gmail.com> wrote:
On Feb 7, 2:09 pm, "stararv...@gmail.com" <rav...@hcl.in> wrote:



On Feb 6, 8:15 pm, taco <trala...@joepie.nl> wrote:

stararv...@gmail.com wrote:
On Jan 31, 1:41 pm, rakesh <rakes...@gmail.com> wrote:
Hello,
I am of the understanding that the compiler will change the C code
into an assemby code executable by 8051.
This code must be loaded into ROM by a $readmemh and the controller
fetches instructions from there.

now suppose the register address of SPI is 0x2000 and you want to read
it,
I would do this...

but here my port of SPI is connected to wishbone interface port of
8051,so how can i make sure that data 8 is going into the SPI
port.Just by defining address of the port in .C file????
i.e how i can fix the addresses of the devices port in .H file?
Thanx for your concern :)

No just define something like the following in C
volatile xdata at 0xFE50 unsigned char mux;
mux = myvalue;
etc
in verilog check for address FE50.
taco

Hi Rakesh;
Thank you so much,I did that now i am able to access
wishbone ports.Now the other problem is that the 8051 code i am using
doesn't have a wishbone_sel line but the SPI i am using have the same.
So can you suggest me what should be done,because that sel pin will
not have access through C code. Also SPI has 32 bit data line whereas
8051 has 8 bit data line,so i want to use that sel pin as byte
select,is it possible?- Hide quoted text -

- Show quoted text -

The problem is not clear...
I am sure u can't use one line to select the different bytes.
U will need atleast 2 lines to make them work as address byte selects..
(32 bits on micro controller side and 8 bits on spi side) i think.

Rakesh
Hi Rakesh thanks for your valuable suggestions.
I could do what you suggest me. But have new prob. I was using
partial address decoding scheme for my peripheral devices. With the
help of given address range , i was generating Chip select for the
devices, when the number of devices and their memory range was fixed.
Now can i do it in generic manner means if i connect one more device
then i should not go into changing CS logic. And memory allocation
should also be generic.

Thank you
Regards
Ravi Gupta
 

Welcome to EDABoard.com

Sponsor

Back
Top