cancel
Showing results for 
Search instead for 
Did you mean: 

FSMC shared - SRAM and IO expander (74LVC138)

julianomayor
Associate
Posted on July 22, 2013 at 04:59

I'm using a SRAM and 74LVC138 for addressing external IOs in address 80000H. The code example works well with SRAM, but I can not access the IOs. The pin A19 seems to be dead when I try to write at address 80000H. Thanks if anyone can help. Below is the startup code FSMC. I am using the example code from ST.

/*-- FSMC Configuration ------------------------------------------------------*/

  p.FSMC_AddressSetupTime = 1;

  p.FSMC_AddressHoldTime = 0;

  p.FSMC_DataSetupTime = 2;

  p.FSMC_BusTurnAroundDuration = 0;

  p.FSMC_CLKDivision = 0;

  p.FSMC_DataLatency = 0;

  p.FSMC_AccessMode = FSMC_AccessMode_A;

  FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;

  FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;

  //FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = IS_FSMC_MUX(0);

  FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;

  FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;

  FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;

  FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;  

  FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;

  FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;

  FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;

  FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;

  FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;

  FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;

  FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;

  FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;

  FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;

  FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); 

  /*!< Enable FSMC Bank1_SRAM2 Bank */

  FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE); 

#stm32 #fsmc
2 REPLIES 2
Posted on July 22, 2013 at 17:05

What about pin A18? Or with an offset at +0x100000?

Doesn't the address bus get shifted with 16-bit accesses?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
julianomayor
Associate
Posted on July 23, 2013 at 03:50

Correct. I was using 16-bit addressing (FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b) and forgot that the bus is shifted . Switching to 8-bit addressing works correctly. Thanks.