I have a custom C6720 board with a 16 bit asynchronous bus. I have a block within this external memory decoded for peripherals. I am using CCS and writing the code in C++. My issue is when I try to write this peripheral area, I am getting a word type writes (multiple strobes of the EM_CS2 line) and the additional strobes are causing data corruption (as the 8 bits are being outputted correctly on the first strobe, and the 8 bits change when making the additional strobe(s)).
In my C code, I have a header file setting up pointers to these peripheral locations ie:
unsigned int* const dspgpio= (unsigned int*)0x900C0020;
And I have in my main a function to select the memory block (using GPIO pins for and write the information:
void wexdat(unsigned int* const Address, char wdata)
{
if (Address>=(unsigned int* const)0x900C0000 && Address<(unsigned int* const)0x900E0000)
{//Write to On Board Peripheals
*MC0_PDCLR=0xFFFFFFFF;
*MC0_PDSET=0x00000C00;
}
else
{//Write to Off Board Peripheals
*MC0_PDCLR=0xFFFFFFFF;
*MC0_PDSET=0x00000C10;
}
*Address=wdata;
}
I have tried passing wdata as a short as well with no change in the result.
I have also done experiments with the ACR1 register, if setup for 8 bit bus, 4 strobes occur; if setup for 16 bit bus, 2 strobes occur; however, if setup for 32 bit which is an illegal condition for this processor, only 1 strobe occurs.
Does anyone know a legal way through software to make a byte write. It does say byte writes are possible through the manual. Or can I run in this illegal state. I do not have SDRAM so the refreshing mode is not an issue also, if I need to write words to my memories, I can always switch the ACR1 register back to a 16 bit bus.
Thank you in advance for your help. Regards