Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to write and read external SRAM in stm32F103

Status
Not open for further replies.

akshada

Member level 3
Joined
Jun 29, 2010
Messages
67
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
india
Activity points
1,746
Hello friends,
I am doing a project around stm32f103, where i need to load the hex file from remote server using wifi module.
What i did is, my device had less RAM so i connected an external SRAM so that i can dump the incoming hex file(size =60k) directly to the external sram and than to SD card later to the flash.
But i am confused how to direct the received hex file to external sram? can someone help me out.I have the sample code where they are writing the external sram using
void FSMC_SRAM_WriteBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
and
void FSMC_SRAM_ReadBuffer (u16 *pBuffer, u32 ReadAddr, u32 NumHalfwordToRead)

Also,my doubt is if it is an random access memory how we are able to read and write sequentially.

Thanks in advance.
 

This should be quite easy (SRAM is amongst the easiest to interface with). Once you've got your device wired up (I'm guessing
you're using the microcontroller in a non-expanded mode) then you need to write code that obeys the minimum timing requirements
in the datasheet for the device in question. In other words, set address, data and assert the CE and WR lines. or RD line if you've got the
data port pins set as input. You need a lot of IO pins of course, depending on the size of the busses.
If you're using your microcontroller in an expanded mode (i.e. with an address and data bus) then the attached SRAM will conveniently
just 'fit in' into your memory map. But looking at the names of your functions, I'm guessing you're in a non-expanded mode.
(I've no knowledge of the STM... device).
 

Thanks for the reply,Do i need to make any change in linker script file or startup file?
 

No, they are unrelated.
 

OK that means I just need to initialize the SRAM and use it.
I am using a circular buffer(capacity : 80 bytes) to receive bytes from UART.
Now,would I be able to keep dumping the circular buffer data to an external SRAM without any loss as the file from UART will be very large (bigger than the internal RAM size).

My point is I don't want to involve my internal RAM to receive the data from UART or should use just a few bytes(circular buffer).

Thanks
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top