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..."