AnsweredAssumed Answered

FSMC static RAM question

Question asked by Andrew Queisser on Jul 22, 2011
Latest reply on Jul 29, 2011 by naik.deepak.001
Hi all,

I'm trying to understand how to use simple static RAM (not PSRAM, just standard async SRAM with separate addr and 16 bit data bus) attached to the FSMC as is done on the eval boards (STM3210E_EVAL and STM322xG_EVAL) I have. I read through the section on the FSMC and it all makes sense.

I was under the impression that I can simply access the external SRAM through the mapped address space with the FSMC translating 32 bit accesses into 16 bit accesses, so this should basically work:

int32_t foo;
foo = *(int32_t *)ADDRESS_IN_FSMC_SPACE;

Also, a memcpy should work into and out of FSMC space, even if it's implemented with 32 bit moves.

However, I came across some functions that force 16 bit moves from the C code level, which seems inefficient and unnecessary to me. For example  STM32F10x_StdPeriph_Lib_V3.3.0\Utilities\STM32_EVAL\STM3210E_EVAL\stm3210e_eval_fsmc_sram.c has this function, the same function exists in the :

/**
* @brief  Reads a block of data from the FSMC SRAM memory.
* @param  pBuffer : pointer to the buffer that receives the data read from the 
*         SRAM memory.
* @param  ReadAddr : SRAM memory internal address to read from.
* @param  NumHalfwordToRead : number of half-words to read.
* @retval None
*/
void SRAM_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead)
{
for(; NumHalfwordToRead != 0; NumHalfwordToRead--) /*!< while there is data to read */
{
/*!< Read a half-word from the memory */
*pBuffer++ = *(__IO uint16_t*) (Bank1_SRAM3_ADDR + ReadAddr);

/*!< Increment the address*/  
ReadAddr += 2;
}  
}



Are there any cases where a block copy has to be forced to use 16 bit accesses for normal SRAM. I understand that other types of memory attached to the FSMC might have totally different requirements.

Thanks,
Andrew Queisser

Outcomes