I am trying to use the Mini-FlexBus on the MCF52259. I have written the following code:
#include "support_common.h" #include <stdio.h> #define INDEX (*(vuint16 *)(0x60005555)) // Transaction with Index Reg. #define DATA (*(vuint16 *)(0x60010000)) // Transaction with Memory loc. #define MCF_GPIO_CLKOUTPAR (*(vuint8 *)(0x40100077)) void FB_Init(void) { // Initialize Pins for Mini-FlexBus MCF_CCM_CCE = MCF_CCM_CCE_MBMOD; // Configure Clock to Mini-FlexBus same as fsys (1:1) MCF_GPIO_PTEPAR = 0xFF; // PTE[7..0] -> FB_AD[7..0] MCF_GPIO_PTFPAR = 0xFF; // PTF[7..0] -> FB_AD[15..8] MCF_GPIO_PTGPAR = 0xEF; // PTG[6..7] -> FB_D[1..0] // PTG[5] -> FB_CS0 // PTG[3..0] -> FB_AD[19..16] MCF_GPIO_PTHPAR = 0x5555; // PTH[7] -> FB_RW // PTH[6] -> FB_OE // PTH[5..0] -> FB_D[7..2] MCF_GPIO_PASPAR = 0x10; // PAS[2] -> FB_ALE MCF_GPIO_CLKOUTPAR = 0x2; // CLKOUT -> FB_CLK // External Device Address Settings MCF_FBCS0_CSAR = MCF_FBCS_CSAR_BA(0x60000000); // Base Address -> 0x6000_0000 MCF_FBCS0_CSCR = MCF_FBCS_CSCR_WS(1) // One wait state | MCF_FBCS_CSCR_AA // Auto acknowledge enable | MCF_FBCS_CSCR_MUX // Used in Multiplexed mode | MCF_FBCS_CSCR_PS_16; // Data Bus is 16 Bit MCF_FBCS0_CSMR = MCF_FBCS_CSMR_BAM_128K // Address range [0x6000_0000-0x6001_FFFF] | MCF_FBCS_CSMR_V; // Start CS0 } int main(void) { FB_Init(); for(;;) { INDEX = 0x1234; // Address = 0x60005555, Data = 0x1234 } return (0); }
What I intend to do is send Data 0x1234 to address 0x60005555 continuously. But it doesn't appear that my code does so. Could anyone tell me what I am possibly doing wrong?
Ameet Kaustav.
I learnt that the address space (0x60000000 to 0x6001FFFF) which I was using was overlapping with the IPS address space. Now I have changed my address space to 0x90000000 to 0x9003FFFF. And I think I'm getting proper addresses on my logic analyzer. There are minor glitches though between address and data changes on the 16 bit data lines.
PS. The default address space in MCF52259 is:
Internal 512 KByte Flash: 0x00000000 to 0x0007FFFF
Internal 64 KByte SRAM: 0x20000000 to 0x2000FFFF
1 GByte Internal Peripheral System Address Space: 0x40000000 to 0x7FFFFFFF
Ameet Kaustav.
I am able to use the Mini-FlexBus of MCF52259 to generate signals of the 6800 processor.
Ameet Kaustav.
Hi Ameet,
What changes did you do to make it work?
Can you send me your linker file? what compiler did you use?
Thanks,
-Sam
Hi Sam,
As menitioned in Message 2 above, I was using the wrong address space. I am sorry, I can't send you the linker file because I don't have it at the moment. As far as I remember, I hadn't made any manual changes in the linker file and I'd used the compiler that comes with CodeWarrior Studio for ColdFire Architectures v7.1.
Ameet Kaustav.
Did you configure any of the port direction registers?
MCF_GPIO_DDRTx for ports E, F, G??
Thanks,
- Sam