Hi,
I just bougt a M52259EVB board and do not know how to access the on board MRAM.
I loaded my own code to read the MRAM (CS0 configured as an 8-bit port), but it would lock me in "Access Error Excpetion".
I notice that there is a CPLD residing on the same bus but could not find its equations from the CD shipped with the board.
I configured the Mini-bus as:
MCF_FBCS0_CSAR=0x80000000; //CS0 base address 0x80000000
MCF_FBCS0_CSCR=0x003F3D40; //15WS, AA, 8 bit
MCF_FBCS0_CSMR=0x00070001; //CS0 512KB and validate
I do not know what I did wrong and please help.
Thanks a lot.
Solved! Go to Solution.
Thanks Mark.
I found the problem. I disabled CS1 and the on-board CPLD would corrupt the Mini-bus. After active CS1 it works fine.
Hi JackD
You can find some information about using the MRAM here:
http://www.utasker.com/forum/index.php?topic=504.0
http://www.utasker.com/forum/index.php?topic=596.0
Here is some code which was used to configure for the above tests:
fnConfigureBus(0, 2); // configure the FlexBus interface accordingly with 1:2 clocking and 2 wait states // Configuration of FlexBus for MRAM use. This serves as reference in case of a requirement for a more general interface//static void fnConfigureBus(int iSpeed, int iWaitStates){ unsigned long ulMask = 0x0000ffff; unsigned long ulMaskPower = 0x00010000; unsigned long ulSize = SIZE_OF_NVRAM; #if defined USB_BIGENDIAN unsigned short usExtendedMode = USB_END; #else unsigned short usExtendedMode = 0; #endif POWER_UP(POWER_MINI_FLEXBUS); // power up the mini-flex bus module if (iSpeed != 0) { // FlexBus should be clocked from system clock rather than half clock usExtendedMode |= MBMOD; } // configure the port lines for non-multiplexed FlexBus PTEPAR = 0xff; // address A0..A7 PTFPAR = 0xff; // address A8..A15 PTGPAR = (0x0f | ((PRIMARY_FUNCTION_D << BIT_7_D_SHIFT) | (PRIMARY_FUNCTION_D << BIT_6_D_SHIFT) | (PRIMARY_FUNCTION_D << BIT_5_D_SHIFT))); // A16..A19, D0, D1, CS_B PTHPAR = ((PRIMARY_FUNCTION_Q << (2 * 0)) | (PRIMARY_FUNCTION_Q << (2 * 1)) | (PRIMARY_FUNCTION_Q << (2 * 2)) | (PRIMARY_FUNCTION_Q << (2 * 3)) | (PRIMARY_FUNCTION_Q << (2 * 4)) | (PRIMARY_FUNCTION_Q << (2 * 5)) | (PRIMARY_FUNCTION_Q << (2 * 6)) | (PRIMARY_FUNCTION_Q << (2 * 7))); // data D2..D7, OE_B, RW_B // configure the chip select CSAR0 = (START_OF_FLASH + SIZE_OF_FLASH); // position immediately after internal FLASH in the memory map while (ulSize > ulMaskPower) { ulMask <<= 1; ulSize -= ulMaskPower; ulMaskPower <<= 1; } CSMR0 = ((ulMask & BAM_MASK) | FB_CS_VALID); CSCR0 = (PORT_SIZE_8 | FB_AA | BSTW | BSTR | ((iWaitStates << WAIT_STATE_SHIFT) & WAIT_STATE_MASK)); CCM_CCE = usExtendedMode; // set the extended setting - note that this register can only be written once after a reset!}
Regards
Mark
www.uTasker.com
- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."
Thanks Mark.
I found the problem. I disabled CS1 and the on-board CPLD would corrupt the Mini-bus. After active CS1 it works fine.