MC9S12NE64 External Bus Access

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S12NE64 External Bus Access

885 Views
ace_avm
Contributor II

Hi,

 

 

We are using the MC9S12NE64 external bus to access some external memory device. We are using connections similar to that of the EVB9S12NE64 evaluation board on the hardware side. Only the XCS signal is used as the chip-select signal for the peripheral. When we were trying out a code to access the external bus, we observed that we are not getting the XCS (external chip-select) signal  to assert for the bus-cycles. We are using the following configuration to initialize the external bus interface:

MODE register is set for Normal Expanded Wide Mode access (MODC=MODB=MODA=1,IVIS=EMK=EME=0)

The Read/Write pin function was enabled by setting the RDWE bit (bit 2) of the PEAR register.

 

Is there some configuration steps which I  have missed out? Or, am I doing it in the wrong way?

 

Pls help...

 

 

Thanks and regards,

ace_avm

Labels (1)
0 Kudos
1 Reply

227 Views
ace_avm
Contributor II

Hi,

 

We did resolve the earlier issue by making the XCS pin act as a GPIO and then asserting/deasserting it as and when required. But there is some strange behaviour I am observing with the EVB9S12NE64 evaluation board from Axiom. Our code snippet for accessing the external bus goes like this:


#define PORTE_WR_SELECT_BIT2  0
#define PORTE_RD_SELECT_BIT2  4




void main(void)

{

  for(;;)

  {

            ext_bus_port_wr_rd();

  }

}



void ext_bus_port_wr_rd(void)
{
    unsigned int i,wr_addr = 0x0001, wr_data = 0x0001;
      
    /* external bus port access init function*/
      ext_bus_port_init();
    
      ext_bus_port_wr(wr_addr, wr_data);
    /* include bus port read function here */
}



/* Initializing the external bus port.*/

void ext_bus_port_init(void)
{
    DDRK_BIT6 = 1;
    MODE = (MODE_MODC_MASK+MODE_MODB_MASK+MODE_MODA_MASK); // port K is unused
    PORTK_BIT6 = 1; // enable the external chip select.
  
    PEAR = PORTE_RD_SELECT_BIT2;
}


/* Writng a data on external bus port.*/

void ext_bus_port_wr(unsigned int address,unsigned int data)
{

    /* Enable the read/write# pin to write */

    PORTE =  PORTE_WR_SELECT_BIT2;
  
    /* Writing address  */
    PORTAB = address;
    /* Writing Data */
    PORTAB = data;
}

 



We are trying to write an address as well as data value of 0x0001 to the bus port. When we are probing with an oscilloscope on the multiplexed address as well as data pins of the controller, we are seeing values on all the 16 bits of the address/data bus instead of bit 0 only. Our primary conclusion was that this problem had something to do with the for loop used in the main function. But when we tried removing the for loop used in main(), the code itself is not getting executed.

 

Can anyone help me to resolve this issue?

 

 

Thanks and regards,

ace_avm

 

Message Edited by ace_avm on 2009-06-23 11:23 AM
Message Edited by ace_avm on 2009-06-23 11:24 AM
0 Kudos