Electronic – Expand RAM and flash on LPC2294

flashmicrocontrollernxpsdram

I have a project in mind. I want to buy an LPC2294 microcontroller, SDRAM IC, and flash IC (those IC's haven't yet been defined). What I want to do is connect those ICs to the microcontroller in order to expand its Program memory and data memory automatically (which means that I don't want to have to create a method to write on the flash or SDRAM, I want the microcontroller to be able to tell that it has those resources, and use them as if they were the microcontroller's on chip memories).

I know how to connect those components physically (since NXP's site has an example of this which was really easy to understand).

My main question: Is it only necessary to connect it via hardware and put LOW or HIGH on some pins on boot for the microcontroller to recognize those external resources as its own, or will I also have to do something else? For example: will I have to alter the memory registers that point to the internal flash and RAM and make those registers point to the external components? How would I be able to put the program on the external flash?

Would I have to write a bootloader and record it manually on theexternal flash or can I just use the internal bootloader, and somehow map it to the external devices?

If someone could explain this to me I would be really grateful. And if there's some code involved, or changes to the configuration files, could you please give me an example of how it works?

Best Answer

First you should verify whether you mean SDRAM or SRAM. I don't think this microcontroller supports SDRAM and I suspect you should plan to use an external SRAM.

Refer to the microcontroller documentation for examples on how to connect the microcontroller to the external SRAM and flash. You could also find an evaluation board that contains external memories and reference the eval board's schematic.

You will need to configure the microcontroller's External Memory Controller in order for the microcontroller to be able to use the external memories. Refer to the microcontroller's User Guide for details on how to configure the External Memory Controller. Basically each memory will be associated with a chip select pin and you will have to configure all the settings associated with the chip selects that you are using. Typically the External Memory Controller gets configured with some instructions in the startup code for your application. (It's configured by the startup code so that the external memories are accessible sooner rather than later.) You will likely have to provide, or at least customize, this portion of the startup code. Here again, if you can find an eval board with external memories then the example program that comes with the eval board will be a great reference.

Once the External Memory Controller is configured properly, the microcontroller should be able to read and write to the external SRAM without any additional driver code. The microcontroller should also be able to read from the external flash without any special driver code. However, writing to the external flash will require some special driver code that you will have to incorporate in your program. Refer to the flash part's datasheet for the erase and program algorithms that are required to reprogram the flash. Once again, an eval board example would be a good reference.

(If you don't need to reprogram the external flash at run time then you may not need the flash driver code. For example, you may be able to get by with reprogramming the flash via JTAG with a special flash programming application on your PC.)

I'm not familiar with the internal bootloader provided with this microcontroller. I suspect it reads code from the UART and copies it into internal SRAM and then executes it. I doubt that this bootloader will support your external memories automatically. But you may be able to get the source code for the internal bootloader and then customize it by adding support for your external memories.