cancel
Showing results for 
Search instead for 
Did you mean: 

Internal ram serving like eprom emulator.

AOliv.1
Associate II

Sometime ago, i tested with sucess a stm32f417 running on 168MHz, reading one full portx, using for address a array in memory and put result on another porty.

So, i bring a more powerfull mcu stm32H750 with 1Mb ram, and tested the same code.

when i run the logic analizer, the H750 is very slow to show data writed to portx. around 160~240ns. All code inside a while.

Moved array around all memory regions, and no better result.

So, tried EXTI to trigger function. and same delay to show data on port.

And after numerous tests, no find one way to get best results on this chip running at CPU 400, (GPIO 200).

// macros
 
#define SET_DATA_MODE_INPUT GPIOD->MODER = 0x0;
 
#define SET_DATA_MODE_OUTPUT GPIOD->MODER = 0x55550000;
 
 
 
#define ADDR_IN GPIOE->IDR
 
#define DATA_IN GPIOD->IDR
 
#define DATA_OUT GPIOD->ODR
 
 
 
#define BUS_CE	(GPIOA->IDR & GPIO_PIN_1) // 1
 
#define BUS_WE	(GPIOA->IDR & GPIO_PIN_2) // 2
 
#define BUS_OE	(GPIOA->IDR & GPIO_PIN_3) // 3
 
///////////////////////////////////////////////////////////
 
// GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; all pins
 
// using loop
 
while(BUS_CE);
 
	 SET_DATA_MODE_OUTPUT
 
	 while(!BUS_OE){
 
		 addr = ADDR_IN & 0x7FFF;
 
		 DATA_OUT = cart_ram[addr] << 8;
 
	 }
 
	  SET_DATA_MODE_INPUT
 
 
 
// using INT, this interrupt is a clock 3.5MHz
 
void EXTI9_5_IRQHandler(void){
 
	addr = ADDR_IN & 0x7FFF;
 
	if( !BUS_OE && !BUS_CE){
 
		SET_DATA_MODE_OUTPUT
 
		DATA_OUT = (uint16_t)cart_ram[addr] << 8;
 
	}else{
 
		SET_DATA_MODE_INPUT
 
	}
 
	EXTI->PR1 = GPIO_PIN_7;
 
}

forgot something?

2 REPLIES 2
Uwe Bonnes
Principal III

Forget to enabling caches?

AOliv.1
Associate II

Both enabled:

/* Enable I-Cache---------------------------------------------------------*/
  SCB_EnableICache();
 
  /* Enable D-Cache---------------------------------------------------------*/
  SCB_EnableDCache();