MOD54415x external IO's chip selsect
MOD54415x external IO's chip selsect
Hello,
i am using the MOD54415x and i need to use the external IO's.
I use that sample to init the chip select, but i get the error "'sim' was not declared in this scope" , can any one advice?
void InitChipBoardSelect12( void )
{
//Enable the Write Chip Select
sim.cs[1].cscr = 0x2180; // 0010 0001 1000 0000
sim.cs[1].csmr = 0x00000001;
sim.cs[1].csar = ( IO_DIG_WR >> 16 );
//Enable the Read Chip Select
sim.cs[2].cscr = 0x2180; // 0010 0001 1000 0000
sim.cs[2].csmr = 0x00000001;
sim.cs[2].csar = ( IO_DIG_RD >> 16 );
bInit = TRUE;
}
i am using the MOD54415x and i need to use the external IO's.
I use that sample to init the chip select, but i get the error "'sim' was not declared in this scope" , can any one advice?
void InitChipBoardSelect12( void )
{
//Enable the Write Chip Select
sim.cs[1].cscr = 0x2180; // 0010 0001 1000 0000
sim.cs[1].csmr = 0x00000001;
sim.cs[1].csar = ( IO_DIG_WR >> 16 );
//Enable the Read Chip Select
sim.cs[2].cscr = 0x2180; // 0010 0001 1000 0000
sim.cs[2].csmr = 0x00000001;
sim.cs[2].csar = ( IO_DIG_RD >> 16 );
bInit = TRUE;
}
Re: MOD54415x external IO's chip selsect
sim.cs not valid for the 5441x platform. I think you may be building for the incorrect platform.
Re: MOD54415x external IO's chip selsect
so what sim register i need to use?
Re: MOD54415x external IO's chip selsect
54415 has two sims....
sim1 and sim2.
The chipcelects are sim2.cs[6]
and have fields:
vudword csar; /* 0x0000 -> 0x0003 - Chip Select Address Register */
vudword csmr; /* 0x0004 -> 0x0007 - Chip Select Mask Register */
vudword cscr; /* 0x0008 -> 0x000B - Chip Select Control Register */
sim1 and sim2.
The chipcelects are sim2.cs[6]
and have fields:
vudword csar; /* 0x0000 -> 0x0003 - Chip Select Address Register */
vudword csmr; /* 0x0004 -> 0x0007 - Chip Select Mask Register */
vudword cscr; /* 0x0008 -> 0x000B - Chip Select Control Register */
Re: MOD54415x external IO's chip selsect
I am using this code, but i don't see the CS pin's moving, or the IO pins moving, can any one advice?
void InitChipBoardSelect12( void )
{
iprintf("InitChipBoardSelect12 \r\n");
//Enable the Write Chip Select
sim2.cs[4].cscr = 0x2180; // 0010 0001 1000 0000
sim2.cs[4].csmr = 0x00000001; // Set the valid bit for this chipselect
sim2.cs[4].csar = ( IO_DIG_WR >> 16 ); // Set base address
//Enable the Read Chip Select
sim2.cs[5].cscr = 0x2180; // 0010 0001 1000 0000
sim2.cs[5].csmr = 0x00000001; // Set the valid bit for this chipselect
sim2.cs[5].csar = ( IO_DIG_RD >> 16 ); // Set base address
bInit = TRUE;
}
void DisableChipSelect12( void )
{
iprintf("DisableChipSelect12 \r\n\n");
sim2.cs[4].csmr = 0x0;
sim2.cs[5].csmr = 0x0;
bInit = FALSE;
}
/*
* WriteToOutputs
*/
void WriteToOutputs( unsigned short output )
{
if (!bInit) InitChipBoardSelect12();
*(unsigned short *)(IO_DIG_WR) = output;
}
/*
* ReadFromInputs
*/
unsigned short ReadFromInputs( void )
{
if (!bInit) InitChipBoardSelect12();
return *(unsigned short *) (IO_DIG_RD);
}
void InitChipBoardSelect12( void )
{
iprintf("InitChipBoardSelect12 \r\n");
//Enable the Write Chip Select
sim2.cs[4].cscr = 0x2180; // 0010 0001 1000 0000
sim2.cs[4].csmr = 0x00000001; // Set the valid bit for this chipselect
sim2.cs[4].csar = ( IO_DIG_WR >> 16 ); // Set base address
//Enable the Read Chip Select
sim2.cs[5].cscr = 0x2180; // 0010 0001 1000 0000
sim2.cs[5].csmr = 0x00000001; // Set the valid bit for this chipselect
sim2.cs[5].csar = ( IO_DIG_RD >> 16 ); // Set base address
bInit = TRUE;
}
void DisableChipSelect12( void )
{
iprintf("DisableChipSelect12 \r\n\n");
sim2.cs[4].csmr = 0x0;
sim2.cs[5].csmr = 0x0;
bInit = FALSE;
}
/*
* WriteToOutputs
*/
void WriteToOutputs( unsigned short output )
{
if (!bInit) InitChipBoardSelect12();
*(unsigned short *)(IO_DIG_WR) = output;
}
/*
* ReadFromInputs
*/
unsigned short ReadFromInputs( void )
{
if (!bInit) InitChipBoardSelect12();
return *(unsigned short *) (IO_DIG_RD);
}
Re: MOD54415x external IO's chip selsect
What are your read and write base addresses, and why are you shifting them when you initialize? Make sure they are in an unused address range.
Re: MOD54415x external IO's chip selsect
sulliwk06 has a very good point. Chip selects will only activate when the address range they are configured for is read or written to. So you need to ensure you are familiar with the memory map for the platform you are using, and are accessing unused space (there is plenty of it).
Also, the compiler is very aggressive regarding optimization. If accessing external hardware you will want to use the volatile keyword for any variables, flags, etc you use. Volatile tells the compiler not to optimize, which avoids things like repeated register reads ending up in a processor register instead of doing an external bus cycle.
Also, the compiler is very aggressive regarding optimization. If accessing external hardware you will want to use the volatile keyword for any variables, flags, etc you use. Volatile tells the compiler not to optimize, which avoids things like repeated register reads ending up in a processor register instead of doing an external bus cycle.
Re: MOD54415x external IO's chip selsect
Hi,Thanks all for your replays,
for the 54115 i am using this base address:
#define BASEADDRESS 0x10000000
#define IO_DIG_WR BASEADDRESS
#define IO_DIG_RD BASEADDRESS+0x1000000
like the sample in the prodact page:
https://www.netburner.com/products/core ... s/mod5441x
https://www.netburner.com/support/doc-s ... ion-5/file.
what am i doing wrong?
for the 54115 i am using this base address:
#define BASEADDRESS 0x10000000
#define IO_DIG_WR BASEADDRESS
#define IO_DIG_RD BASEADDRESS+0x1000000
like the sample in the prodact page:
https://www.netburner.com/products/core ... s/mod5441x
https://www.netburner.com/support/doc-s ... ion-5/file.
what am i doing wrong?
Re: MOD54415x external IO's chip selsect
I'm not sure that example is correct. Based on the reference manual (MCF54415RM.pdf) section 20.3.1 the Chip-Select Address Register should only use the upper 16 bits, so if you are bit shifting it 16 to the right, then it definitely shouldn't work. Try putting base address without shifting it and see what happens.
Re: MOD54415x external IO's chip selsect
Hi, i try to NOT shift the address, but i don't see any change on the IO pins.
do you have a working example?
do you have a working example?