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