Am having trouble getting the EMI (Bank0) to work. All I am getting is an error when I try to read or write to the bank. My write is *((unsigned char*)0x3C000000) I have tried setting up the EMI by hand (i.e. following the manual) and also used the CAPS tool and 91x_caps.h. Neither work and give me the same error. I am using IAR Kickstart with J-Link. Any samples or help that would be great. Thanks Mark
Thanks...but no luck. I had the CS line setup and also tried with your code (albeit in byte demux bus). What is happening is not that the bus is not being read but that my debug session is stopped when I try and work with external. See below....
i = *((unsigned int *)0x740000E0); i = *((unsigned int *)0x3C0000E0); I can step/run over the first line (to an EMI setup) but if I do the second one to Bank0 then I get trapped into ''Exception vectors'' in 91x_vect.c I just think there must be something else to do with setup? Seems like there is a config missing to permit debug mode with EMI or something like that. Do I have to change the XCL? Quite honestly I do not see why an example is not provided by ST.
I found a lot of problems with DEBUG enabled. I'm working with DEBUG directive disabled. I had the same problems in the past. another think: if you use the buffered address I think you have to enable the buffered mode with IAR compiler see the 91x_init.s file.
thanks...it does seem to be something like 'it just does not like debug mode' as I lose the clock and end up with all my stacks full and the PC reset to 0x00000000.
I have made a board mod (to implement RD as GPIO) and am running the bus in GPIO mode instead of EMI mode to work around this problem. I will look at it in more detail later.
I'm having the same problem. If you figure out anything please post it. I'll do the same. My code/setup is practically identical to yours, so it must be something not obvious.
SCU_EMIModeConfig(_EMI_Mode); is not valid in v1.1 of the libs. This is my setup for 16bit data 24bit adr multiplexed: I have not had any problems with debug flag. /* GPIO Setup */ SCU_APBPeriphClockConfig( __GPIO0, ENABLE ); SCU_APBPeriphClockConfig( __GPIO7, ENABLE ); SCU_APBPeriphClockConfig( __GPIO8, ENABLE ); SCU_APBPeriphClockConfig( __GPIO9, ENABLE ); GPIO_DeInit( GPIO0 ); GPIO_StructInit( &GPIO_InitStruct ); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_4; GPIO_InitStruct.GPIO_Direction = GPIO_PinOutput; GPIO_InitStruct.GPIO_Type = GPIO_Type_PushPull; GPIO_InitStruct.GPIO_Alternate = GPIO_OutputAlt2; GPIO_Init( GPIO0, &GPIO_InitStruct ); GPIO_DeInit( GPIO7 ); GPIO_StructInit( &GPIO_InitStruct ); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_All & (~GPIO_Pin_7); GPIO_InitStruct.GPIO_Direction = GPIO_PinOutput; GPIO_InitStruct.GPIO_Type = GPIO_Type_PushPull; GPIO_InitStruct.GPIO_Alternate = GPIO_OutputAlt2; GPIO_Init( GPIO7, &GPIO_InitStruct ); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7; GPIO_InitStruct.GPIO_Alternate = GPIO_OutputAlt3; GPIO_Init( GPIO7, &GPIO_InitStruct ); SCU_AHBPeriphClockConfig( __EMI, ENABLE ); SCU_EMIModeConfig( SCU_EMI_MUX ); SCU_EMIALEConfig( SCU_EMIALE_LEN1, SCU_EMIALE_POLHigh ); GPIO_EMIConfig( ENABLE ); /* Enable EMI clock */ EMI_DeInit(); EMI_StructInit( &EMI_InitStruct ); EMI_InitStruct.EMI_Bank_MemWidth = EMI_Width_HalfWord; EMI_Init( EMI_Bank0, &EMI_InitStruct ); It would be really good if ST posted a sample application, it took me quite a while to get this emi bus going !! Cheers Spencer Oliver Anglia
Turns out I had a clock gating gotcha. If you're having problems with debugging and EMI (processor losing clock) make sure you have the following.
One must enable both __EMI and __EMI_MEM_CLK in the clock gating control 0 register. SCU_AHBPeriphClockConfig( __EMI | __EMI_MEM_CLK, ENABLE ); Apparently the EMI works as long as you don't debug even with the clock turned off. Go figure.
Please find here attached an STR9 project aims to write some bytes in EMI bus. It can be useful for you (as template) to configure the EMI relating to your needs. Note: both mode (Buffering & unbuffering mode are working fine for me. Best regards, Eris